mirror of https://github.com/mgba-emu/mgba.git
Core: Fix mDirectorySet
This commit is contained in:
parent
a91d19f429
commit
d232a538cc
|
@ -94,13 +94,13 @@ bool mCoreLoadFile(struct mCore* core, const char* path) {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -107,10 +107,10 @@ struct VFile* mDirectorySetOpenPath(struct mDirectorySet* dirs, const char* path
|
|||
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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -310,7 +310,6 @@ void GameController::openGame(bool biosOnly) {
|
|||
|
||||
if (!biosOnly) {
|
||||
mCoreLoadFile(m_threadContext.core, m_fname.toUtf8().constData());
|
||||
mCoreAutoloadSave(m_threadContext.core);
|
||||
}
|
||||
|
||||
m_threadContext.core->setVideoBuffer(m_threadContext.core, m_drawContext, width);
|
||||
|
@ -340,6 +339,10 @@ void GameController::openGame(bool biosOnly) {
|
|||
mCoreLoadForeignConfig(m_threadContext.core, m_config);
|
||||
}
|
||||
|
||||
if (!biosOnly) {
|
||||
mCoreAutoloadSave(m_threadContext.core);
|
||||
}
|
||||
|
||||
if (!mCoreThreadStart(&m_threadContext)) {
|
||||
m_gameOpen = false;
|
||||
emit gameFailed();
|
||||
|
|
Loading…
Reference in New Issue