示例#1
0
文件: System.cpp 项目: dutea/ppsspp
void PSP_Shutdown() {
	// Do nothing if we never inited.
	if (!pspIsInited && !pspIsIniting) {
		return;
	}

#ifndef MOBILE_DEVICE
	if (g_Config.bFuncHashMap) {
		MIPSAnalyst::StoreHashMap();
	}
#endif

	if (coreState == CORE_RUNNING)
		Core_UpdateState(CORE_ERROR);
	Core_NotifyShutdown();
	if (cpuThread != NULL) {
		CPU_NextStateNot(CPU_THREAD_NOT_RUNNING, CPU_THREAD_SHUTDOWN);
		CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown);
		delete cpuThread;
		cpuThread = 0;
	} else {
		CPU_Shutdown();
	}
	GPU_Shutdown();
	host->SetWindowTitle(0);
	currentMIPS = 0;
	pspIsInited = false;
	pspIsIniting = false;
}
示例#2
0
文件: System.cpp 项目: Alceris/ppsspp
void PSP_Shutdown() {
	// Do nothing if we never inited.
	if (!pspIsInited && !pspIsIniting && !pspIsQuiting) {
		return;
	}

#ifndef MOBILE_DEVICE
	if (g_Config.bFuncHashMap) {
		MIPSAnalyst::StoreHashMap();
	}
#endif

	// Make sure things know right away that PSP memory, etc. is going away.
	pspIsQuiting = true;
	if (coreState == CORE_RUNNING)
		Core_UpdateState(CORE_ERROR);
	Core_NotifyShutdown();
	if (cpuThread != nullptr) {
		CPU_NextStateNot(CPU_THREAD_NOT_RUNNING, CPU_THREAD_SHUTDOWN);
		CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown);
		delete cpuThread;
		cpuThread = 0;
		cpuThreadID = std::thread::id();
	} else {
		CPU_Shutdown();
	}
	GPU_Shutdown();
	g_paramSFO.Clear();
	host->SetWindowTitle(0);
	currentMIPS = 0;
	pspIsInited = false;
	pspIsIniting = false;
	pspIsQuiting = false;
	g_Config.unloadGameConfig();
}
示例#3
0
void PSP_Shutdown() {
	if (coreState == CORE_RUNNING)
		Core_UpdateState(CORE_ERROR);
	if (cpuThread != NULL) {
		CPU_SetState(CPU_THREAD_SHUTDOWN);
		CPU_WaitStatus(&CPU_IsShutdown);
		delete cpuThread;
		cpuThread = 0;
	} else {
		CPU_Shutdown();
	}
	GPU_Shutdown();
	host->SetWindowTitle(0);
}
示例#4
0
文件: Core.cpp 项目: A671DR218/ppsspp
void Core_EnableStepping(bool step) {
	if (step) {
		sleep_ms(1);
#if defined(_DEBUG)
		host->SetDebugMode(true);
#endif
		m_hStepEvent.reset();
		Core_UpdateState(CORE_STEPPING);
	} else {
#if defined(_DEBUG)
		host->SetDebugMode(false);
#endif
		coreState = CORE_RUNNING;
		coreStatePending = false;
		m_hStepEvent.notify_one();
	}
}
示例#5
0
文件: System.cpp 项目: 716Girl/ppsspp
void PSP_Shutdown() {
#ifndef USING_GLES2
	if (g_Config.bFuncHashMap) {
		MIPSAnalyst::StoreHashMap();
	}
#endif

	if (coreState == CORE_RUNNING)
		Core_UpdateState(CORE_ERROR);
	Core_NotifyShutdown();
	if (cpuThread != NULL) {
		CPU_NextStateNot(CPU_THREAD_NOT_RUNNING, CPU_THREAD_SHUTDOWN);
		CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsShutdown);
		delete cpuThread;
		cpuThread = 0;
	} else {
		CPU_Shutdown();
	}
	GPU_Shutdown();
	host->SetWindowTitle(0);
	currentMIPS = 0;
	pspIsInited = false;
}
示例#6
0
文件: Core.cpp 项目: A671DR218/ppsspp
void Core_Stop() {
	Core_UpdateState(CORE_POWERDOWN);
	Core_NotifyShutdown();
	m_hStepEvent.notify_one();
}
示例#7
0
文件: Core.cpp 项目: A671DR218/ppsspp
void Core_ErrorPause() {
	Core_UpdateState(CORE_ERROR);
}
示例#8
0
unsigned int WINAPI TheThread(void *)
{
    _InterlockedExchange(&emuThreadReady, THREAD_INIT);

    setCurrentThreadName("EmuThread");

    std::string memstick, flash0;
    GetSysDirectories(memstick, flash0);

    // Native overwrites host. Can't allow that.

    Host *oldHost = host;
    UpdateScreenScale();

    NativeInit(__argc, (const char **)__argv, memstick.c_str(), memstick.c_str(), "1234");
    Host *nativeHost = host;
    host = oldHost;

    host->UpdateUI();

    std::string error_string;
    if (!host->InitGL(&error_string)) {
        Reporting::ReportMessage("OpenGL init error: %s", error_string.c_str());
        std::string full_error = StringFromFormat( "Failed initializing OpenGL. Try upgrading your graphics drivers.\n\nError message:\n\n%s", error_string.c_str());
        MessageBoxA(0, full_error.c_str(), "OpenGL Error", MB_OK | MB_ICONERROR);
        ERROR_LOG(BOOT, full_error.c_str());
        goto shutdown;
    }

    NativeInitGraphics();

    INFO_LOG(BOOT, "Done.");
    _dbg_update_();

    if (coreState == CORE_POWERDOWN) {
        INFO_LOG(BOOT, "Exit before core loop.");
        goto shutdown;
    }

    _InterlockedExchange(&emuThreadReady, THREAD_CORE_LOOP);

    if (g_Config.bBrowse)
    {
        PostMessage(MainWindow::GetHWND(), WM_COMMAND, ID_FILE_LOAD, 0);
        //MainWindow::BrowseAndBoot("");
    }

    Core_EnableStepping(FALSE);

    while (globalUIState != UISTATE_EXIT)
    {
        Core_Run();

        // We're here again, so the game quit.  Restart Core_Run() which controls the UI.
        // This way they can load a new game.
        Core_UpdateState(CORE_RUNNING);
    }

shutdown:
    _InterlockedExchange(&emuThreadReady, THREAD_SHUTDOWN);

    NativeShutdownGraphics();
    host = nativeHost;
    NativeShutdown();
    host = oldHost;
    host->ShutdownGL();

    _InterlockedExchange(&emuThreadReady, THREAD_END);

    //The CPU should return when a game is stopped and cleanup should be done here,
    //so we can restart the plugins (or load new ones) for the next game
    return 0;
}