From eb7f12b574e140f809dc9570f948f298fb5571bb Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 19 Sep 2018 19:20:15 -0700 Subject: [PATCH] mGUI: Add fast forward toggle --- CHANGES | 1 + src/feature/gui/gui-runner.c | 9 +++++++-- src/feature/gui/gui-runner.h | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index df61c3760..08180740d 100644 --- a/CHANGES +++ b/CHANGES @@ -91,6 +91,7 @@ Misc: - Qt: Clean up FPS target UI (fixes mgba.io/i/436) - Core: Remove broken option for whether rewinding restores save games - FFmpeg: Support lossless VP9 encoding + - mGUI: Add fast forward toggle 0.6.3: (2017-04-14) Bugfixes: diff --git a/src/feature/gui/gui-runner.c b/src/feature/gui/gui-runner.c index 3877aef54..3dc0965a6 100644 --- a/src/feature/gui/gui-runner.c +++ b/src/feature/gui/gui-runner.c @@ -54,7 +54,8 @@ static const struct mInputPlatformInfo _mGUIKeyInfo = { [mGUI_INPUT_DECREASE_BRIGHTNESS] = "Decrease solar brightness", [mGUI_INPUT_SCREEN_MODE] = "Screen mode", [mGUI_INPUT_SCREENSHOT] = "Take screenshot", - [mGUI_INPUT_FAST_FORWARD] = "Fast forward", + [mGUI_INPUT_FAST_FORWARD_HELD] = "Fast forward (held)", + [mGUI_INPUT_FAST_FORWARD_TOGGLE] = "Fast forward (toggle)", }, .nKeys = GUI_INPUT_MAX }; @@ -412,6 +413,7 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) { runner->lastFpsCheck = 1000000LL * tv.tv_sec + tv.tv_usec; int frame = 0; + bool fastForward = false; while (running) { if (runner->running) { running = runner->running(runner); @@ -442,7 +444,10 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) { mCoreTakeScreenshot(runner->core); } if (runner->setFrameLimiter) { - if (heldKeys & (1 << mGUI_INPUT_FAST_FORWARD)) { + if (guiKeys & (1 << mGUI_INPUT_FAST_FORWARD_TOGGLE)) { + fastForward = !fastForward; + } + if (fastForward || (heldKeys & (1 << mGUI_INPUT_FAST_FORWARD_HELD))) { runner->setFrameLimiter(runner, false); } else { runner->setFrameLimiter(runner, true); diff --git a/src/feature/gui/gui-runner.h b/src/feature/gui/gui-runner.h index 6c91d1347..fda78f982 100644 --- a/src/feature/gui/gui-runner.h +++ b/src/feature/gui/gui-runner.h @@ -22,7 +22,8 @@ enum mGUIInput { mGUI_INPUT_DECREASE_BRIGHTNESS, mGUI_INPUT_SCREEN_MODE, mGUI_INPUT_SCREENSHOT, - mGUI_INPUT_FAST_FORWARD, + mGUI_INPUT_FAST_FORWARD_HELD, + mGUI_INPUT_FAST_FORWARD_TOGGLE }; struct mGUIBackground {