int stopUnloadModule(SceUID modID) { int status; sceKernelStopModule(modID, 0, NULL, &status, NULL); sceKernelUnloadModule(modID); return 0; }
static int unload_util(int module) { #ifdef UTILITY_UNLOAD_MODULE_FILE int ret; #endif dbg_printf("Unloading 0x%08X\n", module); if (isImported(sceUtilityUnloadModule)) return sceUtilityUnloadModule(module); else if (module <= PSP_MODULE_NET_SSL && isImported(sceUtilityUnloadNetModule)) return sceUtilityUnloadNetModule(module + PSP_NET_MODULE_COMMON - PSP_MODULE_NET_COMMON); else if (module == PSP_MODULE_USB_PSPCM && isImported(sceUtilityUnloadUsbModule)) return sceUtilityUnloadUsbModule(PSP_USB_MODULE_PSPCM); else if (module <= PSP_MODULE_USB_GPS && isImported(sceUtilityUnloadUsbModule)) return sceUtilityUnloadUsbModule(module + PSP_USB_MODULE_MIC - PSP_MODULE_USB_MIC); else if (module <= PSP_MODULE_AV_G729 && isImported(sceUtilityUnloadAvModule)) return sceUtilityUnloadAvModule(module + PSP_MODULE_AV_AVCODEC - PSP_AV_MODULE_AVCODEC); else #ifdef UTILITY_UNLOAD_MODULE_FILE { ret = sceKernelStopModule(module, 0, NULL, NULL, NULL); return ret ? ret : sceKernelUnloadModule(module); } #else return SCE_KERNEL_ERROR_ERROR; #endif }
int unload_loader(void) { SceModule *mod; SceUID modid; int ret = 0; int status; mod = sceKernelFindModuleByName(BOOTLOADER_NAME); if(mod != NULL) { DEBUG_PRINTF("Loader UID: %08X\n", mod->modid); /* Stop module */ modid = mod->modid; ret = sceKernelStopModule(modid, 0, NULL, &status, NULL); if(ret >= 0) { ret = sceKernelUnloadModule(modid); } } else { Kprintf("Couldn't find bootloader\n"); } return 0; }
/* Exit callback */ int exit_callback (int arg1, int arg2, void *common) { int status; printf ("Stopping modules...\n"); sceKernelStopModule (modid, 0, NULL, &status, NULL); sceKernelUnloadModule (modid); sceKernelExitGame (); return 0; }
int LPP_UtilsStopUnloadModule(SceUID modid) { int status; int res = sceKernelStopModule(modid, 0, null, &status, null); if(res < 0) { return 0; } res = sceKernelUnloadModule(modid); return (res); }
int launcher_thread(SceSize args, void *argp) { int status = 0; // Unload the launcher SceModule2* mod = (SceModule2*)sceKernelFindModuleByName("launcher"); int result = sceKernelStopModule(mod->modid, 0, NULL, &status, NULL); result = sceKernelUnloadModule(mod->modid); // Load the game engine SceUID modid = sceKernelLoadModule(exefile, 0, NULL); sceKernelStartModule(modid, paramlength, parameters, &status, NULL); // Unload this module sceKernelSelfStopUnloadModule(1, 0, NULL); return 0; }
/* Subroutine sceHttpStorage_bridge_04EF00F8 - Address 0x00000438 Exported in sceHttpStorage_bridge */ u32 sceHttpStorage_bridge_04EF00F8(int a0) { u8 buf[16]; int res = 0x80000023; s32 oldk1 = pspShiftK1(); //0x47C if ((((a0 + 8) | a0) & (oldk1 << 11)) >= 0) { res = sceKernelSearchModuleByName("sceChkreg");//scekernelfindmodulebyname? //0x4A4 if ((u32) res != 0x8002012E) { //SCE_ERROR_KERNEL_UNKNOWN_MODULE //0x4AC if (res >= 0) { res = sceChkreg_driver_59F8491D((char *) a0); goto end; } pspSetK1(oldk1); return res; } res = sceKernelLoadModule("flash0:/kd/chkreg.prx"); //0x52C if (res == 0) { res = sceKernelStartModule(res, 0, 0, buf, 0); //0x540 if (res < 0) { goto end; } res = sceChkreg_driver_59F8491D((char *) a0); end: //0x4D0 if (res >= 0) { sceKernelStopModule(res, 0, 0, 0, 0); res = sceKernelUnloadModule(res); pspSetK1(oldk1); return (res < 0) ? res : sceKernelUnloadModule(res); } pspSetK1(oldk1); return res; } pspSetK1(oldk1); return res; } pspSetK1(oldk1); return res; }
int load(SceSize args, void *argp){ int stat,modid; if(sceKernelStartModule(modid=sceKernelLoadModule("flash0:/vsh/module/libfont_hv.prx",0,NULL),0,NULL,&stat,NULL)<0)return -__LINE__; int errorCode; InitParam initParams = {NULL,4,NULL,myMalloc,myFree,NULL,NULL,NULL,NULL,NULL,NULL}; void* libID = sceFontNewLib(&initParams, &errorCode);if(errorCode)return -__LINE__; void* fontID = sceFontOpen(libID, FONT(BOLD), FILE, &errorCode);if(errorCode)return -__LINE__; memset((void*)0x44000000,0,4*512*16); //print build date printchar(fontID, __DATE__" "__TIME__);//on vram sceIoWrite(2,__DATE__" "__TIME__,11+1+8);//on cout if(sceFontClose(fontID)) return -__LINE__; if(sceFontDoneLib(libID)) return -__LINE__; sceKernelStopModule(modid,0,NULL,&stat,NULL); sceKernelUnloadModule(modid); sceKernelSelfStopUnloadModule(1,0,NULL); return 0; }
static void stop_unload_usbdevice(void) { int ret; ret = sceKernelStopModule(g_usbdevice_modid, 0, NULL, NULL, NULL); #ifdef DEBUG if(ret < 0) { printk("%s: sceKernelStopModule(0x%08X) -> 0x%08X\n", __func__, g_usbdevice_modid, ret); } #endif ret = sceKernelUnloadModule(g_usbdevice_modid); #ifdef DEBUG if(ret < 0) { printk("%s: sceKernelUnloadModule(0x%08X) -> 0x%08X\n", __func__, g_usbdevice_modid, ret); } #endif if (ret >= 0) { g_usbdevice_modid = -1; } }
void unload_utils() { int module; int ret; int i; if (isImported(sceUtilityUnloadModule)) { //Unload modules in reverse order if (globals->module_sdk_version > 0x06020010) { ret = sceUtilityUnloadModule(PSP_MODULE_AV_MP3); if (ret < 0) dbg_printf("%s: Unloading 0x%08X failed 0x%08X\n", __func__, PSP_MODULE_AV_MP3, ret); } for(i = sizeof(modules) / sizeof(int) - 1; i >= 0; i--) { ret = sceUtilityUnloadModule(modules[i]); if (ret < 0) dbg_printf("%s: Unloading 0x%08X failed 0x%08X\n", __func__, modules[i], ret); } if (!globals->isEmu || sceNetIsImported) for(i = sizeof(netModules) / sizeof(int) - 1; i >= 0; i--) { ret = sceUtilityUnloadModule(netModules[i]); if (ret < 0) dbg_printf("%s: Unloading 0x%08X failed 0x%08X\n", __func__, netModules[i], ret); } } else { if (isImported(sceUtilityUnloadNetModule)) for (module = 7; module >= 1; module--) { ret = sceUtilityUnloadNetModule(module); if (ret < 0) dbg_printf("%s: Unloading net module %d failed 0x%08X\n", __func__, module, ret); } if (isImported(sceUtilityUnloadUsbModule)) for (module = 5; module >= 1; module--) { ret = sceUtilityUnloadUsbModule(module); if (ret < 0) dbg_printf("%s: Unloading USB module %d failed 0x%08X\n", __func__, module, ret); } if (isImported(sceUtilityUnloadAvModule)) { for (module = 7; module >= 5; module--) { ret = sceUtilityUnloadAvModule(module); if (ret < 0) dbg_printf("%s: Unloading AV module %d failed 0x%08X\n", __func__, module, ret); } if (globals->module_sdk_version <= 0x06020010) module--; // Skip PSP_AV_MODULE_MP3 while (module >= 1) { ret = sceUtilityUnloadAvModule(module); if (ret < 0) dbg_printf("%s: Unloading AV module %d failed 0x%08X\n", __func__, module, ret); module--; } } else { #ifdef UTILITY_AV_AVCODEC_PATH sceKernelStopModule(avcodec_modid, 0, NULL, NULL, NULL); sceKernelUnloadModule(avcodec_modid); #endif #ifdef UTILITY_AV_SASCORE_PATH sceKernelStopModule(sascore_modid, 0, NULL, NULL, NULL); sceKernelUnloadModule(sascore_modid); #endif #ifdef UTILITY_AV_ATRAC3PLUS_PATH sceKernelStopModule(atrac3plus_modid, 0, NULL, NULL, NULL); sceKernelUnloadModule(atrac3plus_modid); #endif #ifdef UTILITY_AV_MPEGBASE_PATH sceKernelStopModule(mpegbase_modid, 0, NULL, NULL, NULL); sceKernelUnloadModule(mpegbase_modid); #endif } } }