0.9.8: reset firmware at the beginning of movie playing/recording when desmume doesn't use external firmware.

0.9.8: add firmware to savestate by an experimental way.

Since Ragnarok Online DS (J) writes to firmware during the game (at the very beginning of the game, at least), this change is needed for anti-desync purpuse. I want to apply the same thing to trunk, but I guess it should be done by more polished way. This change to saves.cpp looks too hacky, but I have no idea how I can improve it.
This commit is contained in:
gocha 2012-07-29 02:58:18 +00:00
parent 59aff514f3
commit 59229d3fbd
2 changed files with 34 additions and 1 deletions

View File

@ -566,6 +566,12 @@ const char* _CDECL_ FCEUI_LoadMovie(const char *fname, bool _read_only, bool tas
//fully reload the game to reinitialize everything before playing any movie
//poweron(true);
// reset firmware (some games can write to it)
if (CommonSettings.UseExtFirmware == false)
{
NDS_CreateDummyFirmware(&CommonSettings.InternalFirmConf);
}
NDS_Reset();
////WE NEED TO LOAD A SAVESTATE
@ -675,6 +681,12 @@ void FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, std::stri
currMovieData.romFilename = path.GetRomName();
currMovieData.rtcStart = rtcstart;
// reset firmware (some games can write to it)
if (CommonSettings.UseExtFirmware == false)
{
NDS_CreateDummyFirmware(&CommonSettings.InternalFirmConf);
}
NDS_Reset();
//todo ?

View File

@ -230,6 +230,7 @@ SFORMAT SF_MMU[]={
{ "BUAZ", 1, 1, &MMU.fw.addr_size},
{ "BUWE", 4, 1, &MMU.fw.write_enable},
{ "BUWR", 4, 1, &MMU.fw.writeable_buffer},
{ "BUJQ", 1, 0x40000, &MMU.fw.data}, // doesn't work (because of delayed allocation), needs dynamic modification, see writechunks and ReadStateChunks
//end memory chips
{ "MC0A", 4, 1, &MMU.dscard[0].address},
@ -258,7 +259,7 @@ SFORMAT SF_MMU[]={
{ "PMCR", 1, 5, &MMU.powerMan_Reg},
{ "MR3D", 4, 1, &MMU.reg_DISP3DCNT_bits},
{ 0 }
};
@ -983,6 +984,16 @@ bool savestate_save (const char *file_name)
extern SFORMAT SF_RTC[];
static void writechunks(EMUFILE* os) {
// poor hack for firmware
SFORMAT* temp = SF_MMU;
while(temp->v) {
if(strcmp(temp->desc,"BUJQ") == 0) {
temp->v = MMU.fw.data;
temp->count = MMU.fw.size;
}
temp++;
}
savestate_WriteChunk(os,1,SF_ARM9);
savestate_WriteChunk(os,2,SF_ARM7);
savestate_WriteChunk(os,3,cp15_savestate);
@ -1005,6 +1016,16 @@ static void writechunks(EMUFILE* os) {
static bool ReadStateChunks(EMUFILE* is, s32 totalsize)
{
// poor hack for firmware
SFORMAT* temp = SF_MMU;
while(temp->v) {
if(strcmp(temp->desc,"BUJQ") == 0) {
temp->v = MMU.fw.data;
temp->count = MMU.fw.size;
}
temp++;
}
bool ret = true;
while(totalsize > 0)
{