diff --git a/src/core/cheats.c b/src/core/cheats.c index 1ffe91adf..2fc97c3ac 100644 --- a/src/core/cheats.c +++ b/src/core/cheats.c @@ -627,6 +627,9 @@ void mCheatAutosave(struct mCheatDevice* device) { if (!device->autosave) { return; } + if (!device->p->dirs.cheats) { + return; + } struct VFile* vf = mDirectorySetOpenSuffix(&device->p->dirs, device->p->dirs.cheats, ".cheats", O_WRONLY | O_CREAT | O_TRUNC); if (!vf) { return; diff --git a/src/core/core.c b/src/core/core.c index 20f9fdefc..789656ea4 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -245,14 +245,16 @@ bool mCoreAutoloadPatch(struct mCore* core) { } bool mCoreAutoloadCheats(struct mCore* core) { - bool success = true; + bool success = !!core->dirs.cheats; int cheatAuto; - if (!mCoreConfigGetIntValue(&core->config, "cheatAutoload", &cheatAuto) || cheatAuto) { + if (success && (!mCoreConfigGetIntValue(&core->config, "cheatAutoload", &cheatAuto) || cheatAuto)) { struct VFile* vf = mDirectorySetOpenSuffix(&core->dirs, core->dirs.cheats, ".cheats", O_RDONLY); if (vf) { struct mCheatDevice* device = core->cheatDevice(core); success = mCheatParseFile(device, vf); vf->close(vf); + } else { + success = false; } } if (!mCoreConfigGetIntValue(&core->config, "cheatAutosave", &cheatAuto) || cheatAuto) {