GTK+, Unix: Preserve current joypad state when rewinding.

This commit is contained in:
Brandon Wright 2018-06-16 17:31:41 -05:00
parent de593cbe6f
commit e49dcc0cb2
2 changed files with 18 additions and 0 deletions

View File

@ -352,7 +352,16 @@ S9xIdleFunc (gpointer data)
#endif #endif
if(Settings.Rewinding) if(Settings.Rewinding)
{
uint16 joypads[8];
for (int i = 0; i < 8; i++)
joypads[i] = MovieGetJoypad(i);
Settings.Rewinding = stateMan.pop(); Settings.Rewinding = stateMan.pop();
for (int i = 0; i < 8; i++)
MovieSetJoypad (i, joypads[i]);
}
else if(IPPU.TotalEmulatedFrames % gui_config->rewind_granularity == 0) else if(IPPU.TotalEmulatedFrames % gui_config->rewind_granularity == 0)
stateMan.push(); stateMan.push();

View File

@ -1952,7 +1952,16 @@ int main (int argc, char **argv)
#endif #endif
{ {
if(rewinding) if(rewinding)
{
uint16 joypads[8];
for (int i = 0; i < 8; i++)
joypads[i] = MovieGetJoypad(i);
rewinding = stateMan.pop(); rewinding = stateMan.pop();
for (int i = 0; i < 8; i++)
MovieSetJoypad (i, joypads[i]);
}
else if(IPPU.TotalEmulatedFrames % unixSettings.rewindGranularity == 0) else if(IPPU.TotalEmulatedFrames % unixSettings.rewindGranularity == 0)
stateMan.push(); stateMan.push();