summaryrefslogtreecommitdiff
path: root/gui/Plugin.c
diff options
context:
space:
mode:
authoriCatButler <i.am.catbutler@gmail.com>2016-03-30 15:07:35 +0100
committeriCatButler <i.am.catbutler@gmail.com>2016-03-30 15:07:35 +0100
commit8b4350fee747708ffd376744ef5dc1e239a87ba6 (patch)
treea9ab6e2f25e06edc7c668353f8000856704f7fa3 /gui/Plugin.c
parente3df273095a5800e3dcdcb63bd66e269c0c2d3a8 (diff)
downloadpcsxr-8b4350fee747708ffd376744ef5dc1e239a87ba6.tar.gz
Bring up to date with PCSX-R master (97809)
Diffstat (limited to 'gui/Plugin.c')
-rwxr-xr-xgui/Plugin.c112
1 files changed, 46 insertions, 66 deletions
diff --git a/gui/Plugin.c b/gui/Plugin.c
index 08627455..0adf3b5e 100755
--- a/gui/Plugin.c
+++ b/gui/Plugin.c
@@ -42,6 +42,8 @@ extern void LidInterrupt();
unsigned long gpuDisp;
int StatesC = 0;
+unsigned char loadedOld = FALSE;
+int speed = 100;
extern int UseGui;
void gpuShowPic() {
@@ -77,9 +79,23 @@ void gpuShowPic() {
void KeyStateSave(int i) {
gchar *state_filename;
+ gchar *oldname, *newname;
+ int j;
state_filename = get_state_filename (i);
+ if (i < OLD_SLOT && !loadedOld) {
+ newname = get_state_filename (LAST_OLD_SLOT);
+ for (j = LAST_OLD_SLOT - 1; j >= OLD_SLOT; --j) {
+ oldname = get_state_filename (j);
+ rename(oldname, newname);
+ g_free (newname);
+ newname = oldname;
+ }
+ rename(state_filename, newname);
+ g_free (newname);
+ }
state_save (state_filename);
+ loadedOld = FALSE;
g_free (state_filename);
}
@@ -87,6 +103,8 @@ void KeyStateSave(int i) {
void KeyStateLoad(int i) {
gchar *state_filename;
+ loadedOld = (i >= OLD_SLOT && i <= LAST_OLD_SLOT);
+
state_filename = get_state_filename (i);
state_load (state_filename);
@@ -108,6 +126,7 @@ void PADhandleKey(int key) {
char Text[MAXPATHLEN];
gchar *state_filename;
time_t now;
+ int slot;
short rel = 0; //released key flag
@@ -155,69 +174,20 @@ void PADhandleKey(int key) {
if (modalt) KeyStateLoad(10);
break;
- case XK_1:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(0);
- if (modctrl) KeyStateSave(0);
- break;
- case XK_2:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(1);
- if (modctrl) KeyStateSave(1);
- break;
- case XK_3:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(2);
- if (modctrl) KeyStateSave(2);
- break;
- case XK_4:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(3);
- if (modctrl) KeyStateSave(3);
- break;
- case XK_5:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(4);
- if (modctrl) KeyStateSave(4);
- break;
- case XK_6:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(5);
- if (modctrl) KeyStateSave(5);
- break;
- case XK_7:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(6);
- if (modctrl) KeyStateSave(6);
- break;
- case XK_8:
+ case XK_1: case XK_2: case XK_3: case XK_4: case XK_5:
+ case XK_6: case XK_7: case XK_8: case XK_9:
+ slot = key - XK_1;
if (modalt && modctrl)
return;
- if (modalt) KeyStateLoad(7);
- if (modctrl) KeyStateSave(7);
- break;
- case XK_9:
- if (modalt && modctrl)
- return;
- if (modalt) KeyStateLoad(8);
- if (modctrl) KeyStateSave(8);
+ if (modalt) KeyStateLoad(slot);
+ else if (modctrl) KeyStateSave(slot);
+ else KeyStateLoad(OLD_SLOT + slot);
break;
case XK_F1:
GPU_freeze(2, (GPUFreeze_t *)&StatesC);
- state_filename = get_state_filename (StatesC);
- state_save (state_filename);
-
- g_free (state_filename);
+ KeyStateSave(StatesC);
gpuShowPic();
-
break;
case XK_F2:
if (StatesC < (MAX_SLOTS - 1)) StatesC++;
@@ -226,15 +196,7 @@ void PADhandleKey(int key) {
gpuShowPic();
break;
case XK_F3:
- state_filename = get_state_filename (StatesC);
- state_load (state_filename);
-
- g_free (state_filename);
-
- // HACKHACK: prevent crash when using recompiler due to execution not
- // returned from compiled code. This WILL cause memory leak, however a
- // large amount of refactor is needed for a proper fix.
- if (Config.Cpu == CPU_DYNAREC) psxCpu->Execute();
+ KeyStateLoad(StatesC);
gpuShowPic();
break;
case XK_F4:
@@ -290,6 +252,22 @@ void PADhandleKey(int key) {
tslastpressed = now;
RewindState();
break;
+ case XK_bracketleft:
+ if (speed == Config.AltSpeed1) {
+ speed = 100;
+ } else {
+ speed = Config.AltSpeed1;
+ }
+ GPU_setSpeed(speed / 100.0);
+ break;
+ case XK_bracketright:
+ if (speed == Config.AltSpeed2) {
+ speed = 100;
+ } else {
+ speed = Config.AltSpeed2;
+ }
+ GPU_setSpeed(speed / 100.0);
+ break;
case XK_Escape:
// TODO
// the architecture is too broken to actually restart the GUI
@@ -298,8 +276,10 @@ void PADhandleKey(int key) {
// Fixing this would probably require a complete reworking of
// all functions, so that they return 0 or 1 for success
// that way, execution wouldn't continue
- if (CdromId[0] != '\0')
+ if (CdromId[0] != '\0') {
+ loadedOld = TRUE;
KeyStateSave(10);
+ }
ClosePlugins();
UpdateMenuSlots();
if (!UseGui) OnFile_Exit();