all repos — mgba @ dcbfba03c37b7be1b6db543ec4599447c70d3a90

mGBA Game Boy Advance Emulator

Fix locking up when triggering turbo with no game loaded
Jeffrey Pfau jeffrey@endrift.com
Fri, 24 Oct 2014 21:45:37 -0700
commit

dcbfba03c37b7be1b6db543ec4599447c70d3a90

parent

02116415d18be3b9d9924730fcc16de195ba996f

1 files changed, 15 insertions(+), 8 deletions(-)

jump to
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -137,8 +137,13 @@ m_gameOpen = true;

m_pauseAfterFrame = false; - m_threadContext.sync.videoFrameWait = m_videoSync; - m_threadContext.sync.audioWait = m_audioSync; + if (m_turbo) { + m_threadContext.sync.videoFrameWait = false; + m_threadContext.sync.audioWait = false; + } else { + m_threadContext.sync.videoFrameWait = m_videoSync; + m_threadContext.sync.audioWait = m_audioSync; + } m_threadContext.fname = strdup(m_fname.toLocal8Bit().constData()); if (m_dirmode) {

@@ -268,7 +273,7 @@ }

void GameController::setVideoSync(bool set) { m_videoSync = set; - if (!m_turbo) { + if (!m_turbo && m_gameOpen) { GBAThreadInterrupt(&m_threadContext); m_threadContext.sync.videoFrameWait = set; GBAThreadContinue(&m_threadContext);

@@ -277,7 +282,7 @@ }

void GameController::setAudioSync(bool set) { m_audioSync = set; - if (!m_turbo) { + if (!m_turbo && m_gameOpen) { GBAThreadInterrupt(&m_threadContext); m_threadContext.sync.audioWait = set; GBAThreadContinue(&m_threadContext);

@@ -294,10 +299,12 @@ m_turboForced = forced;

} else { m_turboForced = false; } - GBAThreadInterrupt(&m_threadContext); - m_threadContext.sync.audioWait = set ? false : m_audioSync; - m_threadContext.sync.videoFrameWait = set ? false : m_videoSync; - GBAThreadContinue(&m_threadContext); + if (m_gameOpen) { + GBAThreadInterrupt(&m_threadContext); + m_threadContext.sync.audioWait = set ? false : m_audioSync; + m_threadContext.sync.videoFrameWait = set ? false : m_videoSync; + GBAThreadContinue(&m_threadContext); + } } void GameController::updateKeys() {