all repos — mgba @ 7bd29d6e44c60a7812c499879e160d3a95e53f25

mGBA Game Boy Advance Emulator

Qt: Fix autofire
Vicki Pfau vi@endrift.com
Thu, 03 Aug 2017 22:20:43 -0700
commit

7bd29d6e44c60a7812c499879e160d3a95e53f25

parent

17fa98fe4e90de445af406e962d1b49ce8865265

2 files changed, 9 insertions(+), 6 deletions(-)

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

@@ -209,12 +209,13 @@ }

void CoreController::loadConfig(ConfigController* config) { Interrupter interrupter(this); - m_loadStateFlags = config->getOption("loadStateExtdata").toInt(); - m_saveStateFlags = config->getOption("saveStateExtdata").toInt(); - m_fastForwardRatio = config->getOption("fastForwardRatio").toFloat(); - m_videoSync = config->getOption("videoSync").toInt(); - m_audioSync = config->getOption("audioSync").toInt(); + m_loadStateFlags = config->getOption("loadStateExtdata", m_loadStateFlags).toInt(); + m_saveStateFlags = config->getOption("saveStateExtdata", m_saveStateFlags).toInt(); + m_fastForwardRatio = config->getOption("fastForwardRatio", m_fastForwardRatio).toFloat(); + m_videoSync = config->getOption("videoSync", m_videoSync).toInt(); + m_audioSync = config->getOption("audioSync", m_audioSync).toInt(); m_fpsTarget = config->getOption("fpsTarget").toFloat(); + m_autofireThreshold = config->getOption("autofireThreshold", m_autofireThreshold).toInt(); updateFastForward(); mCoreLoadForeignConfig(m_threadContext.core, config->config()); mCoreThreadRewindParamsChanged(&m_threadContext);

@@ -706,8 +707,9 @@ if (!m_autofire[k]) {

continue; } ++m_autofireStatus[k]; - if (m_autofireStatus[k]) { + if (m_autofireStatus[k] >= 2 * m_autofireThreshold) { m_autofireStatus[k] = 0; + } else if (m_autofireStatus[k] >= m_autofireThreshold) { active |= 1 << k; } }
M src/platform/qt/CoreController.hsrc/platform/qt/CoreController.h

@@ -184,6 +184,7 @@

int m_activeKeys = 0; bool m_autofire[32] = {}; int m_autofireStatus[32] = {}; + int m_autofireThreshold = 1; VFileDevice m_backupLoadState; QByteArray m_backupSaveState{nullptr};