all repos — mgba @ b41073bda3c218242ad6bb4b80ab04469a39a933

mGBA Game Boy Advance Emulator

DS Slot-1: Emulate secure area lockout
Vicki Pfau vi@endrift.com
Tue, 21 Mar 2017 23:39:56 -0700
commit

b41073bda3c218242ad6bb4b80ab04469a39a933

parent

1b0d74f3dcb4725562aa47ef667543c00ce3ce56

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M src/ds/slot1.csrc/ds/slot1.c

@@ -132,6 +132,10 @@ ds->memory.slot1.address = ds->memory.slot1.command[1] << 24;

ds->memory.slot1.address |= ds->memory.slot1.command[2] << 16; ds->memory.slot1.address |= ds->memory.slot1.command[3] << 8; ds->memory.slot1.address |= ds->memory.slot1.command[4]; + if (ds->memory.slot1.address < 0x8000) { + mLOG(DS_SLOT1, GAME_ERROR, "Invalid read from secure area: %04X", ds->memory.slot1.address); + ds->memory.slot1.address = 0x8000 + (ds->memory.slot1.address & 0x1FF); + } if (ds->romVf) { ds->romVf->seek(ds->romVf, ds->memory.slot1.address, SEEK_SET); }