Exemplo n.º 1
0
void CPU_Shutdown() {
	if (g_Config.bAutoSaveSymbolMap) {
		host->SaveSymbolMap();
	}

	Replacement_Shutdown();

	CoreTiming::Shutdown();
	__KernelShutdown();
	HLEShutdown();
	if (coreParameter.enableSound) {
		host->ShutdownSound();
		audioInitialized = false;  // deleted in ShutdownSound
	}
	pspFileSystem.Shutdown();
	mipsr4k.Shutdown();
	Memory::Shutdown();

	delete loadedFile;
	loadedFile = nullptr;

	delete coreParameter.mountIsoLoader;
	delete g_symbolMap;
	g_symbolMap = nullptr;

	coreParameter.mountIsoLoader = nullptr;
}
Exemplo n.º 2
0
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
{
	INFO_LOG(HLE, "PPSSPP %s", PPSSPP_GIT_VERSION);

	coreParameter = coreParam;
	currentCPU = &mipsr4k;
	numCPUs = 1;
	Memory::Init();
	mipsr4k.Reset();
	mipsr4k.pc = 0;

	host->AttemptLoadSymbolMap();

	if (coreParameter.enableSound)
	{
		mixer = new PSPMixer();
		host->InitSound(mixer);
	}

	if (coreParameter.disableG3Dlog)
	{
		LogManager::GetInstance()->SetEnable(LogTypes::G3D, false);
	}

	CoreTiming::Init();

	// Init all the HLE modules
	HLEInit();

	// TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly

	std::string filename = coreParameter.fileToStart;
	if (!LoadFile(filename, error_string)) {
		pspFileSystem.Shutdown();
		CoreTiming::Shutdown();
		__KernelShutdown();
		HLEShutdown();
		host->ShutdownSound();
		Memory::Shutdown();
		coreParameter.fileToStart = "";
		return false;
	}

	if (coreParam.updateRecent)
		g_Config.AddRecent(filename);

	// Setup JIT here.
	if (coreParameter.startPaused)
		coreState = CORE_STEPPING;
	else
		coreState = CORE_RUNNING;
	return true;
}
Exemplo n.º 3
0
bool __KernelLoadExec(const char *filename, SceKernelLoadExecParam *param, std::string *error_string)
{
	// Wipe kernel here, loadexec should reset the entire system
	if (__KernelIsRunning())
		__KernelShutdown();

	__KernelModuleInit();
	__KernelInit();
	
	PSPFileInfo info = pspFileSystem.GetFileInfo(filename);

	u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ);

	u8 *temp = new u8[(int)info.size + 0x1000000];

	pspFileSystem.ReadFile(handle, temp, (size_t)info.size);

	Module *module = __KernelLoadModule(temp, 0, error_string);

	if (!module) {
		ERROR_LOG(LOADER, "Failed to load module %s", filename);
		return false;
	}

	mipsr4k.pc = module->nm.entry_addr;

	INFO_LOG(LOADER, "Module entry: %08x", mipsr4k.pc);

	delete [] temp;

	pspFileSystem.CloseFile(handle);

	SceKernelSMOption option;
	option.size = sizeof(SceKernelSMOption);
	option.attribute = PSP_THREAD_ATTR_USER;
	option.mpidstack = 2;
	option.priority = 0x20;
	option.stacksize = 0x40000;	// crazy? but seems to be the truth

	// Replace start options with module-specified values if they exist.
	if (module->nm.module_start_thread_attr != 0)
		option.attribute = module->nm.module_start_thread_attr;
	if (module->nm.module_start_thread_priority != 0)
		option.priority = module->nm.module_start_thread_priority;
	if (module->nm.module_start_thread_stacksize != 0)
		option.stacksize = module->nm.module_start_thread_stacksize;

	__KernelStartModule(module, (u32)strlen(filename) + 1, filename, &option);

	__KernelStartIdleThreads();
	return true;
}
Exemplo n.º 4
0
void CPU_Shutdown() {
	if (g_Config.bAutoSaveSymbolMap) {
		host->SaveSymbolMap();
	}

	CoreTiming::Shutdown();
	__KernelShutdown();
	HLEShutdown();
	if (coreParameter.enableSound) {
		host->ShutdownSound();
		mixer = 0;  // deleted in ShutdownSound
	}
	pspFileSystem.Shutdown();
	Memory::Shutdown();
	currentCPU = 0;
}
Exemplo n.º 5
0
void PSP_Shutdown()
{
	pspFileSystem.Shutdown();

	CoreTiming::Shutdown();

	if (coreParameter.enableSound)
	{
		host->ShutdownSound();
		mixer = 0;  // deleted in ShutdownSound
	}
	__KernelShutdown();
	HLEShutdown();
	Memory::Shutdown();
	currentCPU = 0;
}
Exemplo n.º 6
0
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
{
	coreParameter = coreParam;
	currentCPU = &mipsr4k;
	numCPUs = 1;
	Memory::Init();
	mipsr4k.Reset();
	mipsr4k.pc = 0;

	if (coreParameter.enableSound)
	{
		mixer = new PSPMixer();
		host->InitSound(mixer);
	}

	if (coreParameter.disableG3Dlog)
	{
		LogManager::GetInstance()->SetEnable(LogTypes::G3D, false);
	}

	CoreTiming::Init();

	// Init all the HLE modules
	HLEInit();

	// TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly

	if (!LoadFile(coreParameter.fileToStart.c_str(), error_string))
	{
		pspFileSystem.Shutdown();
		CoreTiming::Shutdown();
		__KernelShutdown();
		HLEShutdown();
		host->ShutdownSound();
		Memory::Shutdown();
		coreParameter.fileToStart = "";
		return false;
	}

	// Setup JIT here.
	if (coreParameter.startPaused)
		coreState = CORE_STEPPING;
	else
		coreState = CORE_RUNNING;
	return true;
}
Exemplo n.º 7
0
void PSP_Shutdown()
{
	pspFileSystem.Shutdown();

	TextureCache_Clear(true);

	CoreTiming::ClearPendingEvents();
	CoreTiming::UnregisterAllEvents();

	if (coreParameter.enableSound)
	{
		host->ShutdownSound();
	}
	__KernelShutdown();
	HLEShutdown();
	Memory::Shutdown() ;
	currentCPU = 0;
}
Exemplo n.º 8
0
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
{
	coreParameter = coreParam;
	currentCPU = &mipsr4k;
	numCPUs = 1;
	Memory::Init();
	mipsr4k.Reset();
	mipsr4k.pc = 0;

	if (coreParameter.enableSound)
	{
		host->InitSound(new PSPMixer());
	}

	// Init all the HLE modules
	HLEInit();

	// TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly

	if (!LoadFile(coreParameter.fileToStart.c_str(), error_string))
	{
		pspFileSystem.UnmountAll();
		CoreTiming::ClearPendingEvents();
		CoreTiming::UnregisterAllEvents();
		__KernelShutdown();
		HLEShutdown();
		host->ShutdownSound();
		Memory::Shutdown();
		coreParameter.fileToStart = "";
		return false;
	}

	shaderManager.DirtyShader();
	shaderManager.DirtyUniform(DIRTY_ALL);

	// Setup JIT here.
	if (coreParameter.startPaused)
		coreState = CORE_STEPPING;
	else
		coreState = CORE_RUNNING;
	return true;
}
Exemplo n.º 9
0
bool PSP_Init(const CoreParameter &coreParam, std::string *error_string)
{
	INFO_LOG(HLE, "PPSSPP %s", PPSSPP_GIT_VERSION);

	coreParameter = coreParam;
	currentCPU = &mipsr4k;
	numCPUs = 1;

	// Default memory settings
	// Seems to be the safest place currently..
	Memory::g_MemorySize = 0x2000000; // 32 MB of ram by default
	g_RemasterMode = false;
	g_DoubleTextureCoordinates = false;

	std::string filename = coreParam.fileToStart;
	EmuFileType type = Identify_File(filename);

	if(type == FILETYPE_PSP_ISO || type == FILETYPE_PSP_ISO_NP || type == FILETYPE_PSP_DISC_DIRECTORY)
		InitMemoryForGameISO(filename);

	Memory::Init();
	mipsr4k.Reset();
	mipsr4k.pc = 0;

	host->AttemptLoadSymbolMap();

	if (coreParameter.enableSound)
	{
		mixer = new PSPMixer();
		host->InitSound(mixer);
	}

	if (coreParameter.disableG3Dlog)
	{
		LogManager::GetInstance()->SetEnable(LogTypes::G3D, false);
	}

	CoreTiming::Init();

	// Init all the HLE modules
	HLEInit();

	// TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly

	// Why did we check for CORE_POWERDOWN here?
	if (!LoadFile(filename, error_string)) { // || coreState == CORE_POWERDOWN) {
		pspFileSystem.Shutdown();
		CoreTiming::Shutdown();
		__KernelShutdown();
		HLEShutdown();
		host->ShutdownSound();
		Memory::Shutdown();
		coreParameter.fileToStart = "";
		return false;
	}

	if (coreParam.updateRecent)
		g_Config.AddRecent(filename);

	// Setup JIT here.
	if (coreParameter.startPaused)
		coreState = CORE_STEPPING;
	else
		coreState = CORE_RUNNING;
	return true;
}