Fixes an error with joypad read coding in LUA with processing-heavy scripts, when loading save states. Yes, it takes all of that to cause the error. Someone who uses FCEUX to TAS should try stuff starting from a save state, with LUA going.

FatRatKnight believes it's because the process of pressing a button to load a state, combined with the keyboard reads in LUA, and the heavy processing delaying code execution combine to allow for a skipped frame. The heavier the LUA processing, the more likely a skipped frame.
This commit is contained in:
ugetab 2010-04-24 22:20:10 +00:00
parent 5600ba096b
commit d5fa95c276
2 changed files with 8 additions and 1 deletions

View File

@ -321,11 +321,17 @@ void HandleHotkeys()
void FCEUD_UpdateInput() void FCEUD_UpdateInput()
{ {
bool joy=false,mouse=false; bool joy=false,mouse=false;
EMOVIEMODE FCEUMOVState = FCEUMOV_Mode();
extern bool justloadedstate;
if(((FCEUMOVState != MOVIEMODE_PLAY) && (FCEUMOVState != MOVIEMODE_RECORD)) || !justloadedstate) {
KeyboardUpdateState(); KeyboardUpdateState();
UpdateJoysticks(); UpdateJoysticks();
HandleHotkeys(); HandleHotkeys();
}
justloadedstate = false;
{ {
for(int x=0;x<2;x++) for(int x=0;x<2;x++)
@ -365,7 +371,7 @@ void FCEUD_UpdateInput()
UpdateGamepad(); UpdateGamepad();
if(mouse) if(mouse)
if(FCEUMOV_Mode() != MOVIEMODE_PLAY) //FatRatKnight: Moved this if out of the function if(FCEUMOVState != MOVIEMODE_PLAY) //FatRatKnight: Moved this if out of the function
GetMouseData(MouseData); //A more concise fix may be desired. GetMouseData(MouseData); //A more concise fix may be desired.
} }
} }

View File

@ -81,6 +81,7 @@ bool justLagged = false;
bool frameAdvanceLagSkip = false; //If this is true, frame advance will skip over lag frame (i.e. it will emulate 2 frames instead of 1) bool frameAdvanceLagSkip = false; //If this is true, frame advance will skip over lag frame (i.e. it will emulate 2 frames instead of 1)
bool AutoSS = false; //Flagged true when the first auto-savestate is made while a game is loaded, flagged false on game close bool AutoSS = false; //Flagged true when the first auto-savestate is made while a game is loaded, flagged false on game close
bool movieSubtitles = true; //Toggle for displaying movie subtitles bool movieSubtitles = true; //Toggle for displaying movie subtitles
bool justloadedstate = false;
FCEUGI::FCEUGI() FCEUGI::FCEUGI()
: filename(0) : filename(0)