Skip to content

Commit

Permalink
fixed registry copying when using MMC method
Browse files Browse the repository at this point in the history
  • Loading branch information
krazynez committed Oct 4, 2024
1 parent feb9379 commit b31ad19
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Binary file modified contrib/PC/MagicMemoryCreator/TM/DCARK/150/reboot150.prx
Binary file not shown.
33 changes: 30 additions & 3 deletions extras/150kernel/reboot150/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ int LoadReboot(void * arg1, unsigned int arg2, void * arg3, unsigned int arg4)

rebootex_config->boot_from_fw_version = sceKernelDevkitVersion();

// clean reboot memory
// clean reboot memory
memset((char *)REBOOT150_TEXT, 0, 0x400000);

memcpy(REBOOTEX_TEXT, rebootex150, size_rebootex150);

// Restore Reboot Buffer Configuration
// Restore Reboot Buffer Configuration
memcpy((void *)REBOOTEX_CONFIG, &rebootex_config, sizeof(RebootConfigARK));

// Restore ARK Configuration
Expand All @@ -37,6 +37,33 @@ int LoadReboot(void * arg1, unsigned int arg2, void * arg3, unsigned int arg4)

int module_start(SceSize args, void *argp)
{
int dreg = sceIoOpen("ms0:/TM/DCARK/150/registry/system.dreg", PSP_O_RDONLY, 0);
int ireg = sceIoOpen("ms0:/TM/DCARK/150/registry/system.ireg", PSP_O_RDONLY, 0);
if(dreg < 0 && ireg < 0) {
dreg = sceIoOpen("ms0:/TM/DCARK/150/registry/system.dreg", PSP_O_WRONLY | PSP_O_CREAT, 0777);
ireg = sceIoOpen("ms0:/TM/DCARK/150/registry/system.ireg", PSP_O_WRONLY | PSP_O_CREAT, 0777);
int flash_dreg = sceIoOpen("flash1:/registry/system.dreg", PSP_O_RDONLY, 0);
int flash_ireg = sceIoOpen("flash1:/registry/system.ireg", PSP_O_RDONLY, 0);

static u8 buf[200000]; __attribute__((aligned(0x40)));
memset((u8 *)buf, 0, sizeof(buf));

int size = sceIoRead(flash_dreg, buf, sizeof(buf));
sceIoWrite(dreg, buf, size);
sceIoClose(dreg);
sceIoClose(flash_dreg);

memset((u8 *)buf, 0, sizeof(buf));

size = sceIoRead(flash_ireg, buf, sizeof(buf));
sceIoWrite(ireg, buf, size);
sceIoClose(ireg);
sceIoClose(flash_ireg);
}
sceIoClose(dreg);
sceIoClose(ireg);


sctrlHENSetLoadRebootOverrideHandler(LoadReboot);

return 0;
Expand All @@ -45,4 +72,4 @@ int module_start(SceSize args, void *argp)
int module_stop(void)
{
return 0;
}
}

0 comments on commit b31ad19

Please sign in to comment.