From 41230881b2c1b9996f0eda3e88ddaf0459a66603 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Wed, 14 Apr 2021 22:57:10 +0200 Subject: [PATCH] fix mishap. also likely more accurate behavior for DSi secure area shito. --- src/NDSCart.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/NDSCart.cpp b/src/NDSCart.cpp index 7a28d7da..cdfaa64b 100644 --- a/src/NDSCart.cpp +++ b/src/NDSCart.cpp @@ -734,11 +734,12 @@ int CartCommon::ROMCommandStart(u8* cmd, u8* data, u32 len) u32 addr = (cmddec[2] & 0xF0) << 8; if (CmdEncMode == 11) { - // TODO: should use entries 0x90/0x92 to determine where the DSi region starts?? - // DSi secure area starts with 0x3000 unreadable bytes - u32 arm9i_base = *(u32*)&CartROM[0x1C0]; - addr -= 0x4000; - addr += arm9i_base; + // the DSi region starts with 0x3000 unreadable bytes + // similarly to how the DS region starts at 0x1000 with 0x3000 unreadable bytes + // these contain data for KEY1 crypto + u32 dsiregion = *(u16*)&ROM[0x92] << 19; + addr -= 0x1000; + addr += dsiregion; } ReadROM(addr, 0x1000, data, 0); }