8 #include <psp2kern/types.h> 9 #include <psp2kern/kernel/sysmem.h> 14 extern SceUID g_patch_pool;
23 void *malloc(
size_t size) {
25 ptr = sceKernelMemPoolAlloc(g_patch_pool, size +
sizeof(
size_t));
27 *(
size_t *)ptr = size;
28 ptr = (
char *)ptr +
sizeof(
size_t);
38 void free(
void *ptr) {
39 sceKernelMemPoolFree(g_patch_pool, (
char *)ptr -
sizeof(
size_t));
50 void *realloc(
void *ptr,
size_t size) {
56 oldsize = *(
size_t *)((
char *)ptr -
sizeof(size_t));
60 memcpy(dup, ptr, oldsize);