Example #1
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
}
Example #2
0
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;
}
Example #3
0
bool Mp3PspStream::stopDecoder() {
	DEBUG_ENTER_FUNC();

	if (!_decoderInit)
		return true;

	// Based on PSP firmware version, we need to do different things to do Media Engine processing
    if (sceKernelDevkitVersion() == 0x01050001){  // TODO: how do we unload?
/*      if (!unloadAudioModule("flash0:/kd/me_for_vsh.prx", PSP_MEMORY_PARTITION_KERNEL) ||
			!unloadAudioModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL) {
			PSP_ERROR("failed to unload audio module\n");
			return false;
		}
*/
    }else{
        if (sceUtilityUnloadModule(PSP_MODULE_AV_AVCODEC) < 0) {
			PSP_ERROR("failed to unload avcodec module\n");
			return false;
		}
	}

	_decoderInit = false;
	return true;
}
Example #4
0
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
		}
	}
}