summaryrefslogtreecommitdiff
path: root/gui/Plugin.c
diff options
context:
space:
mode:
authorSND\ckain_cp <SND\ckain_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-01-24 13:59:46 +0000
committerSND\ckain_cp <SND\ckain_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2014-01-24 13:59:46 +0000
commite1108dba69ad14fed7bc64f996ea09342c900a81 (patch)
treea3798c4031cce49eeb5964ec9ae49a9627bc5a91 /gui/Plugin.c
parent47b0777b946e413500bc0420d91298aa4e8f8301 (diff)
downloadpcsxr-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/Plugin.c')
-rwxr-xr-xgui/Plugin.c30
1 files changed, 20 insertions, 10 deletions
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; }