mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Shutdown cleanly even when GE debugger is paused.
This commit is contained in:
parent
2a75ad2ebf
commit
4b9056fa02
4 changed files with 30 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include <set>
|
||||
#include "base/NativeApp.h"
|
||||
#include "base/display.h"
|
||||
#include "base/mutex.h"
|
||||
|
@ -42,6 +43,7 @@ static recursive_mutex m_hStepMutex;
|
|||
static event m_hInactiveEvent;
|
||||
static recursive_mutex m_hInactiveMutex;
|
||||
static bool singleStepPending = false;
|
||||
static std::set<Core_ShutdownFunc> shutdownFuncs;
|
||||
|
||||
#ifdef _WIN32
|
||||
InputState input_state;
|
||||
|
@ -49,6 +51,17 @@ InputState input_state;
|
|||
extern InputState input_state;
|
||||
#endif
|
||||
|
||||
void Core_ListenShutdown(Core_ShutdownFunc func)
|
||||
{
|
||||
shutdownFuncs.insert(func);
|
||||
}
|
||||
|
||||
void Core_NotifyShutdown()
|
||||
{
|
||||
for (auto it = shutdownFuncs.begin(); it != shutdownFuncs.end(); ++it)
|
||||
(*it)();
|
||||
}
|
||||
|
||||
void Core_ErrorPause()
|
||||
{
|
||||
Core_UpdateState(CORE_ERROR);
|
||||
|
@ -63,6 +76,7 @@ void Core_Halt(const char *msg)
|
|||
|
||||
void Core_Stop()
|
||||
{
|
||||
Core_NotifyShutdown();
|
||||
Core_UpdateState(CORE_POWERDOWN);
|
||||
m_hStepEvent.notify_one();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@ void Core_EnableStepping(bool step);
|
|||
void Core_DoSingleStep();
|
||||
void Core_UpdateSingleStep();
|
||||
|
||||
typedef void (* Core_ShutdownFunc)();
|
||||
void Core_ListenShutdown(Core_ShutdownFunc func);
|
||||
void Core_NotifyShutdown();
|
||||
void Core_Halt(const char *msg);
|
||||
|
||||
bool Core_IsStepping();
|
||||
|
|
|
@ -286,6 +286,7 @@ bool PSP_IsInited() {
|
|||
}
|
||||
|
||||
void PSP_Shutdown() {
|
||||
Core_NotifyShutdown();
|
||||
if (coreState == CORE_RUNNING)
|
||||
Core_UpdateState(CORE_ERROR);
|
||||
if (cpuThread != NULL) {
|
||||
|
|
|
@ -96,9 +96,17 @@ static void RunPauseAction() {
|
|||
pauseAction = PAUSE_CONTINUE;
|
||||
}
|
||||
|
||||
static void ForceUnpause() {
|
||||
lock_guard guard(pauseLock);
|
||||
lock_guard actionGuard(actionLock);
|
||||
pauseAction = PAUSE_CONTINUE;
|
||||
pauseWait.notify_one();
|
||||
}
|
||||
|
||||
CGEDebugger::CGEDebugger(HINSTANCE _hInstance, HWND _hParent)
|
||||
: Dialog((LPCSTR)IDD_GEDEBUGGER, _hInstance, _hParent), frameWindow(NULL), texWindow(NULL) {
|
||||
breakCmds.resize(256, false);
|
||||
Core_ListenShutdown(ForceUnpause);
|
||||
|
||||
// it's ugly, but .rc coordinates don't match actual pixels and it screws
|
||||
// up both the size and the aspect ratio
|
||||
|
@ -239,6 +247,10 @@ bool WindowsHost::GPUDebuggingActive() {
|
|||
|
||||
static void PauseWithMessage(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL) {
|
||||
lock_guard guard(pauseLock);
|
||||
if (Core_IsInactive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PostMessage(geDebuggerWindow->GetDlgHandle(), msg, wParam, lParam);
|
||||
|
||||
do {
|
||||
|
|
Loading…
Add table
Reference in a new issue