fix #818 (Memory randomization desyncs FM2 movie recording)

This commit is contained in:
zeromus 2018-01-17 00:11:36 +00:00
parent caf8a070ce
commit e8d85a9eb2
3 changed files with 15 additions and 0 deletions

View File

@ -52,6 +52,7 @@ SELECTION selection;
SPLICER splicer; SPLICER splicer;
EDITOR editor; EDITOR editor;
extern int RAMInitOption;
extern int joysticksPerFrame[INPUT_TYPES_TOTAL]; extern int joysticksPerFrame[INPUT_TYPES_TOTAL];
extern bool turbo; extern bool turbo;
extern int pal_emulation; extern int pal_emulation;
@ -891,6 +892,7 @@ void applyMovieInputConfig()
SetMainWindowText(); SetMainWindowText();
// return focus to TAS Editor window // return focus to TAS Editor window
SetFocus(taseditorWindow.hwndTASEditor); SetFocus(taseditorWindow.hwndTASEditor);
RAMInitOption = currMovieData.RAMInitOption;
} }
// this getter contains formula to decide whether to record or replay movie // this getter contains formula to decide whether to record or replay movie

View File

@ -34,6 +34,8 @@ extern void AddRecentMovieFile(const char *filename);
extern bool mustEngageTaseditor; extern bool mustEngageTaseditor;
#endif #endif
extern int RAMInitOption;
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
@ -392,6 +394,7 @@ MovieData::MovieData()
, fds(false) , fds(false)
, palFlag(false) , palFlag(false)
, PPUflag(false) , PPUflag(false)
, RAMInitOption(0)
, rerecordCount(0) , rerecordCount(0)
, binaryFlag(false) , binaryFlag(false)
, loadFrameCount(-1) , loadFrameCount(-1)
@ -412,6 +415,8 @@ void MovieData::installValue(std::string& key, std::string& val)
installInt(val,fds); installInt(val,fds);
else if(key == "NewPPU") else if(key == "NewPPU")
installBool(val,PPUflag); installBool(val,PPUflag);
else if(key == "RAMInitOption")
installInt(val,RAMInitOption);
else if(key == "version") else if(key == "version")
installInt(val,version); installInt(val,version);
else if(key == "emuVersion") else if(key == "emuVersion")
@ -475,6 +480,7 @@ int MovieData::dump(EMUFILE *os, bool binary)
os->fprintf("port2 %d\n" , ports[2] ); os->fprintf("port2 %d\n" , ports[2] );
os->fprintf("FDS %d\n" , fds?1:0 ); os->fprintf("FDS %d\n" , fds?1:0 );
os->fprintf("NewPPU %d\n" , PPUflag?1:0 ); os->fprintf("NewPPU %d\n" , PPUflag?1:0 );
os->fprintf("RAMInitOption %d\n", RAMInitOption);
for(uint32 i=0;i<comments.size();i++) for(uint32 i=0;i<comments.size();i++)
os->fprintf("comment %s\n" , wcstombs(comments[i]).c_str() ); os->fprintf("comment %s\n" , wcstombs(comments[i]).c_str() );
@ -810,6 +816,7 @@ void FCEUMOV_CreateCleanMovie()
currMovieData.ports[2] = portFC.type; currMovieData.ports[2] = portFC.type;
currMovieData.fds = isFDS; currMovieData.fds = isFDS;
currMovieData.PPUflag = (newppu != 0); currMovieData.PPUflag = (newppu != 0);
currMovieData.RAMInitOption = RAMInitOption;
} }
void FCEUMOV_ClearCommands() void FCEUMOV_ClearCommands()
{ {
@ -896,6 +903,8 @@ bool FCEUI_LoadMovie(const char *fname, bool _read_only, int _pauseframe)
else else
FCEUI_SetVidSystem(0); FCEUI_SetVidSystem(0);
RAMInitOption = currMovieData.RAMInitOption;
//force the input configuration stored in the movie to apply //force the input configuration stored in the movie to apply
FCEUD_SetInput(currMovieData.fourscore, currMovieData.microphone, (ESI)currMovieData.ports[0], (ESI)currMovieData.ports[1], (ESIFC)currMovieData.ports[2]); FCEUD_SetInput(currMovieData.fourscore, currMovieData.microphone, (ESI)currMovieData.ports[0], (ESI)currMovieData.ports[1], (ESIFC)currMovieData.ports[2]);
@ -1563,6 +1572,7 @@ bool FCEUI_MovieGetInfo(FCEUFILE* fp, MOVIE_INFO& info, bool skipFrameCount)
info.reset = false; //Soft-reset isn't used from starting movies anymore, so this will be false, better for FCEUFILE to have that info (as |1| on the first frame indicates it info.reset = false; //Soft-reset isn't used from starting movies anymore, so this will be false, better for FCEUFILE to have that info (as |1| on the first frame indicates it
info.pal = md.palFlag; info.pal = md.palFlag;
info.ppuflag = md.PPUflag; info.ppuflag = md.PPUflag;
info.RAMInitOption = md.RAMInitOption;
info.nosynchack = true; info.nosynchack = true;
info.num_frames = md.records.size(); info.num_frames = md.records.size();
info.md5_of_rom_used = md.romChecksum; info.md5_of_rom_used = md.romChecksum;

View File

@ -42,6 +42,7 @@ typedef struct
uint32 emu_version_used; // 9813 = 0.98.13 uint32 emu_version_used; // 9813 = 0.98.13
MD5DATA md5_of_rom_used; MD5DATA md5_of_rom_used;
std::string name_of_rom_used; std::string name_of_rom_used;
int RAMInitOption;
std::vector<std::wstring> comments; std::vector<std::wstring> comments;
std::vector<std::string> subtitles; std::vector<std::string> subtitles;
@ -198,6 +199,8 @@ public:
int getNumRecords() { return records.size(); } int getNumRecords() { return records.size(); }
int RAMInitOption;
class TDictionary : public std::map<std::string,std::string> class TDictionary : public std::map<std::string,std::string>
{ {
public: public: