From e8d19081761ae8289fad5dc7c225b1ec458be1d9 Mon Sep 17 00:00:00 2001 From: JoseAaronLopezGarcia Date: Sun, 16 Jul 2023 17:31:01 +0200 Subject: [PATCH] fix extra ram on vita --- common/include/globals.h | 2 +- core/compat/pentazemin/rebootex/patches.c | 2 +- core/compat/pentazemin/vitamem.c | 4 ++-- core/compat/vita/rebootex/patches.c | 4 ++-- core/compat/vitapops/syspatch.c | 26 +++++++++++++++++------ loader/live/kernel/psxloader/main.c | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/common/include/globals.h b/common/include/globals.h index bf1ffc517..7062acac4 100644 --- a/common/include/globals.h +++ b/common/include/globals.h @@ -38,7 +38,7 @@ #define USER_SIZE (24 * 1024 * 1024) #define KERNEL_SIZE (4 * 1024 * 1024) #define VITA_FLASH_SIZE 0x01000000 // 16MiB -#define VITA_EXTRA_RAM_SIZE (16 * 1024 * 1024) +#define EXTRA_RAM_SIZE (32 * 1024 * 1024) #define MAX_HIGH_MEMSIZE 55 // ARK_CONFIG diff --git a/core/compat/pentazemin/rebootex/patches.c b/core/compat/pentazemin/rebootex/patches.c index 7cd311fbe..18a6611c0 100644 --- a/core/compat/pentazemin/rebootex/patches.c +++ b/core/compat/pentazemin/rebootex/patches.c @@ -114,7 +114,7 @@ void SetMemoryPartitionTablePatched(void *sysmem_config, SceSysmemPartTable *tab // Add flash0 ramfs as partition 11 SetMemoryPartitionTable(sysmem_config, table); table->extVshell.addr = EXTRA_RAM; - table->extVshell.size = VITA_EXTRA_RAM_SIZE; + table->extVshell.size = VITA_FLASH_SIZE; } int PatchSysMem(void *a0, void *sysmem_config) diff --git a/core/compat/pentazemin/vitamem.c b/core/compat/pentazemin/vitamem.c index 7e8cb452e..30ce7e784 100644 --- a/core/compat/pentazemin/vitamem.c +++ b/core/compat/pentazemin/vitamem.c @@ -34,8 +34,8 @@ void unlockVitaMemory(){ } - u32 kernel_size = 0; //VITA_EXTRA_RAM_SIZE - extra_user_ram; // p11 size - u32 user_size = USER_SIZE + VITA_EXTRA_RAM_SIZE; // new p2 size + u32 kernel_size = 0; // EXTRA_RAM_SIZE - extra_user_ram; // p11 size + u32 user_size = USER_SIZE + VITA_FLASH_SIZE; // new p2 size // modify p2 partition = GetPartition(PSP_MEMORY_PARTITION_USER); diff --git a/core/compat/vita/rebootex/patches.c b/core/compat/vita/rebootex/patches.c index 18c7ca1e9..40f799a81 100644 --- a/core/compat/vita/rebootex/patches.c +++ b/core/compat/vita/rebootex/patches.c @@ -58,8 +58,8 @@ void SetMemoryPartitionTablePatched(void *sysmem_config, SceSysmemPartTable *tab { // Add flash0 ramfs as partition 11 SetMemoryPartitionTable(sysmem_config, table); - table->extVshell.addr = 0x0B000000; - table->extVshell.size = (12*1024*1024); + table->extVshell.addr = EXTRA_RAM; + table->extVshell.size = EXTRA_RAM_SIZE; } int PatchSysMem(void *a0, void *sysmem_config) diff --git a/core/compat/vitapops/syspatch.c b/core/compat/vitapops/syspatch.c index 1879d785b..5c315eea7 100644 --- a/core/compat/vitapops/syspatch.c +++ b/core/compat/vitapops/syspatch.c @@ -295,13 +295,19 @@ int dummythread(int argc, void* argp){ int kermitSendRequestLog(void* a0, int a1, int a2, int a3, int a4, void* a5){ - char tmp[64]; - sprintf("mode: %d, cmd: %d\n", a1, a2); - - int fd = sceIoOpen("ms0:/vitapops.log", PSP_O_WRONLY|PSP_O_APPEND|PSP_O_CREAT, 0777); - sceIoWrite(fd, tmp, strlen(tmp)); - sceIoWrite(fd, "\n", 1); - sceIoClose(fd); + static volatile int logging = 0; + static char tmp[64]; + + //if (a1 == 9 && a2 == 1042) return 0; + + if (!logging){ + logging = 1; + sprintf(tmp, "mode: %d, cmd: %d\n", a1, a2); + int fd = sceIoOpen("ms0:/kermit.log", PSP_O_WRONLY|PSP_O_APPEND|PSP_O_CREAT, 0777); + sceIoWrite(fd, tmp, strlen(tmp)); + sceIoClose(fd); + logging = 0; + } return sceKermitSendRequest(a0, a1, a2, a3, a4, a5); } @@ -309,6 +315,12 @@ int kermitSendRequestLog(void* a0, int a1, int a2, int a3, int a4, void* a5){ void ARKVitaPopsOnModuleStart(SceModule2 * mod){ static int booted = 0; + + /* + if (strcmp(mod->modname, "sceIOFileManager") != 0 && strcmp(mod->modname, "sceKermitMsfs_driver") != 0){ + hookImportByNID(mod, "sceKermit_driver", 0x36666181, kermitSendRequestLog); + } + */ // Patch display in PSX exploits if(strcmp(mod->modname, "sceDisplay_Service") == 0) { diff --git a/loader/live/kernel/psxloader/main.c b/loader/live/kernel/psxloader/main.c index b9d8f0570..a52d2cbe1 100644 --- a/loader/live/kernel/psxloader/main.c +++ b/loader/live/kernel/psxloader/main.c @@ -156,7 +156,7 @@ int exploitEntry(){ scanKernelFunctions(k_tbl); // Extremely nasty solution to get screen working fine - k_tbl->KernelDelayThread(10000); // wait for system to finish booting up + k_tbl->KernelDelayThread(20000); // wait for system to finish booting up loadstart_pops(); // load and start pops module k_tbl->KernelDelayThread(1000000); // wait for pops to set up things kill_pops(); // kill pops threads to prevent crash