mirror of https://github.com/mgba-emu/mgba.git
SDL: Add back patch loading
This commit is contained in:
parent
a718a08e47
commit
1768721e7e
|
@ -12,6 +12,7 @@
|
||||||
#include "gba/renderers/video-software.h"
|
#include "gba/renderers/video-software.h"
|
||||||
#include "gba/serialize.h"
|
#include "gba/serialize.h"
|
||||||
#include "util/memory.h"
|
#include "util/memory.h"
|
||||||
|
#include "util/patch.h"
|
||||||
#include "util/vfs.h"
|
#include "util/vfs.h"
|
||||||
|
|
||||||
struct GBACore {
|
struct GBACore {
|
||||||
|
@ -123,12 +124,16 @@ static bool _GBACoreLoadSave(struct mCore* core, struct VFile* vf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _GBACoreLoadPatch(struct mCore* core, struct VFile* vf) {
|
static bool _GBACoreLoadPatch(struct mCore* core, struct VFile* vf) {
|
||||||
// TODO
|
if (!vf) {
|
||||||
UNUSED(core);
|
|
||||||
UNUSED(vf);
|
|
||||||
mLOG(GBA, STUB, "Patches are not yet supported");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
struct Patch patch;
|
||||||
|
if (!loadPatch(vf, &patch)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
GBAApplyPatch(core->board, &patch);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void _GBACoreUnloadROM(struct mCore* core) {
|
static void _GBACoreUnloadROM(struct mCore* core) {
|
||||||
return GBAUnloadROM(core->board);
|
return GBAUnloadROM(core->board);
|
||||||
|
|
|
@ -210,6 +210,15 @@ int mSDLRun(struct mSDLRenderer* renderer, struct mArguments* args) {
|
||||||
mCoreAutoloadSave(renderer->core);
|
mCoreAutoloadSave(renderer->core);
|
||||||
// TODO: Create debugger
|
// TODO: Create debugger
|
||||||
|
|
||||||
|
if (args->patch) {
|
||||||
|
struct VFile* patch = VFileOpen(args->patch, O_RDONLY);
|
||||||
|
if (patch) {
|
||||||
|
renderer->core->loadPatch(renderer->core, patch);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mCoreAutoloadPatch(renderer->core);
|
||||||
|
}
|
||||||
|
|
||||||
renderer->audio.samples = renderer->core->opts.audioBuffers;
|
renderer->audio.samples = renderer->core->opts.audioBuffers;
|
||||||
renderer->audio.sampleRate = 44100;
|
renderer->audio.sampleRate = 44100;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue