GB Cheats: Fix Game Genie codes

This commit is contained in:
Vicki Pfau 2021-01-01 17:26:42 -08:00
parent 1c69a714c7
commit fe3e554b60
1 changed files with 6 additions and 3 deletions

View File

@ -107,14 +107,17 @@ static void _patchROM(struct mCheatDevice* device, struct mCheatSet* cheats) {
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;
}
}