From 7d00f945b8cc43f4feb788d79479cd99d1444c8c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Feb 2016 04:28:09 +0100 Subject: [PATCH] Implement RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU --- menu/cbs/menu_cbs_ok.c | 29 +++++++++-------------------- menu/menu_cbs.h | 4 ++++ menu/menu_driver.c | 39 +++++++++++++++++++++++++++++++-------- menu/menu_driver.h | 3 +++ 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 4792cf6ba7..bf3ace8edd 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -107,7 +107,7 @@ finish: } #endif -static int generic_action_ok_displaylist_push(const char *path, +int generic_action_ok_displaylist_push(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx, unsigned action_type) { @@ -440,17 +440,6 @@ static int generic_action_ok_displaylist_push(const char *path, return 0; } -int action_ok_push_quick_menu(void) -{ - bool msg_force = true; - menu_entries_flush_stack(NULL, MENU_SETTINGS); - menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); - - generic_action_ok_displaylist_push("", - "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); - return 0; -} - static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx, const char *path, const char *label, uint32_t hash_label, @@ -509,7 +498,7 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx, if (rarch_task_push_content_load_default(NULL, NULL, false, CORE_TYPE_PLAIN, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return menu_cbs_exit(); case 0: return generic_action_ok_displaylist_push(path, label, type, @@ -556,7 +545,7 @@ static int action_ok_file_load_detect_core(const char *path, if (rarch_task_push_content_load_default(path, detect_content_path, false, CORE_TYPE_PLAIN, NULL, NULL)) { - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return menu_cbs_exit(); } @@ -1110,7 +1099,7 @@ static int action_ok_core_load_deferred(const char *path, if (rarch_task_push_content_load_default(path, menu->deferred_path, false, CORE_TYPE_PLAIN, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return menu_cbs_exit(); } @@ -1141,7 +1130,7 @@ static int generic_action_ok_file_load(const char *path, case ACTION_OK_IMAGEVIEWER: if (rarch_task_push_content_load_default( NULL, new_path, true, action_type, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); break; default: break; @@ -1209,7 +1198,7 @@ static int action_ok_file_load(const char *path, if (rarch_task_push_content_load_default(NULL, full_path_new, true, CORE_TYPE_PLAIN, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return menu_cbs_exit(); } @@ -1958,7 +1947,7 @@ static int action_ok_start_core(const char *path, runloop_ctl(RUNLOOP_CTL_CLEAR_CONTENT_PATH, NULL); if (rarch_task_push_content_load_default(NULL, NULL, false, CORE_TYPE_PLAIN, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); } return 0; @@ -2039,7 +2028,7 @@ static int action_ok_load_archive(const char *path, event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); if (rarch_task_push_content_load_default( NULL, detect_content_path, false, CORE_TYPE_PLAIN, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return 0; } @@ -2084,7 +2073,7 @@ static int action_ok_load_archive_detect_core(const char *path, event_cmd_ctl(EVENT_CMD_LOAD_CORE, NULL); if (rarch_task_push_content_load_default(NULL, NULL, false, CORE_TYPE_PLAIN, NULL, NULL)) - action_ok_push_quick_menu(); + menu_driver_ctl(RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, NULL); return menu_cbs_exit(); case 0: return generic_action_ok_displaylist_push(path, label, type, diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index cc11efebc9..89014cd79a 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -94,6 +94,10 @@ int shader_action_parameter_right(unsigned type, const char *label, bool wraparo int shader_action_parameter_preset_right(unsigned type, const char *label, bool wraparound); +int generic_action_ok_displaylist_push(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx, + unsigned action_type); + int generic_action_cheat_toggle(size_t idx, unsigned type, const char *label, bool wraparound); diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 4664904510..7c9cfb6cea 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -258,6 +258,7 @@ static void menu_driver_toggle(bool latch) bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { static struct retro_system_info menu_driver_system; + static bool menu_driver_pending_quick_menu = false; static bool menu_driver_prevent_populate = false; static bool menu_driver_load_no_content = false; static bool menu_driver_alive = false; @@ -281,6 +282,14 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) *driver_data = menu_driver_data; } break; + case RARCH_MENU_CTL_IS_PENDING_QUICK_MENU: + return menu_driver_pending_quick_menu; + case RARCH_MENU_CTL_SET_PENDING_QUICK_MENU: + menu_driver_pending_quick_menu = true; + break; + case RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU: + menu_driver_pending_quick_menu = false; + break; case RARCH_MENU_CTL_IS_PENDING_QUIT: return menu_driver_pending_quit; case RARCH_MENU_CTL_SET_PENDING_QUIT: @@ -298,14 +307,15 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) menu_driver_pending_shutdown = false; break; case RARCH_MENU_CTL_DESTROY: - menu_driver_pending_quit = false; - menu_driver_pending_shutdown = false; - menu_driver_prevent_populate = false; - menu_driver_load_no_content = false; - menu_driver_alive = false; - menu_driver_data_own = false; - menu_driver_ctx = NULL; - menu_userdata = NULL; + menu_driver_pending_quick_menu = false; + menu_driver_pending_quit = false; + menu_driver_pending_shutdown = false; + menu_driver_prevent_populate = false; + menu_driver_load_no_content = false; + menu_driver_alive = false; + menu_driver_data_own = false; + menu_driver_ctx = NULL; + menu_userdata = NULL; break; case RARCH_MENU_CTL_PLAYLIST_FREE: if (menu_driver_playlist) @@ -787,6 +797,19 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { menu_ctx_iterate_t *iterate = (menu_ctx_iterate_t*)data; + if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, NULL)) + { + bool msg_force = true; + + menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU, NULL); + menu_entries_flush_stack(NULL, MENU_SETTINGS); + menu_display_ctl(MENU_DISPLAY_CTL_SET_MSG_FORCE, &msg_force); + + generic_action_ok_displaylist_push("", + "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); + return true; + } + if (menu_driver_ctl(RARCH_MENU_CTL_IS_PENDING_QUIT, NULL)) { menu_driver_ctl(RARCH_MENU_CTL_UNSET_PENDING_QUIT, NULL); diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 538cc2b5f4..9b17f58c48 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -107,6 +107,9 @@ enum rarch_menu_ctl_state RARCH_MENU_CTL_NAVIGATION_SET_LAST, RARCH_MENU_CTL_NAVIGATION_ASCEND_ALPHABET, RARCH_MENU_CTL_NAVIGATION_DESCEND_ALPHABET, + RARCH_MENU_CTL_IS_PENDING_QUICK_MENU, + RARCH_MENU_CTL_SET_PENDING_QUICK_MENU, + RARCH_MENU_CTL_UNSET_PENDING_QUICK_MENU, RARCH_MENU_CTL_IS_PENDING_QUIT, RARCH_MENU_CTL_SET_PENDING_QUIT, RARCH_MENU_CTL_UNSET_PENDING_QUIT,