diff options
author | StapleButter <thetotalworm@gmail.com> | 2017-10-01 03:19:39 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2017-10-01 03:19:39 +0200 |
commit | 1975efaeea0cc43926dc0c9ddf6e127b2914865d (patch) | |
tree | c7b8cc91d2fcf9f19873f670c41b7641897f70e3 /src | |
parent | 9ad89d8cb5f3e1914bb008bd1a63733920c09e9b (diff) |
fix bugs with SPI shutdown
Diffstat (limited to 'src')
-rw-r--r-- | src/NDS.cpp | 1 | ||||
-rw-r--r-- | src/libui_sdl/Platform.cpp | 4 | ||||
-rw-r--r-- | src/libui_sdl/main.cpp | 7 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/NDS.cpp b/src/NDS.cpp index 3ebaf44..cd762d7 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -346,6 +346,7 @@ void Reset() void Stop() { printf("Stopping: shutdown\n"); + Running = false; Platform::StopEmu(); GPU::Stop(); SPU::Stop(); diff --git a/src/libui_sdl/Platform.cpp b/src/libui_sdl/Platform.cpp index cebc74d..0b1e0a2 100644 --- a/src/libui_sdl/Platform.cpp +++ b/src/libui_sdl/Platform.cpp @@ -44,7 +44,7 @@ #endif -void Stop(); +void Stop(bool internal); namespace Platform @@ -75,7 +75,7 @@ u8 PacketBuffer[2048]; void StopEmu() { - Stop(); + Stop(true); } diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index f27c7ed..241d9b7 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -320,10 +320,11 @@ void Run() uiMenuItemSetChecked(MenuItem_Pause, 0); } -void Stop() +void Stop(bool internal) { EmuRunning = 2; - while (EmuStatus != 2); + if (!internal) // if shutting down from the UI thread, wait till the emu thread has stopped + while (EmuStatus != 2); RunningSomething = false; uiMenuItemDisable(MenuItem_Pause); @@ -449,7 +450,7 @@ void OnStop(uiMenuItem* item, uiWindow* window, void* blarg) { if (!RunningSomething) return; - Stop(); + Stop(false); } void OnOpenEmuSettings(uiMenuItem* item, uiWindow* window, void* blarg) |