From da590b00a88b0a74fa74a5a0e65dd77729928f82 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Feb 2016 21:38:51 +0100 Subject: [PATCH] Add action_ok_exit --- menu/cbs/menu_cbs_ok.c | 53 +++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index a798dfd038..abe9d37aa1 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -107,6 +107,11 @@ finish: } #endif +static int action_ok_exit(void) +{ + return -1; +} + static int generic_action_ok_displaylist_push(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx, unsigned action_type) @@ -128,7 +133,7 @@ static int generic_action_ok_displaylist_push(const char *path, file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL); @@ -434,7 +439,7 @@ static int generic_action_ok_displaylist_push(const char *path, ret = menu_displaylist_push_list(&info, dl_type); if (ret != 0) - return -1; + return action_ok_exit(); menu_displaylist_push_list_process(&info); return 0; @@ -465,7 +470,7 @@ static int file_load_with_detect_core_wrapper(size_t idx, size_t entry_idx, core_info_list_t *list = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL); @@ -510,7 +515,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(); - return -1; + return action_ok_exit(); case 0: return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); @@ -557,7 +562,7 @@ static int action_ok_file_load_detect_core(const char *path, false, CORE_TYPE_PLAIN, NULL, NULL)) { action_ok_push_quick_menu(); - return -1; + return action_ok_exit(); } return 0; @@ -581,9 +586,9 @@ static int action_ok_playlist_entry(const char *path, uint32_t hash_label = menu_hash_calculate(label); if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) - return -1; + return action_ok_exit(); switch (hash_label) { @@ -597,7 +602,7 @@ static int action_ok_playlist_entry(const char *path, menu->db_playlist_file, COLLECTION_SIZE); if (!tmp_playlist) - return -1; + return action_ok_exit(); } playlist = tmp_playlist; @@ -693,7 +698,7 @@ static int action_ok_playlist_entry(const char *path, "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); } - return -1; + return action_ok_exit(); } static int action_ok_cheat_apply_changes(const char *path, @@ -850,7 +855,7 @@ static int generic_action_ok(const char *path, return ret; error: - return -1; + return action_ok_exit(); } static int action_ok_set_path(const char *path, @@ -1073,7 +1078,7 @@ static int action_ok_core_deferred_set(const char *path, content_playlist_t *playlist = NULL; if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) - return -1; + return action_ok_exit(); menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); @@ -1097,7 +1102,7 @@ static int action_ok_core_deferred_set(const char *path, menu_entries_pop_stack(&selection, 0); menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection); - return -1; + return action_ok_exit(); } static int action_ok_core_load_deferred(const char *path, @@ -1106,13 +1111,13 @@ static int action_ok_core_load_deferred(const char *path, menu_handle_t *menu = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); if (rarch_task_push_content_load_default(path, menu->deferred_path, false, CORE_TYPE_PLAIN, NULL, NULL)) action_ok_push_quick_menu(); - return -1; + return action_ok_exit(); } static int action_ok_deferred_list_stub(const char *path, @@ -1178,7 +1183,7 @@ static int action_ok_file_load(const char *path, file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); menu_entries_get_last(menu_stack, &menu_path, &menu_label, NULL, NULL); @@ -1210,14 +1215,14 @@ 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(); - return -1; + return action_ok_exit(); } static int generic_action_ok_command(enum event_command cmd) { if (!event_cmd_ctl(cmd, NULL)) - return -1; + return action_ok_exit(); return 0; } @@ -1225,7 +1230,7 @@ static int action_ok_load_state(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { if (generic_action_ok_command(EVENT_CMD_LOAD_STATE) == -1) - return -1; + return action_ok_exit(); return generic_action_ok_command(EVENT_CMD_RESUME); } @@ -1234,7 +1239,7 @@ static int action_ok_save_state(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { if (generic_action_ok_command(EVENT_CMD_SAVE_STATE) == -1) - return -1; + return action_ok_exit(); return generic_action_ok_command(EVENT_CMD_RESUME); } @@ -1647,7 +1652,7 @@ static int generic_action_ok_network(const char *path, menu_entries_ctl(MENU_ENTRIES_CTL_SET_REFRESH, &refresh); if (string_is_empty(settings->network.buildbot_url)) - return -1; + return action_ok_exit(); event_cmd_ctl(EVENT_CMD_NETWORK_INIT, NULL); @@ -1724,7 +1729,7 @@ static int action_ok_rdb_entry_submenu(const char *path, struct string_list *str_list2 = NULL; if (!label) - return -1; + return action_ok_exit(); str_list = string_split(label, "|"); @@ -2028,7 +2033,7 @@ static int action_ok_load_archive(const char *path, const char *content_path = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); menu_path = menu->scratch2_buf; content_path = menu->scratch_buf; @@ -2055,7 +2060,7 @@ static int action_ok_load_archive_detect_core(const char *path, const char *content_path = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return action_ok_exit(); if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &idx)) return false; @@ -2085,7 +2090,7 @@ static int action_ok_load_archive_detect_core(const char *path, if (rarch_task_push_content_load_default(NULL, NULL, false, CORE_TYPE_PLAIN, NULL, NULL)) action_ok_push_quick_menu(); - return -1; + return action_ok_exit(); case 0: return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST);