From: notaz Date: Tue, 6 Nov 2012 00:36:42 +0000 (+0200) Subject: frontend: add fast forward support X-Git-Tag: r16~6 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=456f1b86b44a631e7c58e42ae72ce07970843944 frontend: add fast forward support --- diff --git a/frontend/main.c b/frontend/main.c index a71ddea3..53e3674a 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -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() { diff --git a/frontend/main.h b/frontend/main.h index a03db8b2..44c1b6a5 100644 --- a/frontend/main.h +++ b/frontend/main.h @@ -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, diff --git a/frontend/menu.c b/frontend/menu.c index a93c8f08..9654221c 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -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 }, diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c index 694bb7e7..5f20d009 100644 --- a/frontend/plat_pandora.c +++ b/frontend/plat_pandora.c @@ -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 } }; diff --git a/frontend/plat_sdl.c b/frontend/plat_sdl.c index b5d1c86c..61f904da 100644 --- a/frontend/plat_sdl.c +++ b/frontend/plat_sdl.c @@ -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 } };