diff --git a/desmume/src/addons/slot1_retail_mcrom.cpp b/desmume/src/addons/slot1_retail_mcrom.cpp index 025bd2972..98133fc8e 100644 --- a/desmume/src/addons/slot1_retail_mcrom.cpp +++ b/desmume/src/addons/slot1_retail_mcrom.cpp @@ -48,6 +48,7 @@ public: protocol.reset(this); protocol.chipId = gameInfo.chipID; protocol.gameCode = T1ReadLong((u8*)gameInfo.header.gameCode,0); + g_Slot1Comp_MC.connect(); } virtual u8 auxspi_transaction(int PROCNUM, u8 value) diff --git a/desmume/src/addons/slot1comp_mc.cpp b/desmume/src/addons/slot1comp_mc.cpp index 3b5cd7969..18c390cdc 100644 --- a/desmume/src/addons/slot1comp_mc.cpp +++ b/desmume/src/addons/slot1comp_mc.cpp @@ -21,6 +21,7 @@ #include "types.h" #include "../MMU.h" #include "slot1comp_mc.h" +#include "NDSSystem.h" Slot1Comp_MC g_Slot1Comp_MC; @@ -28,8 +29,13 @@ u8 Slot1Comp_MC::auxspi_transaction(int PROCNUM, u8 value) { return MMU_new.backupDevice.data_command(value, PROCNUM); } + void Slot1Comp_MC::auxspi_reset(int PROCNUM) { MMU_new.backupDevice.reset_command(); } +void Slot1Comp_MC::connect() +{ + if(!memcmp(gameInfo.header.gameCode,"AXBJ", 4)) MMU_new.backupDevice.uninitializedValue = 0x00; // Daigassou! Band Brothers DX (JP) +} \ No newline at end of file diff --git a/desmume/src/addons/slot1comp_mc.h b/desmume/src/addons/slot1comp_mc.h index e5dfe4f00..558c31b42 100644 --- a/desmume/src/addons/slot1comp_mc.h +++ b/desmume/src/addons/slot1comp_mc.h @@ -22,6 +22,7 @@ class Slot1Comp_MC public: u8 auxspi_transaction(int PROCNUM, u8 value); void auxspi_reset(int PROCNUM); + void connect(); }; extern Slot1Comp_MC g_Slot1Comp_MC; \ No newline at end of file diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index b8ae2a5f8..56f749cd3 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -64,13 +64,6 @@ #define MCLOG(...) #endif -//since r2203 this was 0x00. -//but baby pals proves finally that it should be 0xFF: -//the game reads its initial sound volumes from uninitialized data, and if it is 0, the game will be silent -//if it is 0xFF then the game starts with its sound and music at max, as presumably it is supposed to. -//so in r3303 I finally changed it (no$ appears definitely to initialize to 0xFF) -static u8 kUninitializedSaveDataValue = 0xFF; - static const char* DESMUME_BACKUP_FOOTER_TXT = "|<--Snip above here to create a raw sav by excluding this DeSmuME savedata footer:"; static const char* kDesmumeSaveCookie = "|-DESMUME SAVE-|"; @@ -219,12 +212,20 @@ BackupDevice::BackupDevice() addr_size = 0; isMovieMode = false; + //default for most games; will be altered where appropriate + //usually 0xFF, but occasionally others. If these exceptions could be related to a particular backup memory type, that would be helpful. + //at first we assumed it would be 0x00, but baby pals proved that it should be 0xFF: + // the game reads its initial sound volumes from uninitialized data, and if it is 0, the game will be silent + // if it is 0xFF then the game starts with its sound and music at max, as presumably it is supposed to. + // so in r3303 we finally changed it (no$ appears definitely to initialize to 0xFF) + uninitializedValue = 0xFF; + if (gameInfo.romsize == 0) return; char buf[MAX_PATH] = {0}; memset(buf, 0, MAX_PATH); path.getpathnoext(path.BATTERY, buf); - filename = std::string(buf) + ".dsv"; // DeSmuME memory card + filename = std::string(buf) + ".dsv"; MCLOG("MC: %s\n", filename.c_str()); @@ -553,10 +554,6 @@ void BackupDevice::reset_hardware() motionInitState = MOTION_INIT_STATE_IDLE; motionFlag = MOTION_FLAG_NONE; - - kUninitializedSaveDataValue = 0xFF; - - if(!memcmp(gameInfo.header.gameCode,"AXBJ", 4)) kUninitializedSaveDataValue = 0x00; // Daigassou! Band Brothers DX (JP) } void BackupDevice::reset() @@ -876,7 +873,7 @@ u8 BackupDevice::data_command(u8 val, u8 PROCNUM) //guarantees that the data buffer has room enough for the specified number of bytes void BackupDevice::ensure(u32 addr, EMUFILE_FILE *fpOut) { - ensure(addr, kUninitializedSaveDataValue, fpOut); + ensure(addr, uninitializedValue, fpOut); } void BackupDevice::ensure(u32 addr, u8 val, EMUFILE_FILE *fpOut) @@ -1322,7 +1319,7 @@ bool BackupDevice::export_raw(const char* filename) if(data.size()>0) fwrite(&data[0],1,size,outf); for(u32 i=size;i data_autodetect; enum STATE { DETECTING = 0, RUNNING = 1