From 2a91ec3c9ccd7a23c56e135e46abba2369102252 Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 3 Sep 2010 11:13:27 +0000 Subject: [PATCH] fix autodldi in linux and fix attempt to load savestate -1 in linux-cli --- desmume/src/NDSSystem.cpp | 6 ++++++ desmume/src/cli/main.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 00df55b13..76f4a2087 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -508,6 +508,7 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename) INFO("\nROM crc: %08X\n", gameInfo.crc); INFO("ROM serial: %s\n", gameInfo.ROMserial); INFO("ROM internal name: %s\n\n", gameInfo.ROMname); + 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 if(!memcmp(gameInfo.header.gameCode,"####",4)) @@ -624,6 +625,11 @@ int NDS_LoadROM(const char *filename, const char *logicalFilename) INFO("\nROM crc: %08X\n", gameInfo.crc); INFO("ROM serial: %s\n", gameInfo.ROMserial); INFO("ROM internal name: %s\n\n", gameInfo.ROMname); + 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 + if(!memcmp(gameInfo.header.gameCode,"####",4)) + DLDI::tryPatch((void*)data, gameInfo.mask + 1); return ret; } diff --git a/desmume/src/cli/main.cpp b/desmume/src/cli/main.cpp index 07db608ab..77ae06f35 100644 --- a/desmume/src/cli/main.cpp +++ b/desmume/src/cli/main.cpp @@ -747,7 +747,7 @@ int main(int argc, char ** argv) { } } - if(my_config.load_slot){ + if(my_config.load_slot != -1){ loadstate_slot(my_config.load_slot); }