GBA: Make some codes work without master codes
Jeffrey Pfau jeffrey@endrift.com
Tue, 10 Feb 2015 00:25:52 -0800
2 files changed,
16 insertions(+),
2 deletions(-)
M
src/gba/cheats.c
→
src/gba/cheats.c
@@ -635,8 +635,10 @@ if (set) {
GBACheatAddSet(device, set); newSet->gsaVersion = set->gsaVersion; memcpy(newSet->gsaSeeds, set->gsaSeeds, sizeof(newSet->gsaSeeds)); - newSet->hook = set->hook; - ++newSet->hook->refs; + if (set->hook) { + newSet->hook = set->hook; + ++newSet->hook->refs; + } } set = newSet; break;
M
src/gba/gba.c
→
src/gba/gba.c
@@ -715,6 +715,18 @@ if (gba->rr) {
GBARRNextFrame(gba->rr); } + if (gba->cpu->components[GBA_COMPONENT_CHEAT_DEVICE]) { + struct GBACheatDevice* device = (struct GBACheatDevice*) gba->cpu->components[GBA_COMPONENT_CHEAT_DEVICE]; + size_t i; + for (i = 0; i < GBACheatSetsSize(&device->cheats); ++i) { + struct GBACheatSet* cheats = *GBACheatSetsGetPointer(&device->cheats, i); + if (!cheats->hook) { + GBACheatRefresh(device, cheats); + } + } + } + + struct GBAThread* thread = GBAThreadGetContext(); if (!thread) { return;