all repos — mgba @ e40cba5c8ba76b00aa87d5e97ac57b12d11c2d16

mGBA Game Boy Advance Emulator

GUI: Move running check into frontend
Vicki Pfau vi@endrift.com
Wed, 10 Jan 2018 00:40:41 -0800
commit

e40cba5c8ba76b00aa87d5e97ac57b12d11c2d16

parent

7097d249af677d955f7f58a56242a2e35253423e

3 files changed, 13 insertions(+), 11 deletions(-)

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

@@ -18,10 +18,6 @@ #include <mgba-util/memory.h>

#include <mgba-util/png-io.h> #include <mgba-util/vfs.h> -#ifdef _3DS -#include <3ds.h> -#endif - #include <sys/time.h> mLOG_DECLARE_CATEGORY(GUI_RUNNER);

@@ -334,13 +330,13 @@ struct timeval tv;

gettimeofday(&tv, 0); runner->lastFpsCheck = 1000000LL * tv.tv_sec + tv.tv_usec; - while (true) { -#ifdef _3DS - running = aptMainLoop(); - if (!running) { - break; + while (running) { + if (runner->running) { + running = runner->running(runner); + if (!running) { + break; + } } -#endif uint32_t guiKeys; uint32_t heldKeys; GUIPollInput(&runner->params, &guiKeys, &heldKeys);
M src/feature/gui/gui-runner.hsrc/feature/gui/gui-runner.h

@@ -70,6 +70,7 @@ void (*unpaused)(struct mGUIRunner*);

void (*incrementScreenMode)(struct mGUIRunner*); void (*setFrameLimiter)(struct mGUIRunner*, bool limit); uint16_t (*pollGameInput)(struct mGUIRunner*); + bool (*running)(struct mGUIRunner*); }; void mGUIInit(struct mGUIRunner*, const char* port);
M src/platform/3ds/main.csrc/platform/3ds/main.c

@@ -678,6 +678,10 @@ frameLimiter = limit;

tickCounter = svcGetSystemTick(); } +static bool _running(struct mGUIRunner* runner) { + return aptMainLoop(); +} + static uint32_t _pollInput(const struct mInputMap* map) { hidScanInput(); int activeKeys = hidKeysHeld();

@@ -1020,7 +1024,8 @@ .paused = _gameUnloaded,

.unpaused = _gameLoaded, .incrementScreenMode = _incrementScreenMode, .setFrameLimiter = _setFrameLimiter, - .pollGameInput = _pollGameInput + .pollGameInput = _pollGameInput, + .running = _running }; mGUIInit(&runner, "3ds");