From 95d32bc4d2699af2a5c390467306810ed4a0f188 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Sat, 9 Nov 2013 20:49:42 +0000 Subject: [PATCH] core: - don't read from secure area buffer for ROMs with GBA Loader; - fix declare importData function in BackupDevice class; --- desmume/src/NDSSystem.cpp | 5 +++-- desmume/src/addons/slot1comp_rom.cpp | 2 +- desmume/src/mc.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 91f800c17..b84299d4a 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -488,8 +488,9 @@ void GameInfo::closeROM() u32 GameInfo::readROM(u32 pos) { //TODO - this should not be done here! it's a property of the slot-1 device, not the rom! - if ((pos < 0x8000) && (pos >= 0x4000)) - return *(u32*)(secureArea + (pos - 0x4000)); + //required only for FAKE boot + if ((romType == ROM_NDS) && (pos < 0x8000) && (pos >= 0x4000)) + return *(u32*)(secureArea + (pos - 0x4000)); if (!romdata) { diff --git a/desmume/src/addons/slot1comp_rom.cpp b/desmume/src/addons/slot1comp_rom.cpp index 930c6db7d..cac3068fc 100644 --- a/desmume/src/addons/slot1comp_rom.cpp +++ b/desmume/src/addons/slot1comp_rom.cpp @@ -42,7 +42,7 @@ u32 Slot1Comp_Rom::read() { //see B7 for details address &= gameInfo.mask; //sanity check - u32 ret = gameInfo.readROM(address); + u32 ret = *(u32*)(gameInfo.secureArea + (address - 0x4000)); address = (address&~0xFFF) + ((address+4)&0xFFF); return ret; } diff --git a/desmume/src/mc.h b/desmume/src/mc.h index 1f115e8a2..4c02cc3ab 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -122,7 +122,7 @@ public: bool isMovieMode; u32 importDataSize(const char *filename); - u32 importData(const char *filename, u32 force_size); + u32 importData(const char *filename, u32 force_size = 0); bool exportData(const char *filename); private: void detect();