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 unloadNetCommon() { if (isImported(sceUtilityUnloadNetModule)) return sceUtilityUnloadNetModule(PSP_NET_MODULE_COMMON); else if (isImported(sceUtilityUnloadModule)) return sceUtilityUnloadModule(PSP_MODULE_NET_COMMON); else return SCE_KERNEL_ERROR_ERROR; }
static int load_util(int module) { #ifdef UTILITY_AV_AVCODEC_PATH SceUID ret; #endif dbg_printf("Loading 0x%08X\n", module); if (isImported(sceUtilityLoadModule)) return sceUtilityLoadModule(module); else if (module <= PSP_MODULE_NET_SSL && isImported(sceUtilityLoadNetModule)) return sceUtilityLoadNetModule(module + PSP_NET_MODULE_COMMON - PSP_MODULE_NET_COMMON); else if (module == PSP_MODULE_USB_PSPCM && isImported(sceUtilityLoadUsbModule)) return sceUtilityLoadUsbModule(PSP_USB_MODULE_PSPCM); else if (module <= PSP_MODULE_USB_GPS && isImported(sceUtilityLoadUsbModule)) return sceUtilityLoadUsbModule(module + PSP_USB_MODULE_MIC - PSP_MODULE_USB_MIC); else if (module <= PSP_MODULE_AV_G729 && isImported(sceUtilityLoadAvModule)) return sceUtilityLoadAvModule(module + PSP_MODULE_AV_AVCODEC - PSP_AV_MODULE_AVCODEC); else #ifdef UTILITY_AV_AVCODEC_PATH if (module == PSP_MODULE_AV_AVCODEC) { ret = sceKernelLoadModule(UTILITY_AV_AVCODEC_PATH, 0, NULL); return ret < 0 ? ret : sceKernelStartModule(ret, 0, NULL, NULL, NULL); } else #endif #ifdef UTILITY_AV_SASCORE_PATH if (module == PSP_MODULE_AV_SASCORE) { ret = sceKernelLoadModule(UTILITY_AV_SASCORE_PATH, 0, NULL); return ret < 0 ? ret : sceKernelStartModule(ret, 0, NULL, NULL, NULL); } else #endif #ifdef UTILITY_AV_ATRAC3PLUS_PATH if (module == PSP_MODULE_AV_ATRAC3PLUS) { ret = sceKernelLoadModule(UTILITY_AV_ATRAC3PLUS_PATH, 0, NULL); return ret < 0 ? ret : sceKernelStartModule(ret, 0, NULL, NULL, NULL); } else #endif #ifdef UTILITY_AV_MPEGBASE_PATH if (module == PSP_MODULE_AV_MPEGBASE) { ret = sceKernelLoadModule(UTILITY_AV_MPEGBASE_PATH, 0, NULL); return ret < 0 ? ret : sceKernelStartModule(ret, 0, NULL, NULL, NULL); } else #endif return SCE_KERNEL_ERROR_ERROR; }
ClassDefinition* Tree::startClass( const Identifier& name, const GenericTypeParameterList& genericTypeParameters, const IdentifierList& parents, ClassDefinition::Properties& properties, const Location& location) { NameBindings* containingNameBindings = &globalNameBindings; auto containingClass = getCurrentClass(); if (containingClass != nullptr) { containingNameBindings = &(containingClass->getNameBindings()); } auto newClass = ClassDefinition::create(name, genericTypeParameters, parents, containingNameBindings, properties, location); if (containingClass != nullptr) { newClass->setIsImported(containingClass->isImported()); } if (!containingNameBindings->insertClass(name, newClass)) { Trace::error("Class already declared at the same scope: " + name, location); } if (!newClass->isGeneric()) { // For generic message classes, the empty copy constructor will be // generated when the concrete class is created from the generic one. if (newClass->needsCloneMethod()) { // The body of the copy constructor will be generated later by the // CloneGenerator, here we just generate an empty copy constructor. // The reason for generating an empty copy constructor at this stage // is that the copy constructor needs to be in the name bindings of // the new class before any other class can inherit from it. // Otherwise, the copy constructor will not be in the name bindings // of the derived class since name bindings are copied from the base // class to the derived class. newClass->generateEmptyCopyConstructor(); CloneGenerator::generateEmptyCloneMethod(newClass); } } openClasses.push_back(newClass); return newClass; }
void load_utils() { int ret; int module; unsigned i; if (isImported(sceUtilityLoadModule)) { // Load modules in order if (!globals->isEmu || sceNetIsImported) for(i = 0; i < sizeof(netModules) / sizeof(int); i++) { ret = sceUtilityLoadModule(netModules[i]); if (ret < 0) dbg_printf("%s: Loading 0x%08X failed 0x%08X\n", __func__, netModules[i], ret); } for(i = 0; i < sizeof(modules) / sizeof(int); i++) { ret = sceUtilityLoadModule(modules[i]); if (ret < 0) dbg_printf("%s: Loading 0x%08X failed 0x%08X\n", __func__, modules[i], ret); } ret = sceUtilityLoadModule(PSP_MODULE_AV_MP3); if (ret < 0) dbg_printf("%s: Loading 0x%08X failed 0x%08X\n", __func__, PSP_MODULE_AV_MP3, ret); } else { if (isImported(sceUtilityLoadNetModule)) for (module = 1; module <= 7; module++) { ret = sceUtilityLoadNetModule(module); if (ret < 0) dbg_printf("%s: Loading net module %d failed 0x%08X\n", __func__, module, ret); } if (isImported(sceUtilityLoadUsbModule)) for (module = 1; module <= 5; module++) { ret = sceUtilityLoadUsbModule(module); if (ret < 0) dbg_printf("%s: Loading USB module %d failed 0x%08X\n", __func__, module, ret); } if (isImported(sceUtilityLoadAvModule)) for (module = 1; module <= 7; module++) { ret = sceUtilityLoadAvModule(module); dbg_printf("%s: Loading AV module %d failed 0x%08X\n", __func__, module, ret); } else { #ifdef UTILITY_AV_AVCODEC_PATH avcodec_modid = sceKernelLoadModule(UTILITY_AV_AVCODEC_PATH, 0, NULL); sceKernelStartModule(avcodec_modid, 0, NULL, NULL, NULL); #endif #ifdef UTILITY_AV_SASCORE_PATH sascore_modid = sceKernelLoadModule(UTILITY_AV_SASCORE_PATH, 0, NULL); sceKernelStartModule(sascore_modid, 0, NULL, NULL, NULL); #endif #ifdef UTILITY_AV_ATRAC3PLUS_PATH atrac3plus_modid = sceKernelLoadModule(UTILITY_AV_ATRAC3PLUS_PATH, 0, NULL); sceKernelStartModule(atrac3plus_modid, 0, NULL, NULL, NULL); #endif #ifdef UTILITY_AV_MPEGBASE_PATH mpegbase_modid = sceKernelLoadModule(UTILITY_AV_MPEGBASE_PATH, 0, NULL); sceKernelStartModule(mpegbase_modid, 0, NULL, NULL, NULL); #endif } } }
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 } } }
// Loads and registers exports from an utility module SceLibraryEntryTable *load_export_util(UtilModInfo *util_mod, const char *lib) { SceLibraryEntryTable *exports; int *p; int ret, nid; if (util_mod == NULL || lib == NULL) return NULL; dbg_printf("Loading utility module for library %s\n", lib); //force load PSP_MODULE_AV_AVCODEC if we request a specific audio module if (util_mod->id > PSP_MODULE_AV_AVCODEC && util_mod->id <= PSP_MODULE_AV_G729) { dbg_printf("Force-Loading AVCODEC\n"); if (isImported(sceUtilityLoadModule)) sceUtilityLoadModule(PSP_MODULE_AV_AVCODEC); else if (isImported(sceUtilityLoadAvModule)) sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC); } else if(util_mod->id == PSP_MODULE_NET_HTTP) { dbg_printf("Force-Loading HTTP\n"); if (isImported(sceUtilityLoadModule)) { sceUtilityLoadModule(PSP_MODULE_NET_COMMON); sceUtilityLoadModule(PSP_MODULE_NET_INET); sceUtilityLoadModule(PSP_MODULE_NET_PARSEURI); sceUtilityLoadModule(PSP_MODULE_NET_PARSEHTTP); } else if (isImported(sceUtilityLoadNetModule)) { sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON); sceUtilityLoadNetModule(PSP_NET_MODULE_INET); sceUtilityLoadNetModule(PSP_NET_MODULE_PARSEURI); sceUtilityLoadNetModule(PSP_NET_MODULE_PARSEHTTP); } } ret = load_util(util_mod->id); if (ret < 0 && ret != 0x80111102) return NULL; #ifndef DISABLE_UNLOAD_UTILITY_MODULES #ifdef UTILITY_UNLOAD_MODULE_FILE if (!ret) ret = util_mod->id; #endif // PSP_MODULE_AV_AVCODEC -> cast syscall of sceAudiocodec and sceVideocodec // PSP_MODULE_AV_MP3 -> On 6.20 OFW, libmp3 has a bug when unload it. if ((util_mod->id != PSP_MODULE_AV_AVCODEC || globals->isEmu) && (util_mod->id != PSP_MODULE_AV_MP3 || globals->module_sdk_version > 0x06020010)) { #ifdef UTILITY_UNLOAD_MODULE_FILE add_util_table(ret); #else add_util_table(util_mod->id); #endif } #endif // Get module exports exports = find_exports(util_mod->name, lib); if (exports == NULL) { dbg_printf("->ERROR: could not find module exports for %s\n", util_mod->name); #ifndef DISABLE_UNLOAD_UTILITY_MODULES #ifdef UTILITY_UNLOAD_MODULE_FILE unload_util(ret); rm_util_table(ret); #else unload_util(util_mod->id); rm_util_table(ret); #endif #endif return NULL; } dbg_printf("Number of export functions: %d\n", exports->stubcount); dbg_printf("Pointer to exports: 0x%08X\n", (int)exports->entrytable); switch (util_mod->id) { case PSP_MODULE_NET_INET: if (util_mod == &net_apctl) nid = 0xB3EDD0EC; // sceNetApctlTerm else if (util_mod == &net_resolver) nid = 0x6138194A; // sceNetResolverTerm else if (util_mod == &net_inet) nid = 0xA9ED66B9; // sceNetInetTerm else return exports; break; case PSP_MODULE_NET_COMMON: nid = 0x281928A9; // sceNetTerm break; default: return exports; } for (p = (int *)exports->entrytable; (int)p < (int)exports->entrytable + exports->stubcount; p++) if (*p == nid) { net_term_func[net_term_num] = (void *)p[exports->stubcount]; net_term_num++; break; } return exports; }