all repos — mgba @ d232a538cc74fac4846ef3aa790eced33b61c919

mGBA Game Boy Advance Emulator

Core: Fix mDirectorySet
Jeffrey Pfau jeffrey@endrift.com
Tue, 16 Feb 2016 22:17:21 -0800
commit

d232a538cc74fac4846ef3aa790eced33b61c919

parent

a91d19f42980c71b3305a1f70e5eebfa4283bcf4

4 files changed, 11 insertions(+), 8 deletions(-)

jump to
M src/core/core.csrc/core/core.c

@@ -94,13 +94,13 @@ return ret;

} bool mCoreAutoloadSave(struct mCore* core) { - return core->loadSave(core, mDirectorySetOpenSuffix(&core->dirs, ".sav", O_CREAT | O_RDWR)); + return core->loadSave(core, mDirectorySetOpenSuffix(&core->dirs, core->dirs.save, ".sav", O_CREAT | O_RDWR)); } bool mCoreAutoloadPatch(struct mCore* core) { - return core->loadPatch(core, mDirectorySetOpenSuffix(&core->dirs, ".ups", O_RDONLY)) || - core->loadPatch(core, mDirectorySetOpenSuffix(&core->dirs, ".ips", O_RDONLY)) || - core->loadPatch(core, mDirectorySetOpenSuffix(&core->dirs, ".bps", O_RDONLY)); + 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)); } bool mCoreSaveState(struct mCore* core, int slot, int flags) {
M src/core/directories.csrc/core/directories.c

@@ -107,10 +107,10 @@ }

return file; } -struct VFile* mDirectorySetOpenSuffix(struct mDirectorySet* dirs, const char* suffix, int mode) { +struct VFile* mDirectorySetOpenSuffix(struct mDirectorySet* dirs, struct VDir* dir, const char* suffix, int mode) { char name[PATH_MAX]; snprintf(name, sizeof(name), "%s%s", dirs->baseName, suffix); - return dirs->base->openFile(dirs->base, name, mode); + return dir->openFile(dir, name, mode); } void mDirectorySetMapOptions(struct mDirectorySet* dirs, const struct mCoreOptions* opts) {
M src/core/directories.hsrc/core/directories.h

@@ -28,7 +28,7 @@ void mDirectorySetAttachBase(struct mDirectorySet* dirs, struct VDir* base);

void mDirectorySetDetachBase(struct mDirectorySet* dirs); struct VFile* mDirectorySetOpenPath(struct mDirectorySet* dirs, const char* path, bool (*filter)(struct VFile*)); -struct VFile* mDirectorySetOpenSuffix(struct mDirectorySet* dirs, const char* suffix, int mode); +struct VFile* mDirectorySetOpenSuffix(struct mDirectorySet* dirs, struct VDir* dir, const char* suffix, int mode); struct mCoreOptions; void mDirectorySetMapOptions(struct mDirectorySet* dirs, const struct mCoreOptions* opts);
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -310,7 +310,6 @@ m_frontBuffer = new uint32_t[width * height];

if (!biosOnly) { mCoreLoadFile(m_threadContext.core, m_fname.toUtf8().constData()); - mCoreAutoloadSave(m_threadContext.core); } m_threadContext.core->setVideoBuffer(m_threadContext.core, m_drawContext, width);

@@ -338,6 +337,10 @@ m_threadContext.core->setAVStream(m_threadContext.core, m_stream);

if (m_config) { mCoreLoadForeignConfig(m_threadContext.core, m_config); + } + + if (!biosOnly) { + mCoreAutoloadSave(m_threadContext.core); } if (!mCoreThreadStart(&m_threadContext)) {