mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 06:10:03 -06:00
fix some pause bugs
This commit is contained in:
@ -255,6 +255,7 @@ EmuThread::EmuThread(QObject* parent) : QThread(parent)
|
|||||||
{
|
{
|
||||||
EmuStatus = 0;
|
EmuStatus = 0;
|
||||||
EmuRunning = 2;
|
EmuRunning = 2;
|
||||||
|
EmuPause = 0;
|
||||||
RunningSomething = false;
|
RunningSomething = false;
|
||||||
|
|
||||||
connect(this, SIGNAL(windowUpdate()), mainWindow->panel, SLOT(update()));
|
connect(this, SIGNAL(windowUpdate()), mainWindow->panel, SLOT(update()));
|
||||||
@ -564,6 +565,7 @@ void EmuThread::changeWindowTitle(char* title)
|
|||||||
void EmuThread::emuRun()
|
void EmuThread::emuRun()
|
||||||
{
|
{
|
||||||
EmuRunning = 1;
|
EmuRunning = 1;
|
||||||
|
EmuPause = 0;
|
||||||
RunningSomething = true;
|
RunningSomething = true;
|
||||||
|
|
||||||
// checkme
|
// checkme
|
||||||
@ -574,6 +576,9 @@ void EmuThread::emuRun()
|
|||||||
|
|
||||||
void EmuThread::emuPause()
|
void EmuThread::emuPause()
|
||||||
{
|
{
|
||||||
|
EmuPause++;
|
||||||
|
if (EmuPause > 1) return;
|
||||||
|
|
||||||
PrevEmuStatus = EmuRunning;
|
PrevEmuStatus = EmuRunning;
|
||||||
EmuRunning = 2;
|
EmuRunning = 2;
|
||||||
while (EmuStatus != 2);
|
while (EmuStatus != 2);
|
||||||
@ -584,6 +589,11 @@ void EmuThread::emuPause()
|
|||||||
|
|
||||||
void EmuThread::emuUnpause()
|
void EmuThread::emuUnpause()
|
||||||
{
|
{
|
||||||
|
if (EmuPause < 1) return;
|
||||||
|
|
||||||
|
EmuPause--;
|
||||||
|
if (EmuPause > 0) return;
|
||||||
|
|
||||||
EmuRunning = PrevEmuStatus;
|
EmuRunning = PrevEmuStatus;
|
||||||
|
|
||||||
if (audioDevice) SDL_PauseAudioDevice(audioDevice, 0);
|
if (audioDevice) SDL_PauseAudioDevice(audioDevice, 0);
|
||||||
@ -593,6 +603,7 @@ void EmuThread::emuUnpause()
|
|||||||
void EmuThread::emuStop()
|
void EmuThread::emuStop()
|
||||||
{
|
{
|
||||||
EmuRunning = 0;
|
EmuRunning = 0;
|
||||||
|
EmuPause = 0;
|
||||||
|
|
||||||
if (audioDevice) SDL_PauseAudioDevice(audioDevice, 1);
|
if (audioDevice) SDL_PauseAudioDevice(audioDevice, 1);
|
||||||
if (micDevice) SDL_PauseAudioDevice(micDevice, 1);
|
if (micDevice) SDL_PauseAudioDevice(micDevice, 1);
|
||||||
|
@ -74,6 +74,7 @@ private:
|
|||||||
volatile int EmuStatus;
|
volatile int EmuStatus;
|
||||||
int PrevEmuStatus;
|
int PrevEmuStatus;
|
||||||
int EmuRunning;
|
int EmuRunning;
|
||||||
|
int EmuPause;
|
||||||
|
|
||||||
QOffscreenSurface* oglSurface;
|
QOffscreenSurface* oglSurface;
|
||||||
QOpenGLContext* oglContext;
|
QOpenGLContext* oglContext;
|
||||||
|
Reference in New Issue
Block a user