diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 62f1f14ce..9e1a30c9e 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -405,8 +405,12 @@ void GameInfo::populate() } }*/ - + //this may look like a poor heuristic for detecting homebrew, but it is actually pretty good. + //setting your own game code is stupid, so homebrew should just leave it. + //however, non-devkitARM-default makefiles may not have set this. + isHomebrew = !memcmp(header.gameCode,"####",4); } + #ifdef _WINDOWS static std::vector buffer; @@ -566,30 +570,11 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename) INFO("ROM game code: %c%c%c%c\n\n", gameInfo.header.gameCode[0], gameInfo.header.gameCode[1], gameInfo.header.gameCode[2], gameInfo.header.gameCode[3]); //for homebrew, try auto-patching DLDI. should be benign if there is no DLDI or if it fails - bool isHomebrew = !memcmp(gameInfo.header.gameCode,"####",4); - if(isHomebrew) + if(gameInfo.isHomebrew) DLDI::tryPatch((void*)gameInfo.romdata, gameInfo.romsize); NDS_Reset(); - //put garbage in vram for homebrew games, to help mimic the situation where libnds does not clear out junk - //which the card's launcher may or may not have left behind - if(isHomebrew) - { - u32 w=100000,x=99,y=117,z=19382173; - for(int i=0;i>19))^(t^(t>>8))); - MMU.ARM9_LCD[i] = t; - if (i>19))^(t^(t>>8))); + MMU.MAIN_MEM[i] = t; + if (i