Skip to content

Commit

Permalink
update pcsx2f_api.h
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirteenAG committed Oct 10, 2024
1 parent a271a2b commit 591eced
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
26 changes: 23 additions & 3 deletions includes/pcsx2/memalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef struct {
#define PMPA_POINTER_IS_IN_POOL(a) PMPA_POINTER_IS_IN_RANGE(a, PMPA_FIRST_VALID_ADDRESS_IN_POOL, master_memory_block_size)

#ifndef MEM_CUSTOM_TOTAL_SIZE
#define MEM_CUSTOM_TOTAL_SIZE 1000000
#define MEM_CUSTOM_TOTAL_SIZE 100000
#endif

static pmpa_memory_block master_memory_block[MEM_CUSTOM_TOTAL_SIZE] = { 0 };
Expand Down Expand Up @@ -53,7 +53,7 @@ static void concat_sequential_blocks(pmpa_memory_block *memory_block, bool is_al

static pmpa_memory_block *find_first_block(bool is_allocated, pmpa_memory_int min_size)
{
pmpa_memory_block *memory_block = master_memory_block;
pmpa_memory_block *memory_block = PMPA_FIRST_VALID_ADDRESS_IN_POOL;

while (PMPA_POINTER_IS_IN_POOL(memory_block + sizeof(pmpa_memory_block))) {
/* If we're trying to find an block, then defragment the pool as we go along.
Expand Down Expand Up @@ -202,4 +202,24 @@ void operator delete(void* p)
{
FreeMemBlock(p);
}
#endif
#endif

void* __wrap_malloc(size_t size)
{
return pmpa_malloc(size);
}

void* __wrap_calloc(size_t n, size_t size)
{
return pmpa_calloc(n, size);
}

void* __wrap_realloc(void* p, size_t size)
{
return pmpa_realloc(p, size);
}

void __wrap_free(void* ptr)
{
return pmpa_free(ptr);
}
1 change: 0 additions & 1 deletion includes/pcsx2/pcsx2f_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ struct PluginInfo
uint32_t CLEOScriptsAddr;
uint32_t CLEOScriptsSize;

uint32_t ps2sdk_libc_init;
uint32_t ps2sdk_libcpp_init;
uint32_t __cxa_atexit;

Expand Down
2 changes: 1 addition & 1 deletion makefile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ASFLAGS = $(CFLAGS)
BASE_ADDRESS = %s
EE_LINKFILE = linkfile
EE_LIBS += %s
EE_LDFLAGS = -Wl,--entry=init -Wl,--no-relax -Wl,-Map,../data/%s.map -Wl,'--defsym=BASE_ADDRESS=$(BASE_ADDRESS)'
EE_LDFLAGS = -Wl,--entry=init -Wl,--wrap,malloc -Wl,--wrap,calloc -Wl,--wrap,realloc -Wl,--wrap,free -Wl,--no-relax -Wl,--no-relax -Wl,-Map,../data/%s.map -Wl,'--defsym=BASE_ADDRESS=$(BASE_ADDRESS)'
all: clean main-build
Expand Down
2 changes: 1 addition & 1 deletion source/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ASFLAGS = $(CFLAGS)
BASE_ADDRESS = 0x05000000
EE_LINKFILE = linkfile
EE_LIBS += -l:libstdc++.a -l:libm.a
EE_LDFLAGS = -Wl,--entry=init -Wl,--no-relax -Wl,-Map,../data/PLUGINS/cleo.map -Wl,'--defsym=BASE_ADDRESS=$(BASE_ADDRESS)'
EE_LDFLAGS = -Wl,--entry=init -Wl,--wrap,malloc -Wl,--wrap,calloc -Wl,--wrap,realloc -Wl,--wrap,free -Wl,--no-relax -Wl,--no-relax -Wl,-Map,../data/PLUGINS/cleo.map -Wl,'--defsym=BASE_ADDRESS=$(BASE_ADDRESS)'

all: clean main-build

Expand Down

0 comments on commit 591eced

Please sign in to comment.