mirror of https://github.com/mgba-emu/mgba.git
SDL: Fix cheats not loading
This commit is contained in:
parent
5d0ab48457
commit
2d49a41a30
1
CHANGES
1
CHANGES
|
@ -77,6 +77,7 @@ Bugfixes:
|
|||
- SDL: Fix game crash check
|
||||
- SDL: Fix race condition with audio thread when starting
|
||||
- SDL: Fix showing version number
|
||||
- SDL: Fix cheats not loading
|
||||
- Test: Fix crash when loading invalid file
|
||||
- Test: Fix crash when fuzzing fails to load a file
|
||||
- Test: Don't rely on core for frames elapsed
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <mgba/core/cheats.h>
|
||||
#include <mgba/core/core.h>
|
||||
#include <mgba/core/config.h>
|
||||
#include <mgba/core/input.h>
|
||||
|
@ -104,6 +105,16 @@ int main(int argc, char** argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
struct mCheatDevice* device = NULL;
|
||||
if (args.cheatsFile && (device = renderer.core->cheatDevice(renderer.core))) {
|
||||
struct VFile* vf = VFileOpen(args.cheatsFile, O_RDONLY);
|
||||
if (vf) {
|
||||
mCheatDeviceClear(device);
|
||||
mCheatParseFile(device, vf);
|
||||
vf->close(vf);
|
||||
}
|
||||
}
|
||||
|
||||
mInputMapInit(&renderer.core->inputMap, &GBAInputInfo);
|
||||
mCoreInitConfig(renderer.core, PORT);
|
||||
applyArguments(&args, &subparser, &renderer.core->config);
|
||||
|
@ -148,6 +159,10 @@ int main(int argc, char** argv) {
|
|||
mSDLDetachPlayer(&renderer.events, &renderer.player);
|
||||
mInputMapDeinit(&renderer.core->inputMap);
|
||||
|
||||
if (device) {
|
||||
mCheatDeviceDestroy(device);
|
||||
}
|
||||
|
||||
mSDLDeinit(&renderer);
|
||||
|
||||
freeArguments(&args);
|
||||
|
|
Loading…
Reference in New Issue