all repos — mgba @ 5973433aa06cbe46e0262161aaefbc3df9ca1c63

mGBA Game Boy Advance Emulator

GUI: Align autosave counter with frames run, not core frames
Vicki Pfau vi@endrift.com
Sat, 20 Jan 2018 23:20:44 -0800
commit

5973433aa06cbe46e0262161aaefbc3df9ca1c63

parent

50cbf732b51ada4e6ce2a8f425540e701f7721dd

1 files changed, 4 insertions(+), 1 deletions(-)

jump to
M src/feature/gui/gui-runner.csrc/feature/gui/gui-runner.c

@@ -391,6 +391,7 @@ struct timeval tv;

gettimeofday(&tv, 0); runner->lastFpsCheck = 1000000LL * tv.tv_sec + tv.tv_usec; + int frame = 0; while (running) { if (runner->running) { running = runner->running(runner);

@@ -469,9 +470,11 @@ runner->totalDelta += delta;

runner->fps = (CircleBufferSize(&runner->fpsBuffer) * FPS_GRANULARITY * 1000000.0f) / (runner->totalDelta * sizeof(uint32_t)); } } - if (runner->core->frameCounter(runner->core) % AUTOSAVE_GRANULARITY == 0) { + if (frame == AUTOSAVE_GRANULARITY) { + frame = 0; _tryAutosave(runner); } + ++frame; } }