mirror of https://github.com/mgba-emu/mgba.git
GBA Context: Fix reloading directories
This commit is contained in:
parent
17d343656f
commit
44d1dd7f84
|
@ -103,30 +103,42 @@ struct VFile* GBADirectorySetOpenPath(struct GBADirectorySet* dirs, const char*
|
||||||
|
|
||||||
void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts) {
|
void GBADirectorySetMapOptions(struct GBADirectorySet* dirs, const struct GBAOptions* opts) {
|
||||||
if (opts->savegamePath) {
|
if (opts->savegamePath) {
|
||||||
if (dirs->save && dirs->save != dirs->base) {
|
struct VDir* dir = VDirOpen(opts->savegamePath);
|
||||||
dirs->save->close(dirs->save);
|
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 (opts->savestatePath) {
|
||||||
if (dirs->state && dirs->state != dirs->base) {
|
struct VDir* dir = VDirOpen(opts->savestatePath);
|
||||||
dirs->state->close(dirs->state);
|
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 (opts->screenshotPath) {
|
||||||
if (dirs->screenshot && dirs->screenshot != dirs->base) {
|
struct VDir* dir = VDirOpen(opts->screenshotPath);
|
||||||
dirs->screenshot->close(dirs->screenshot);
|
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 (opts->patchPath) {
|
||||||
if (dirs->patch && dirs->patch != dirs->base) {
|
struct VDir* dir = VDirOpen(opts->patchPath);
|
||||||
dirs->patch->close(dirs->patch);
|
if (dir) {
|
||||||
|
if (dirs->patch && dirs->patch != dirs->base) {
|
||||||
|
dirs->patch->close(dirs->patch);
|
||||||
|
}
|
||||||
|
dirs->patch = dir;
|
||||||
}
|
}
|
||||||
dirs->patch = VDirOpen(opts->patchPath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ GameController::GameController(QObject* parent)
|
||||||
m_threadContext.rewindBufferCapacity = 0;
|
m_threadContext.rewindBufferCapacity = 0;
|
||||||
m_threadContext.cheats = &m_cheatDevice;
|
m_threadContext.cheats = &m_cheatDevice;
|
||||||
m_threadContext.logLevel = GBA_LOG_ALL;
|
m_threadContext.logLevel = GBA_LOG_ALL;
|
||||||
|
GBADirectorySetInit(&m_threadContext.dirs);
|
||||||
|
|
||||||
m_lux.p = this;
|
m_lux.p = this;
|
||||||
m_lux.sample = [](GBALuminanceSource* context) {
|
m_lux.sample = [](GBALuminanceSource* context) {
|
||||||
|
|
Loading…
Reference in New Issue