mirror of https://github.com/mgba-emu/mgba.git
GB Cheats: Fix Game Genie codes
This commit is contained in:
parent
1c69a714c7
commit
fe3e554b60
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue