diff options
| author | SND\ckain_cp <SND\ckain_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-01-24 13:59:46 +0000 |
|---|---|---|
| committer | SND\ckain_cp <SND\ckain_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2014-01-24 13:59:46 +0000 |
| commit | e1108dba69ad14fed7bc64f996ea09342c900a81 (patch) | |
| tree | a3798c4031cce49eeb5964ec9ae49a9627bc5a91 /gui | |
| parent | 47b0777b946e413500bc0420d91298aa4e8f8301 (diff) | |
| download | pcsxr-e1108dba69ad14fed7bc64f996ea09342c900a81.tar.gz | |
Added rewind feature. Currently only supported via GTK and needs SHM. Rewind save state depth is configured via RewindCount config param. Recommended value is 200 or so -> uses less than 1G of memory
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@88433 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'gui')
| -rwxr-xr-x | gui/Config.c | 2 | ||||
| -rwxr-xr-x | gui/Linux.h | 2 | ||||
| -rwxr-xr-x | gui/LnxMain.c | 14 | ||||
| -rwxr-xr-x | gui/Plugin.c | 30 |
4 files changed, 35 insertions, 13 deletions
diff --git a/gui/Config.c b/gui/Config.c index 1f370a82..60c2b4cc 100755 --- a/gui/Config.c +++ b/gui/Config.c @@ -142,6 +142,7 @@ int LoadConfig(PcsxConfig *Conf) { Config.Cpu = GetValuel(data, "Cpu"); Config.PsxType = GetValuel(data, "PsxType"); + Config.RewindCount = GetValuel(data, "RewindCount"); free(data); @@ -189,6 +190,7 @@ void SaveConfig() { SetValuel("Cpu", Config.Cpu); SetValuel("PsxType", Config.PsxType); + SetValuel("RewindCount", Config.RewindCount); fclose(f); } diff --git a/gui/Linux.h b/gui/Linux.h index 791f103b..0d2d1493 100755 --- a/gui/Linux.h +++ b/gui/Linux.h @@ -68,4 +68,6 @@ void UpdatePluginsBIOS(); void SysErrorMessage(gchar *primary, gchar *secondary); void SysInfoMessage(gchar *primary, gchar *secondary); +extern u8 rew_timer; + #endif /* __LINUX_H__ */ diff --git a/gui/LnxMain.c b/gui/LnxMain.c index 14c295cd..67cb75ac 100755 --- a/gui/LnxMain.c +++ b/gui/LnxMain.c @@ -502,6 +502,8 @@ void SysClose() { EmuShutdown(); ReleasePlugins(); + CleanupMemSaveStates(); + StopDebugger(); if (emuLog != NULL) fclose(emuLog); @@ -573,11 +575,17 @@ static void SysDisableScreenSaver() { } } +u8 rew_timer = 0u; // TODO: change to scaled ms based or psxcycle based void SysUpdate() { - PADhandleKey(PAD1_keypressed()); - PADhandleKey(PAD2_keypressed()); + PADhandleKey(PAD1_keypressed() ); + PADhandleKey(PAD2_keypressed() ); + + if (Config.RewindCount > 0 && rew_timer++ > 35) { + CreateRewindState(); + rew_timer = 0; + } - SysDisableScreenSaver(); + //SysDisableScreenSaver(); } /* ADB TODO Replace RunGui() with StartGui ()*/ diff --git a/gui/Plugin.c b/gui/Plugin.c index 0c7901f7..05b10c58 100755 --- a/gui/Plugin.c +++ b/gui/Plugin.c @@ -60,8 +60,8 @@ void gpuShowPic() { f = gzopen(state_filename, "rb"); if (f != NULL) { gzseek(f, 32, SEEK_SET); // skip header - gzseek(f, sizeof(u32), SEEK_CUR); - gzseek(f, sizeof(boolean), SEEK_CUR); + gzseek(f, sizeof(u32), SEEK_CUR); + gzseek(f, sizeof(boolean), SEEK_CUR); gzread(f, pMem, 128*96*3); gzclose(f); } else { @@ -103,8 +103,9 @@ void KeyStateLoad(int i) { } // todo: make toggle config param -static short modctrl = 0, modalt = 0, toggle = 0, pressed = 0; -int lastpressed = 0; +static s16 modctrl = 0, modalt = 0, toggle = 0, pressed = 0; +s32 lastpressed = 0; +time_t tslastpressed = 0; /* Handle keyboard keystrokes */ void PADhandleKey(int key) { @@ -113,7 +114,8 @@ void PADhandleKey(int key) { short rel = 0; //released key flag - if (key == 0 || key == lastpressed) + // Allow rewind key to repeat + if (key == 0 || (key == lastpressed && key != XK_BackSpace)) return; if ((key >> 30) & 1) //specific to dfinput (padJoy) @@ -284,7 +286,15 @@ void PADhandleKey(int key) { case XK_F12: psxReset(); break; - case XK_Escape: + case XK_BackSpace: + rew_timer = 0; + time_t now = clock(); + u32 millis = (((now - tslastpressed) * 1000) / CLOCKS_PER_SEC); + if (millis <= 130) break; + tslastpressed = now; + RewindState(); + break; + case XK_Escape: // TODO // the architecture is too broken to actually restart the GUI // because SysUpdate is called from deep within the actual @@ -345,12 +355,12 @@ int _OpenPlugins() { if (ret < 0) { SysMessage(_("Error opening GPU plugin!")); return -1; } ret = PAD1_open(&gpuDisp); if (ret < 0) { SysMessage(_("Error opening Controller 1 plugin!")); return -1; } - PAD1_registerVibration(GPU_visualVibration); - PAD1_registerCursor(GPU_cursor); + PAD1_registerVibration(GPU_visualVibration); + PAD1_registerCursor(GPU_cursor); ret = PAD2_open(&gpuDisp); if (ret < 0) { SysMessage(_("Error opening Controller 2 plugin!")); return -1; } - PAD2_registerVibration(GPU_visualVibration); - PAD2_registerCursor(GPU_cursor); + PAD2_registerVibration(GPU_visualVibration); + PAD2_registerCursor(GPU_cursor); #ifdef ENABLE_SIO1API ret = SIO1_open(&gpuDisp); if (ret < 0) { SysMessage(_("Error opening SIO1 plugin!")); return -1; } |
