make the engineering around kUninitializedSaveDataValue not so horrible; affects "Daigassou! Band Brothers DX" but not tested (make the slot1comp_mc configure the BackupDevice with the appropriate uninitializedValue since it is a property of the physical backup memory hardware)
This commit is contained in:
parent
912355488e
commit
d2ed4ca30e
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
|
@ -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;
|
|
@ -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<padSize;i++)
|
||||
fputc(kUninitializedSaveDataValue,outf);
|
||||
fputc(uninitializedValue,outf);
|
||||
fclose(outf);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -140,6 +140,9 @@ public:
|
|||
bool importData(const char *filename, u32 force_size = 0);
|
||||
bool exportData(const char *filename);
|
||||
|
||||
//the value contained in memory when shipped from factory (before user program ever writes to it). more details commented elsewhere.
|
||||
u8 uninitializedValue;
|
||||
|
||||
private:
|
||||
EMUFILE_FILE *fpMC;
|
||||
std::string filename;
|
||||
|
@ -155,7 +158,7 @@ private:
|
|||
u32 addr_size, addr_counter;
|
||||
u32 addr;
|
||||
u8 write_protect;
|
||||
|
||||
|
||||
std::vector<u8> data_autodetect;
|
||||
enum STATE {
|
||||
DETECTING = 0, RUNNING = 1
|
||||
|
|
Loading…
Reference in New Issue