all repos — mgba @ 5436d2576ffd0dac6254963e4a8d656e445ef078

mGBA Game Boy Advance Emulator

Core: Fix crashes if core directories aren't set
Vicki Pfau vi@endrift.com
Sat, 01 Jun 2019 11:08:28 -0700
commit

5436d2576ffd0dac6254963e4a8d656e445ef078

parent

3cce95b287c589bce3b371a1677c01afd3adf0ef

2 files changed, 10 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -26,6 +26,7 @@ - Qt: Fix some Qt display driver race conditions

- Core: Improved lockstep driver reliability (Le Hoang Quyen) - Switch: Fix threading-related crash on second launch - Qt: Fix FPS target maxing out at 59.727 (fixes mgba.io/i/1421) + - Core: Fix crashes if core directories aren't set Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
M src/core/core.csrc/core/core.c

@@ -157,10 +157,16 @@ return ret;

} bool mCoreAutoloadSave(struct mCore* core) { + if (!core->dirs.save) { + return false; + } return core->loadSave(core, mDirectorySetOpenSuffix(&core->dirs, core->dirs.save, ".sav", O_CREAT | O_RDWR)); } bool mCoreAutoloadPatch(struct mCore* core) { + if (!core->dirs.patch) { + return false; + } return core->loadPatch(core, mDirectorySetOpenSuffix(&core->dirs, core->dirs.patch, ".ups", O_RDONLY)) || core->loadPatch(core, mDirectorySetOpenSuffix(&core->dirs, core->dirs.patch, ".ips", O_RDONLY)) || core->loadPatch(core, mDirectorySetOpenSuffix(&core->dirs, core->dirs.patch, ".bps", O_RDONLY));

@@ -217,6 +223,9 @@ return success;

} struct VFile* mCoreGetState(struct mCore* core, int slot, bool write) { + if (!core->dirs.state) { + return NULL; + } char name[PATH_MAX + 14]; // Quash warning snprintf(name, sizeof(name), "%s.ss%i", core->dirs.baseName, slot); return core->dirs.state->openFile(core->dirs.state, name, write ? (O_CREAT | O_TRUNC | O_RDWR) : O_RDONLY);