From 796364c33737348cabf39da3c6903d5c8e99ce05 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 4 Apr 2010 07:28:00 +0000 Subject: [PATCH] tweak boot from card flag --- desmume/src/MMU.cpp | 4 ---- desmume/src/NDSSystem.cpp | 18 +++++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/desmume/src/MMU.cpp b/desmume/src/MMU.cpp index 3cb567d1a..d2051a19c 100644 --- a/desmume/src/MMU.cpp +++ b/desmume/src/MMU.cpp @@ -985,10 +985,6 @@ void MMU_Reset() MMU_timing.arm9dataFetch.Reset(); MMU_timing.arm9codeCache.Reset(); MMU_timing.arm9dataCache.Reset(); - - // Booted from card -- EXTREMELY IMPORTANT!!! Thanks to cReDiAr - MMU_write8(0,0x027ffc40,0x1); - MMU_write8(1,0x027ffc40,0x1); } void MMU_setRom(u8 * rom, u32 mask) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 9f8ffa6eb..ca3d19851 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -1679,7 +1679,7 @@ bool nds_loadstate(EMUFILE* is, int size) //#define LOG_ARM9 //#define LOG_ARM7 -//bool dolog = true; +//bool dolog = false; FORCEINLINE void arm9log() { @@ -2147,8 +2147,8 @@ void NDS_Reset() armcpu_init(&NDS_ARM7, header->ARM7exe); armcpu_init(&NDS_ARM9, header->ARM9exe); - _MMU_write08(0x04000300, 1); - _MMU_write08(0x04000300, 1); + _MMU_write08(REG_POSTFLG, 1); + _MMU_write08(REG_POSTFLG, 1); } //bitbox 4k demo is so stripped down it relies on default stack values //otherwise the arm7 will crash before making a sound @@ -2176,12 +2176,9 @@ void NDS_Reset() nds.ensataIpcSyncCounter = 0; SetupMMU(nds.debugConsole); - _MMU_write16(0x04000130, 0x3FF); - _MMU_write16(0x04000130, 0x3FF); - _MMU_write08(0x04000136, 0x43); - - //picross polls this value when it boots. firmware sets it. - //_MMU_write16(REG_POWCNT1, 0x20F); + _MMU_write16(REG_KEYINPUT, 0x3FF); + _MMU_write16(REG_KEYINPUT, 0x3FF); + _MMU_write08(REG_EXTKEYIN, 0x43); LidClosed = FALSE; countLid = 0; @@ -2242,6 +2239,9 @@ void NDS_Reset() _MMU_write32(0x27FFE34, firmware->ARM7bootAddr); } + // make system think it's booted from card -- EXTREMELY IMPORTANT!!! Thanks to cReDiAr + _MMU_write08(0x02FFFC40,0x1); + _MMU_write08(0x02FFFC40,0x1); // Save touchscreen calibration info in a structure // so we can easily access it at any time