I have two conclusion for my issue: the first one is that I'm using wrong module and library names (the NID for 5.00 was given by Silverspring in a post over this forum). The second conclusion is, if module and library names are correct, then maybe sceGuFinish is never call by the XMB.
This is the code I'm using to test if the function is being hooked:
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspgu.h>
#include <systemctrl.h>
#include <stdio.h>
#include <string.h>
PSP_MODULE_INFO("test", 0x1000, 1, 0);
void myGuFinish()
{
int k1 = pspSdkSetK1(0);
sceGuClearColor(GU_RGBA(255, 255, 255, 255));
sceGuClear(GU_COLOR_BUFFER_BIT);
pspSdkSetK1(k1);
sceGuFinish();
}
STMOD_HANDLER previous = NULL;
u32 orgaddr;
int OnModuleStart(SceModule2 *mod)
{
if (strcmp(mod->modname, "scePaf_Module") == 0)
{
orgaddr=sctrlHENFindFunction("scePaf_Module", "scePaf", 0x4170FB8F);
sctrlHENPatchSyscall(orgaddr, myGuFinish);
sceKernelDcacheWritebackAll();
sceKernelIcacheClearAll();
}
if (!previous)
return 0;
return previous(mod);
}
int module_start(SceSize args, void *argp)
{
previous = sctrlHENSetStartModuleHandler(OnModuleStart);
return 0;
}