Skip to content

Commit

Permalink
test sceKernelGetModel hook
Browse files Browse the repository at this point in the history
  • Loading branch information
hrimfaxi committed Jul 8, 2011
1 parent c872fb7 commit cb10503
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions popsloader/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ static int _sceIoOpen(const char *file, int flag, int mode)
return ret;
}

static int _sceKernelGetModel(void)
{
if(pops_fw_version <= FW_401) {
if(psp_model >= PSP_3000) {
return PSP_2000;
}
} else if(pops_fw_version <= FW_551) {
if(psp_model >= PSP_4000) {
return PSP_3000;
}
}

return psp_model;
}

static int popsloader_patch_chain(SceModule2 *mod)
{
printk("%s: %s\n", __func__, mod->modname);
Expand All @@ -66,7 +81,11 @@ static int popsloader_patch_chain(SceModule2 *mod)

if(pops_fw_version <= FW_401) {
if(0 == strcmp(mod->modname, "sceImpose_Driver")) {
u32 sceKernelGetModel_nid;

sceKernelGetModel_nid = psp_fw_version == FW_620 ? 0x864EBDF7 : 0x458A70B5;
hook_import_bynid((SceModule*)mod, "IoFileMgrForKernel", 0x109F50BC, _sceIoOpen, 0);
hook_import_bynid((SceModule*)mod, "SysMemForKernel", sceKernelGetModel_nid, _sceKernelGetModel, 0);
}
}

Expand Down

0 comments on commit cb10503

Please sign in to comment.