diff --git a/general.h b/general.h index 22b3b20a7a..198f833e01 100644 --- a/general.h +++ b/general.h @@ -174,6 +174,7 @@ struct console_settings bool default_sram_dir_enable; bool default_savestate_dir_enable; bool ingame_menu_enable; + bool menu_enable; bool return_to_multiman_enable; bool screenshots_enable; bool throttle_enable; @@ -183,6 +184,7 @@ struct console_settings uint32_t current_resolution_index; uint32_t current_resolution_id; uint32_t initial_resolution_id; + uint32_t mode_switch; uint32_t *supported_resolutions; uint32_t supported_resolutions_count; char rom_path[PATH_MAX]; diff --git a/ps3/main.c b/ps3/main.c index 8129e65ee4..41eaf9e20f 100644 --- a/ps3/main.c +++ b/ps3/main.c @@ -49,7 +49,6 @@ uint32_t g_emulator_initialized = 0; char special_action_msg[256]; /* message which should be overlaid on top of the screen*/ uint32_t special_action_msg_expired; /* time at which the message no longer needs to be overlaid onscreen*/ -uint32_t mode_switch = MODE_MENU; bool init_ssnes = false; uint64_t ingame_menu_item = 0; @@ -331,10 +330,10 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat switch (status) { case CELL_SYSUTIL_REQUEST_EXITGAME: - menu_is_running = 0; + g_console.menu_enable = false; g_quitting = true; g_console.ingame_menu_enable = false; - mode_switch = MODE_EXIT; + g_console.mode_switch = MODE_EXIT; if(g_emulator_initialized) ssnes_main_deinit(); break; @@ -376,7 +375,7 @@ static void ingame_menu(void) frame_advance_disabled = true; ingame_menu_item = 0; g_console.ingame_menu_enable = false; - mode_switch = MODE_EMULATION; + g_console.mode_switch = MODE_EMULATION; } switch(ingame_menu_item) @@ -397,7 +396,7 @@ static void ingame_menu(void) ingame_menu_item = 0; g_console.ingame_menu_enable = false; - mode_switch = MODE_EMULATION; + g_console.mode_switch = MODE_EMULATION; } if(CTRL_LEFT(button_was_pressed) || CTRL_LSTICK_LEFT(button_was_pressed)) { @@ -434,7 +433,7 @@ static void ingame_menu(void) msg_queue_push(g_extern.msg_queue, msg, 1, 180); ingame_menu_item = 0; g_console.ingame_menu_enable = false; - mode_switch = MODE_EMULATION; + g_console.mode_switch = MODE_EMULATION; } if(CTRL_LEFT(button_was_pressed) || CTRL_LSTICK_LEFT(button_was_pressed)) { @@ -530,7 +529,7 @@ static void ingame_menu(void) frame_advance_disabled = false; ingame_menu_item = MENU_ITEM_FRAME_ADVANCE; g_console.ingame_menu_enable = false; - mode_switch = MODE_EMULATION; + g_console.mode_switch = MODE_EMULATION; } ingame_menu_reset_entry_colors (ingame_menu_item); strcpy(comment, "Press 'CROSS', 'L2' or 'R2' button to step one frame.\nNOTE: Pressing the button rapidly will advance the frame more slowly\nand prevent buttons from being input."); @@ -556,7 +555,7 @@ static void ingame_menu(void) frame_advance_disabled = true; ingame_menu_item = 0; g_console.ingame_menu_enable = false; - mode_switch = MODE_EMULATION; + g_console.mode_switch = MODE_EMULATION; } ingame_menu_reset_entry_colors (ingame_menu_item); strcpy(comment, "Press 'CROSS' to return back to the game."); @@ -566,7 +565,7 @@ static void ingame_menu(void) { ingame_menu_item = 0; g_console.ingame_menu_enable = false; - mode_switch = MODE_EMULATION; + g_console.mode_switch = MODE_EMULATION; perform_reset(); } ingame_menu_reset_entry_colors (ingame_menu_item); @@ -577,8 +576,8 @@ static void ingame_menu(void) { ingame_menu_item = 0; g_console.ingame_menu_enable = false; - menu_is_running = 0; - mode_switch = MODE_MENU; + g_console.menu_enable = false; + g_console.mode_switch = MODE_MENU; } ingame_menu_reset_entry_colors (ingame_menu_item); @@ -589,7 +588,7 @@ static void ingame_menu(void) if(CTRL_CROSS(button_was_pressed)) { g_console.ingame_menu_enable = false; - mode_switch = MODE_EXIT; + g_console.mode_switch = MODE_EXIT; } ingame_menu_reset_entry_colors (ingame_menu_item); @@ -603,7 +602,7 @@ static void ingame_menu(void) #ifdef MULTIMAN_SUPPORT return_to_MM = false; #endif - mode_switch = MODE_EXIT; + g_console.mode_switch = MODE_EXIT; } ingame_menu_reset_entry_colors (ingame_menu_item); @@ -765,9 +764,10 @@ int main(int argc, char *argv[]) ps3_input_init(); menu_init(); + g_console.mode_switch = MODE_MENU; begin_loop: - if(mode_switch == MODE_EMULATION) + if(g_console.mode_switch == MODE_EMULATION) { bool repeat = false; if(ingame_menu_item != 0) @@ -784,7 +784,7 @@ begin_loop: if(g_console.ingame_menu_enable) ingame_menu(); } - else if(mode_switch == MODE_MENU) + else if(g_console.mode_switch == MODE_MENU) { menu_loop(); if(init_ssnes) @@ -806,7 +806,7 @@ begin_loop: } } #ifdef MULTIMAN_SUPPORT - else if(mode_switch == MODE_MULTIMAN_STARTUP) + else if(g_console.mode_switch == MODE_MULTIMAN_STARTUP) { } #endif diff --git a/ps3/menu.c b/ps3/menu.c index 31b415a3a8..c7b654cefa 100644 --- a/ps3/menu.c +++ b/ps3/menu.c @@ -43,7 +43,6 @@ menu menuStack[25]; int menuStackindex = 0; -uint32_t menu_is_running = false; /* is the menu running?*/ static bool set_initial_dir_tmpbrowser; filebrowser_t browser; /* main file browser->for rom browser*/ filebrowser_t tmpBrowser; /* tmp file browser->for everything else*/ @@ -282,8 +281,8 @@ static void browser_update(filebrowser_t * b) /* if a rom is loaded then resume it */ if (g_emulator_initialized) { - menu_is_running = 0; - mode_switch = MODE_EMULATION; + g_console.menu_enable = false; + g_console.mode_switch = MODE_EMULATION; set_text_message("", 15); } } @@ -1477,8 +1476,8 @@ static void select_setting(menu * menu_obj) { if (g_emulator_initialized) { - menu_is_running = 0; - mode_switch = MODE_EMULATION; + g_console.menu_enable = false; + g_console.mode_switch = MODE_EMULATION; set_text_message("", 15); } old_state = state; @@ -1556,10 +1555,10 @@ 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; + g_console.menu_enable = false; 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; + g_console.mode_switch = MODE_EMULATION; old_state = state; return; @@ -1603,7 +1602,7 @@ void menu_loop(void) menuStack[0] = menu_filebrowser; menuStack[0].enum_id = FILE_BROWSER_MENU; - menu_is_running = true; + g_console.menu_enable = true; menu_reinit_settings(); ssnes_render_cached_frame(); @@ -1645,5 +1644,5 @@ void menu_loop(void) psglSwap(); cell_console_poll(); cellSysutilCheckCallback(); - }while (menu_is_running); + }while (g_console.menu_enable); } diff --git a/ps3/menu.h b/ps3/menu.h index 20e329a6e2..a3c6b62683 100644 --- a/ps3/menu.h +++ b/ps3/menu.h @@ -167,5 +167,4 @@ enum void menu_init (void); void menu_loop (void); -extern uint32_t menu_is_running; #endif /* MENU_H_ */ diff --git a/ps3/shared.h b/ps3/shared.h index 0ebd780c09..1b7d7c6051 100644 --- a/ps3/shared.h +++ b/ps3/shared.h @@ -59,7 +59,6 @@ enum { extern char special_action_msg[256]; extern uint32_t g_emulator_initialized; extern uint32_t special_action_msg_expired; -extern uint32_t mode_switch; extern unsigned g_frame_count; extern bool init_ssnes; extern bool g_quitting;