all repos — mgba @ 2d6087aa985fc401b1753f4482f07a512828f170

mGBA Game Boy Advance Emulator

mGUI: Improve loading speed (fixes #1957)
Vicki Pfau vi@endrift.com
Sun, 29 Nov 2020 15:56:15 -0800
commit

2d6087aa985fc401b1753f4482f07a512828f170

parent

20f8baa82cb9916ce0e690239cee8efa9eceebf9

3 files changed, 20 insertions(+), 6 deletions(-)

jump to
M CHANGESCHANGES

@@ -97,6 +97,7 @@ - Debugger: Keep track of global cycle count

- FFmpeg: Add looping option for GIF/APNG - mGUI: Show battery percentage - mGUI: Skip second scan loop when possible + - mGUI: Improve loading speed (fixes mgba.io/i/1957) - Qt: Renderer can be changed while a game is running - Qt: Add hex index to palette view - Qt: Add transformation matrix info to sprite view
M src/core/core.csrc/core/core.c

@@ -153,12 +153,23 @@ #else

vfm = VFileMemChunk(NULL, size); #endif - uint8_t buffer[2048]; + size_t chunkSize; +#ifdef FIXED_ROM_BUFFER + uint8_t* buffer = (uint8_t*) romBuffer; + chunkSize = 0x10000; +#else + uint8_t buffer[0x4000]; + chunkSize = sizeof(buffer); +#endif ssize_t read; size_t total = 0; vf->seek(vf, 0, SEEK_SET); - while ((read = vf->read(vf, buffer, sizeof(buffer))) > 0) { + while ((read = vf->read(vf, buffer, chunkSize)) > 0) { +#ifdef FIXED_ROM_BUFFER + buffer += read; +#else vfm->write(vfm, buffer, read); +#endif total += read; if (cb) { cb(total, size, context);
M src/feature/gui/gui-runner.csrc/feature/gui/gui-runner.c

@@ -296,10 +296,6 @@ }

static void _updateLoading(size_t read, size_t size, void* context) { struct mGUIRunner* runner = context; - if (read & 0x3FFFF) { - return; - } - runner->params.drawStart(); if (runner->params.guiPrepare) { runner->params.guiPrepare();

@@ -388,7 +384,13 @@ mCoreInitConfig(runner->core, runner->port);

mInputMapInit(&runner->core->inputMap, &GBAInputInfo); struct VFile* rom = mDirectorySetOpenPath(&runner->core->dirs, path, runner->core->isROM); + if (runner->setFrameLimiter) { + runner->setFrameLimiter(runner, false); + } found = mCorePreloadVFCB(runner->core, rom, _updateLoading, runner); + if (runner->setFrameLimiter) { + runner->setFrameLimiter(runner, true); + } #ifdef FIXED_ROM_BUFFER extern size_t romBufferSize;