all repos — mgba @ 7d36331dc4a613a54a801fb37bccf7d67ed64063

mGBA Game Boy Advance Emulator

GBA: Make some codes work without master codes
Jeffrey Pfau jeffrey@endrift.com
Tue, 10 Feb 2015 00:25:52 -0800
commit

7d36331dc4a613a54a801fb37bccf7d67ed64063

parent

5015975e4c3907fd7f2be18fada16b6d319d63d8

2 files changed, 16 insertions(+), 2 deletions(-)

jump to
M src/gba/cheats.csrc/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.csrc/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;