int main_thread(SceSize args, void *argp) { char *argv0; char prx_path[256]; char *path; SceUID modid; int ret; pspDebugScreenInit(); sceDisplayWaitVblankStart(); pspSdkInstallNoDeviceCheckPatch(); pspSdkInstallNoPlainModuleCheckPatch(); pspSdkInstallKernelLoadModulePatch(); argv0 = (char*) argp; path = strrchr(argv0, '/'); if(path != NULL) { memcpy(prx_path, argv0, path - argv0 + 1); prx_path[path - argv0 + 1] = 0; strcat(prx_path, "psplink.prx"); } else { /* Well try for a default */ strcpy(prx_path, "ms0:/psplink.prx"); } /* Start mymodule.prx and dump its information */ printf("PSPLink Bootstrap TyRaNiD (c) 2k5 Version %s\n", PSPLINK_VERSION); modid = load_module(prx_path, 0, 0); if(modid >= 0) { int status; printf("Starting psplink module\n"); ret = sceKernelStartModule(modid, args, argp, &status, NULL); printf("Done\n"); } else { printf("Error loading psplink module %08X\n", modid); } /* Let's bug out */ sceKernelExitDeleteThread(0); return 0; }
void _main(SceSize args, void *argp) { static SceUID modid; static int retVal, status; static SceKernelLMOption option; extern u8 *payload; extern u32 size_payload; extern u32 size_payload_uncomp; u8 *buffer; SceUID bufferBlock; pspDebugScreenInit(); pspDebugScreenClear(); pspDebugInstallKprintfHandler(NULL); //pspDebugInstallErrorHandler(NULL); pspSdkInstallNoPlainModuleCheckPatch(); memset(&option, 0, sizeof(option)); option.size = sizeof(option); option.mpidtext = 1; option.mpiddata = 1; option.position = 0; option.access = 1; bufferBlock = sceKernelAllocPartitionMemory(2, "PSPPackerBuffer", PSP_SMEM_High, size_payload_uncomp, NULL); if (bufferBlock < 0) { printf("allocpartitionmemory failed with 0x%08X\n", bufferBlock); goto exit; } buffer = sceKernelGetBlockHeadAddr(bufferBlock); retVal = sceKernelGzipDecompress(buffer, size_payload_uncomp, (u8*)&payload, 0); if (retVal < 0) { printf("sceKernelGzipDecompress failed with 0x%08X\n", retVal); goto exit; } modid = sceKernelLoadModuleBufferUsbWlan(size_payload, buffer, 0, &option); retVal = sceKernelFreePartitionMemory(bufferBlock); if (retVal < 0) printf("Error freeing decompress buffer (0x%08X)\n", retVal); if(modid > 0) retVal = sceKernelStartModule(modid, 0, NULL, &status, NULL); exit: /* Let's bug out */ //sceKernelSelfStopUnloadModule(0, 0, NULL); //return 0; sceKernelExitDeleteThread(0); }
void loaderInit(){ pspKernelSetKernelPC(); pspSdkInstallNoDeviceCheckPatch(); pspSdkInstallNoPlainModuleCheckPatch(); pspSdkInstallKernelLoadModulePatch(); }