From 274907e9b21cae65a696d0e591ff461ed484af15 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Sat, 28 Sep 2013 07:42:53 +0000 Subject: [PATCH] core - retail NAND: - fix crash when save address is negative; (fix Made in Ore); --- desmume/src/addons/slot1_retail_nand.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desmume/src/addons/slot1_retail_nand.cpp b/desmume/src/addons/slot1_retail_nand.cpp index d30d1b08f..f8cd93220 100644 --- a/desmume/src/addons/slot1_retail_nand.cpp +++ b/desmume/src/addons/slot1_retail_nand.cpp @@ -64,8 +64,7 @@ public: handle_save = 0; - NDS_header * _header = NDS_getROMHeader(); - subAdr = (_header->unknown5[0xE] | _header->unknown5[0xF]<<8) << 17; + subAdr = T1ReadWord(gameInfo.header.unknown5, 0xE) << 17; mode = 0; } @@ -127,7 +126,11 @@ public: case 0xB2: //Set save position mode = cmd; save_adr = protocol.address & gameInfo.mask; - save_adr -= subAdr; + // to Norrmatt: Made in Ore (UORJ, crc 2E7111B8) crash when save_addr < subAdr + if (save_adr > subAdr) + save_adr -= subAdr; + else + save_adr = 0; handle_save = 1; break; }