mGUI: Autosave less frequently when fast-forwarding

This commit is contained in:
Vicki Pfau 2022-02-27 21:17:56 -08:00
parent c284506c1b
commit 467c620abc
2 changed files with 6 additions and 6 deletions

View File

@ -53,6 +53,7 @@ Misc:
- GBA DMA: Enhanced logging (closes mgba.io/i/2454) - GBA DMA: Enhanced logging (closes mgba.io/i/2454)
- GBA Video: Implement layer placement for OpenGL renderer (fixes mgba.io/i/1962) - GBA Video: Implement layer placement for OpenGL renderer (fixes mgba.io/i/1962)
- mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871) - mGUI: Add margin to right-aligned menu text (fixes mgba.io/i/871)
- mGUI: Autosave less frequently when fast-forwarding
- Qt: Rearrange menus some - Qt: Rearrange menus some
- Qt: Clean up cheats dialog - Qt: Clean up cheats dialog
- Qt: Only set default controller bindings if loading fails (fixes mgba.io/i/799) - Qt: Only set default controller bindings if loading fails (fixes mgba.io/i/799)

View File

@ -536,11 +536,11 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
mCoreConfigSetUIntValue(&runner->config, "mute", mute); mCoreConfigSetUIntValue(&runner->config, "mute", mute);
runner->core->reloadConfigOption(runner->core, "mute", &runner->config); runner->core->reloadConfigOption(runner->core, "mute", &runner->config);
} }
if (guiKeys & (1 << mGUI_INPUT_FAST_FORWARD_TOGGLE)) {
fastForward = !fastForward;
}
bool fastForwarding = fastForward || (heldKeys & (1 << mGUI_INPUT_FAST_FORWARD_HELD));
if (runner->setFrameLimiter) { if (runner->setFrameLimiter) {
if (guiKeys & (1 << mGUI_INPUT_FAST_FORWARD_TOGGLE)) {
fastForward = !fastForward;
}
bool fastForwarding = fastForward || (heldKeys & (1 << mGUI_INPUT_FAST_FORWARD_HELD));
if (fastForwarding) { if (fastForwarding) {
if (fastForwardMute && !mute && !muteTogglePressed) { if (fastForwardMute && !mute && !muteTogglePressed) {
mCoreConfigSetUIntValue(&runner->core->config, "mute", fastForwardMute); mCoreConfigSetUIntValue(&runner->core->config, "mute", fastForwardMute);
@ -615,8 +615,7 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
runner->fps = (CircleBufferSize(&runner->fpsBuffer) * FPS_GRANULARITY * 1000000.0f) / (runner->totalDelta * sizeof(uint32_t)); runner->fps = (CircleBufferSize(&runner->fpsBuffer) * FPS_GRANULARITY * 1000000.0f) / (runner->totalDelta * sizeof(uint32_t));
} }
} }
if (frame == AUTOSAVE_GRANULARITY) { if (frame % (AUTOSAVE_GRANULARITY * (fastForwarding ? 2 : 1)) == 0) {
frame = 0;
_tryAutosave(runner); _tryAutosave(runner);
} }
if (frame == FPS_GRANULARITY * AUTOSAVE_GRANULARITY) { if (frame == FPS_GRANULARITY * AUTOSAVE_GRANULARITY) {