GB Cheats: Fix Game Genie codes
Vicki Pfau vi@endrift.com
Fri, 01 Jan 2021 17:26:42 -0800
1 files changed,
6 insertions(+),
3 deletions(-)
jump to
M
src/core/cheats.c
→
src/core/cheats.c
@@ -107,14 +107,17 @@ for (i = 0; i < mCheatPatchListSize(&cheats->romPatches); ++i) {
struct mCheatPatch* patch = mCheatPatchListGetPointer(&cheats->romPatches, i); int segment = -1; if (patch->check && patch->segment < 0) { - int maxSegment = 0; - for (segment = 0; segment < maxSegment; ++segment) { + const struct mCoreMemoryBlock* block = mCoreGetMemoryBlockInfo(device->p, patch->address); + if (!block) { + continue; + } + for (segment = 0; segment < block->maxSegment; ++segment) { uint32_t value = _readMemSegment(device->p, patch->address, segment, patch->width); if (value == patch->checkValue) { break; } } - if (segment == maxSegment) { + if (segment == block->maxSegment) { continue; } }