diff options
author | Arisotura <thetotalworm@gmail.com> | 2020-07-31 20:45:30 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2020-07-31 20:45:30 +0200 |
commit | d21cd202908ca17f1224992ed6e4669c2a09a395 (patch) | |
tree | bf48c001513d2ff71ed390f9bb7da4338d37cb90 /src | |
parent | a89741c628b7d2575ebeb26b58d7ee6b5d1025f7 (diff) |
fix some pause bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/frontend/qt_sdl/main.cpp | 11 | ||||
-rw-r--r-- | src/frontend/qt_sdl/main.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 47b3490..4f90ebe 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -255,6 +255,7 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent) { EmuStatus = 0; EmuRunning = 2; + EmuPause = 0; RunningSomething = false; connect(this, SIGNAL(windowUpdate()), mainWindow->panel, SLOT(update())); @@ -564,6 +565,7 @@ void EmuThread::changeWindowTitle(char* title) void EmuThread::emuRun() { EmuRunning = 1; + EmuPause = 0; RunningSomething = true; // checkme @@ -574,6 +576,9 @@ void EmuThread::emuRun() void EmuThread::emuPause() { + EmuPause++; + if (EmuPause > 1) return; + PrevEmuStatus = EmuRunning; EmuRunning = 2; while (EmuStatus != 2); @@ -584,6 +589,11 @@ void EmuThread::emuPause() void EmuThread::emuUnpause() { + if (EmuPause < 1) return; + + EmuPause--; + if (EmuPause > 0) return; + EmuRunning = PrevEmuStatus; if (audioDevice) SDL_PauseAudioDevice(audioDevice, 0); @@ -593,6 +603,7 @@ void EmuThread::emuUnpause() void EmuThread::emuStop() { EmuRunning = 0; + EmuPause = 0; if (audioDevice) SDL_PauseAudioDevice(audioDevice, 1); if (micDevice) SDL_PauseAudioDevice(micDevice, 1); diff --git a/src/frontend/qt_sdl/main.h b/src/frontend/qt_sdl/main.h index eec2a48..7f33973 100644 --- a/src/frontend/qt_sdl/main.h +++ b/src/frontend/qt_sdl/main.h @@ -74,6 +74,7 @@ private: volatile int EmuStatus; int PrevEmuStatus; int EmuRunning; + int EmuPause; QOffscreenSurface* oglSurface; QOpenGLContext* oglContext; |