From 64de1a3260c92f1bf3309871ccf196e503c1b118 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Sat, 21 Jan 2012 06:06:01 +0100 Subject: [PATCH] (PS3) Add rewind menu option - note - g_settings.rewind_enable gets cleared to '0' somewhere in first-stage SSNES init for some weird reason - can't even enable it right now beacuse of that --- ps3/main.c | 4 ++++ ps3/menu-entries.h | 15 +++++++++++++++ ps3/menu.c | 27 ++++++++++++++++++++++++++- ps3/menu.h | 1 + 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/ps3/main.c b/ps3/main.c index 8303c15feb..48b8fe763f 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -138,6 +138,7 @@ static void init_settings(void) init_setting_uint("state_slot", g_extern.state_slot, 0); init_setting_uint("screenshots_enabled", g_console.screenshots_enable, 0); init_setting_char("cheat_database_path", g_settings.cheat_database, usrDirPath); + init_setting_bool("rewind_enable", g_settings.rewind_enable, false); } static void get_path_settings(bool multiman_support) @@ -542,6 +543,7 @@ begin_loop: } else if(mode_switch == MODE_MENU) { + printf("rewind enable: %d\n", g_settings.rewind_enable); menu_loop(); if(init_ssnes) { @@ -559,6 +561,8 @@ begin_loop: snprintf(arg5, sizeof(arg5), SYS_CONFIG_FILE); char *argv_[] = { arg1, arg2, arg3, arg4, arg5, NULL }; + printf("rewind enable: %d\n", g_settings.rewind_enable); + int argc = sizeof(argv_) / sizeof(argv_[0]) - 1; int init_ret = ssnes_main_init(argc, argv_); g_emulator_initialized = 1; diff --git a/ps3/menu-entries.h b/ps3/menu-entries.h index 4fd2e90bd8..432da08c41 100644 --- a/ps3/menu-entries.h +++ b/ps3/menu-entries.h @@ -375,6 +375,21 @@ static item items_generalsettings[MAX_NO_OF_CONTROLS_SETTINGS] = 0, 1 }, + { + SETTING_EMU_REWIND_ENABLED, + "Rewind", + "", + 0.0f, + 0.0f, + YELLOW, + "INFO - [Rewind] feature is set to 'OFF'.", + WHITE, + 0.91f, + 0.09f, + 0.83f, + 0, + 1 + }, { SETTING_EMU_VIDEO_DEFAULT_ALL, "DEFAULT", diff --git a/ps3/menu.c b/ps3/menu.c index 84adcd588c..8b6ef8bb55 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -680,6 +680,20 @@ static void set_setting_label(menu * menu_obj, int currentsetting) else menu_obj->items[currentsetting].text_color = ORANGE; break; + case SETTING_EMU_REWIND_ENABLED: + if(g_settings.rewind_enable) + { + snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "ON"); + menu_obj->items[currentsetting].text_color = GREEN; + snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Rewind] feature is set to 'ON'. You can rewind the game in real-time."); + } + else + { + snprintf(menu_obj->items[currentsetting].setting_text, sizeof(menu_obj->items[currentsetting].setting_text), "OFF"); + menu_obj->items[currentsetting].text_color = ORANGE; + snprintf(menu_obj->items[currentsetting].comment, sizeof(menu_obj->items[currentsetting].comment), "INFO - [Rewind] feature is set to 'OFF'."); + } + break; case SETTING_EMU_VIDEO_DEFAULT_ALL: if(menu_obj->selected == currentsetting) menu_obj->items[currentsetting].text_color = GREEN; @@ -1039,6 +1053,18 @@ static void producesettingentry(menu * menu_obj, uint64_t switchvalue) if(CTRL_START(state)) g_extern.state_slot = 0; break; + case SETTING_EMU_REWIND_ENABLED: + if(CTRL_LEFT(state) || CTRL_LSTICK_LEFT(state) || CTRL_RIGHT(state) || CTRL_LSTICK_RIGHT(state) || CTRL_CROSS(state)) + { + g_settings.rewind_enable = !g_settings.rewind_enable; + + set_text_message("", 7); + } + if(CTRL_START(state)) + { + g_settings.rewind_enable = false; + } + break; case SETTING_EMU_VIDEO_DEFAULT_ALL: break; case SETTING_EMU_AUDIO_DEFAULT_ALL: @@ -1278,7 +1304,6 @@ static void select_rom(void) snprintf(rom_path_temp, sizeof(rom_path_temp), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); menu_is_running = 0; - memset(&g_extern, 0, sizeof(g_extern)); snprintf(g_console.rom_path, sizeof(g_console.rom_path), "%s/%s", FILEBROWSER_GET_CURRENT_DIRECTORY_NAME(browser), FILEBROWSER_GET_CURRENT_FILENAME(browser)); init_ssnes = 1; mode_switch = MODE_EMULATION; diff --git a/ps3/menu.h b/ps3/menu.h index a4e7dc5c48..210f4bde1a 100644 --- a/ps3/menu.h +++ b/ps3/menu.h @@ -97,6 +97,7 @@ enum /* port-specific */ SETTING_EMU_CURRENT_SAVE_STATE_SLOT, SETTING_EMU_DEFAULT_ALL, + SETTING_EMU_REWIND_ENABLED, SETTING_EMU_VIDEO_DEFAULT_ALL, SETTING_EMU_AUDIO_DEFAULT_ALL, /* end of port-specific */