Big NOTE: The handler must be installed in kernel mode (using the previous trick that has already been discussed). It also relies on direct calls as you cannot link kmode and user mode libs in one app, therefore it is dependant on the version of the psp you are running. You have been warned :P
Have fun.
Code: Select all
#ifdef VERSION_10
void (*sceKernelRegisterKprintfHandler)(void *fn, void *arg) = (void*) 0x88007598;
void (*Kprintf)(const char *str, ...) = (void *)0x88007D4C;
#else
void (*sceKernelRegisterKprintfHandler)(void *fn, void *arg) = (void*) 0x8800B5F8;
void (*Kprintf)(const char *str, ...) = (void *)0x8800B550;
#endif
int kprintf_handler(void *arg, const char *str, u32 *args)
{
printf(str, args[0], args[1], args[2], args[3]);
return 0;
}
// Main function in kernel mode
int kmain(void)
{
u32 addr;
addr = (u32) kprintf_handler;
addr |= 0x80000000;
sceKernelRegisterKprintfHandler((void *) addr, NULL);
return 0;
}