frontend: add fast forward support
authornotaz <notasas@gmail.com>
Tue, 6 Nov 2012 00:36:42 +0000 (02:36 +0200)
committernotaz <notasas@gmail.com>
Tue, 6 Nov 2012 00:36:42 +0000 (02:36 +0200)
frontend/main.c
frontend/main.h
frontend/menu.c
frontend/plat_pandora.c
frontend/plat_sdl.c

index a71ddea..53e3674 100644 (file)
@@ -51,6 +51,8 @@ enum sched_action emu_action, emu_action_old;
 char hud_msg[64];
 int hud_new_msg;
 
+static void toggle_fast_forward(int force_off);
+
 static void make_path(char *buf, size_t size, const char *dir, const char *fname)
 {
        if (fname)
@@ -207,6 +209,7 @@ void do_emu_action(void)
                break;
 #ifndef NO_FRONTEND
        case SACTION_ENTER_MENU:
+               toggle_fast_forward(1);
                menu_loop();
                return;
        case SACTION_NEXT_SSLOT:
@@ -242,6 +245,10 @@ do_state_slot:
                        GPU_open(&gpuDisp, "PCSX", NULL);
                }
                break;
+       case SACTION_FAST_FORWARD:
+               toggle_fast_forward(0);
+               plugin_call_rearmed_cbs();
+               break;
        case SACTION_SCREENSHOT:
                {
                        char buf[MAXPATHLEN];
@@ -588,6 +595,40 @@ int main(int argc, char *argv[])
 
        return 0;
 }
+
+static void toggle_fast_forward(int force_off)
+{
+       static int fast_forward;
+       static int normal_g_opts;
+       static int normal_frameskip;
+       static int normal_enhancement_enable;
+
+       if (force_off && !fast_forward)
+               return;
+
+       fast_forward = !fast_forward;
+       if (fast_forward) {
+               normal_g_opts = g_opts;
+               normal_frameskip = pl_rearmed_cbs.frameskip;
+               normal_enhancement_enable =
+                       pl_rearmed_cbs.gpu_neon.enhancement_enable;
+
+               g_opts |= OPT_NO_FRAMELIM;
+               pl_rearmed_cbs.frameskip = 3;
+               pl_rearmed_cbs.gpu_neon.enhancement_enable = 0;
+       } else {
+               g_opts = normal_g_opts;
+               pl_rearmed_cbs.frameskip = normal_frameskip;
+               pl_rearmed_cbs.gpu_neon.enhancement_enable =
+                       normal_enhancement_enable;
+
+               pl_timing_prepare(Config.PsxType);
+       }
+
+       if (!force_off)
+               snprintf(hud_msg, sizeof(hud_msg), "FAST FORWARD %s",
+                       fast_forward ? "ON" : "OFF");
+}
 #endif
 
 void SysRunGui() {
index a03db8b..44c1b6a 100644 (file)
@@ -66,6 +66,7 @@ enum sched_action {
        SACTION_PREV_SSLOT,
        SACTION_TOGGLE_FSKIP,
        SACTION_SWITCH_DISPMODE,
+       SACTION_FAST_FORWARD,
        SACTION_SCREENSHOT,
        SACTION_VOLUME_UP,
        SACTION_VOLUME_DOWN,
index a93c8f0..9654221 100644 (file)
@@ -666,11 +666,12 @@ me_bind_action emuctrl_actions[] =
        { "Next Save Slot   ", 1 << SACTION_NEXT_SSLOT },
        { "Toggle Frameskip ", 1 << SACTION_TOGGLE_FSKIP },
        { "Take Screenshot  ", 1 << SACTION_SCREENSHOT },
-       { "Switch Renderer  ", 1 << SACTION_SWITCH_DISPMODE },
-       { "Enter Menu       ", 1 << SACTION_ENTER_MENU },
+       { "Fast Forward     ", 1 << SACTION_FAST_FORWARD },
 #ifdef __ARM_ARCH_7A__ /* XXX */
+       { "Switch Renderer  ", 1 << SACTION_SWITCH_DISPMODE },
        { "Minimize         ", 1 << SACTION_MINIMIZE },
 #endif
+       { "Enter Menu       ", 1 << SACTION_ENTER_MENU },
        { "Gun Trigger      ", 1 << SACTION_GUN_TRIGGER },
        { "Gun A button     ", 1 << SACTION_GUN_A },
        { "Gun B button     ", 1 << SACTION_GUN_B },
index 694bb7e..5f20d00 100644 (file)
@@ -39,7 +39,8 @@ static const struct in_default_bind in_evdev_defbinds[] = {
        { KEY_4,        IN_BINDTYPE_EMU, SACTION_NEXT_SSLOT },
        { KEY_5,        IN_BINDTYPE_EMU, SACTION_TOGGLE_FSKIP },
        { KEY_6,        IN_BINDTYPE_EMU, SACTION_SCREENSHOT },
-       { KEY_7,        IN_BINDTYPE_EMU, SACTION_SWITCH_DISPMODE },
+       { KEY_7,        IN_BINDTYPE_EMU, SACTION_FAST_FORWARD },
+       { KEY_8,        IN_BINDTYPE_EMU, SACTION_SWITCH_DISPMODE },
        { 0, 0, 0 }
 };
 
index b5d1c86..61f904d 100644 (file)
@@ -35,6 +35,14 @@ static const struct in_default_bind in_sdl_defbinds[] = {
   { SDLK_e,      IN_BINDTYPE_PLAYER12, DKEY_L2 },
   { SDLK_t,      IN_BINDTYPE_PLAYER12, DKEY_R2 },
   { SDLK_ESCAPE, IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
+  { SDLK_F1,     IN_BINDTYPE_EMU, SACTION_SAVE_STATE },
+  { SDLK_F2,     IN_BINDTYPE_EMU, SACTION_LOAD_STATE },
+  { SDLK_F3,     IN_BINDTYPE_EMU, SACTION_PREV_SSLOT },
+  { SDLK_F4,     IN_BINDTYPE_EMU, SACTION_NEXT_SSLOT },
+  { SDLK_F5,     IN_BINDTYPE_EMU, SACTION_TOGGLE_FSKIP },
+  { SDLK_F6,     IN_BINDTYPE_EMU, SACTION_SCREENSHOT },
+  { SDLK_F7,     IN_BINDTYPE_EMU, SACTION_FAST_FORWARD },
+  { SDLK_F8,     IN_BINDTYPE_EMU, SACTION_SWITCH_DISPMODE },
   { 0, 0, 0 }
 };