GBA Context: Fix reloading directories
Jeffrey Pfau jeffrey@endrift.com
Mon, 18 Jan 2016 20:01:40 -0800
2 files changed,
25 insertions(+),
12 deletions(-)
M
src/gba/context/directories.c
→
src/gba/context/directories.c
@@ -103,30 +103,42 @@ }
void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts) { if (opts->savegamePath) { - if (dirs->save && dirs->save != dirs->base) { - dirs->save->close(dirs->save); + struct VDir* dir = VDirOpen(opts->savegamePath); + if (dir) { + if (dirs->save && dirs->save != dirs->base) { + dirs->save->close(dirs->save); + } + dirs->save = dir; } - dirs->save = VDirOpen(opts->savegamePath); } if (opts->savestatePath) { - if (dirs->state && dirs->state != dirs->base) { - dirs->state->close(dirs->state); + struct VDir* dir = VDirOpen(opts->savestatePath); + if (dir) { + if (dirs->state && dirs->state != dirs->base) { + dirs->state->close(dirs->state); + } + dirs->state = dir; } - dirs->state = VDirOpen(opts->savestatePath); } if (opts->screenshotPath) { - if (dirs->screenshot && dirs->screenshot != dirs->base) { - dirs->screenshot->close(dirs->screenshot); + struct VDir* dir = VDirOpen(opts->screenshotPath); + if (dir) { + if (dirs->screenshot && dirs->screenshot != dirs->base) { + dirs->screenshot->close(dirs->screenshot); + } + dirs->screenshot = dir; } - dirs->screenshot = VDirOpen(opts->screenshotPath); } if (opts->patchPath) { - if (dirs->patch && dirs->patch != dirs->base) { - dirs->patch->close(dirs->patch); + struct VDir* dir = VDirOpen(opts->patchPath); + if (dir) { + if (dirs->patch && dirs->patch != dirs->base) { + dirs->patch->close(dirs->patch); + } + dirs->patch = dir; } - dirs->patch = VDirOpen(opts->patchPath); } }
M
src/platform/qt/GameController.cpp
→
src/platform/qt/GameController.cpp
@@ -75,6 +75,7 @@ m_threadContext.userData = this;
m_threadContext.rewindBufferCapacity = 0; m_threadContext.cheats = &m_cheatDevice; m_threadContext.logLevel = GBA_LOG_ALL; + GBADirectorySetInit(&m_threadContext.dirs); m_lux.p = this; m_lux.sample = [](GBALuminanceSource* context) {