diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index d822a37e04..40072f0192 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -48,7 +48,7 @@ enum static int deferred_push_dlist(menu_displaylist_info_t *info, unsigned val) { if (menu_displaylist_push_list(info, val) != 0) - return -1; + return menu_cbs_exit(); menu_displaylist_push_list_process(info); return 0; } @@ -331,7 +331,7 @@ static int general_push(menu_displaylist_info_t *info, menu_handle_t *menu = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return menu_cbs_exit(); core_info_ctl(CORE_INFO_CTL_LIST_GET, &list); diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index a89e994e7a..9bafc1a5e2 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -102,7 +102,7 @@ static int action_left_scroll(unsigned type, const char *label, size_t scroll_accel = 0; unsigned scroll_speed = 0, fast_scroll_speed = 0; if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) - return -1; + return menu_cbs_exit(); if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel)) return false; @@ -139,7 +139,7 @@ static int action_left_mainmenu(unsigned type, const char *label, size_t list_size = menu_driver_list_get_size(MENU_LIST_PLAIN); if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return menu_cbs_exit(); if (list_size == 1) { @@ -194,10 +194,10 @@ static int action_left_shader_scale_pass(unsigned type, const char *label, menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) - return -1; + return menu_cbs_exit(); shader_pass = &shader->pass[pass]; if (!shader_pass) - return -1; + return menu_cbs_exit(); { unsigned current_scale = shader_pass->fbo.scale_x; @@ -224,10 +224,10 @@ static int action_left_shader_filter_pass(unsigned type, const char *label, menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) - return -1; + return menu_cbs_exit(); shader_pass = &shader->pass[pass]; if (!shader_pass) - return -1; + return menu_cbs_exit(); shader_pass->filter = ((shader_pass->filter + delta) % 3); #endif @@ -240,7 +240,7 @@ static int action_left_shader_filter_default(unsigned type, const char *label, #ifdef HAVE_SHADER_MANAGER rarch_setting_t *setting = menu_setting_find(menu_hash_to_str(MENU_LABEL_VIDEO_SMOOTH)); if (!setting) - return -1; + return menu_cbs_exit(); return menu_action_handle_setting(setting, menu_setting_get_type(setting), MENU_ACTION_LEFT, wraparound); #else @@ -273,7 +273,7 @@ static int action_left_shader_num_passes(unsigned type, const char *label, menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) - return -1; + return menu_cbs_exit(); if (shader->passes) shader->passes--; @@ -310,7 +310,7 @@ static int playlist_association_left(unsigned type, const char *label, core_info_ctl(CORE_INFO_CTL_LIST_GET, &list); if (!list) - return -1; + return menu_cbs_exit(); stnames = string_split(settings->playlist_names, ";"); stcores = string_split(settings->playlist_cores, ";"); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index abe9d37aa1..4792cf6ba7 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -107,11 +107,6 @@ 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) @@ -133,7 +128,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 action_ok_exit(); + return menu_cbs_exit(); menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL); @@ -439,7 +434,7 @@ static int generic_action_ok_displaylist_push(const char *path, ret = menu_displaylist_push_list(&info, dl_type); if (ret != 0) - return action_ok_exit(); + return menu_cbs_exit(); menu_displaylist_push_list_process(&info); return 0; @@ -470,7 +465,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 action_ok_exit(); + return menu_cbs_exit(); menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL); @@ -515,7 +510,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 action_ok_exit(); + return menu_cbs_exit(); case 0: return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); @@ -562,7 +557,7 @@ static int action_ok_file_load_detect_core(const char *path, false, CORE_TYPE_PLAIN, NULL, NULL)) { action_ok_push_quick_menu(); - return action_ok_exit(); + return menu_cbs_exit(); } return 0; @@ -586,9 +581,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 action_ok_exit(); + return menu_cbs_exit(); if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) - return action_ok_exit(); + return menu_cbs_exit(); switch (hash_label) { @@ -602,7 +597,7 @@ static int action_ok_playlist_entry(const char *path, menu->db_playlist_file, COLLECTION_SIZE); if (!tmp_playlist) - return action_ok_exit(); + return menu_cbs_exit(); } playlist = tmp_playlist; @@ -698,7 +693,7 @@ static int action_ok_playlist_entry(const char *path, "", 0, 0, 0, ACTION_OK_DL_CONTENT_SETTINGS); } - return action_ok_exit(); + return menu_cbs_exit(); } static int action_ok_cheat_apply_changes(const char *path, @@ -855,7 +850,7 @@ static int generic_action_ok(const char *path, return ret; error: - return action_ok_exit(); + return menu_cbs_exit(); } static int action_ok_set_path(const char *path, @@ -1078,7 +1073,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 action_ok_exit(); + return menu_cbs_exit(); menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); @@ -1102,7 +1097,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 action_ok_exit(); + return menu_cbs_exit(); } static int action_ok_core_load_deferred(const char *path, @@ -1111,13 +1106,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 action_ok_exit(); + return menu_cbs_exit(); if (rarch_task_push_content_load_default(path, menu->deferred_path, false, CORE_TYPE_PLAIN, NULL, NULL)) action_ok_push_quick_menu(); - return action_ok_exit(); + return menu_cbs_exit(); } static int action_ok_deferred_list_stub(const char *path, @@ -1183,7 +1178,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 action_ok_exit(); + return menu_cbs_exit(); menu_entries_get_last(menu_stack, &menu_path, &menu_label, NULL, NULL); @@ -1215,14 +1210,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 action_ok_exit(); + return menu_cbs_exit(); } static int generic_action_ok_command(enum event_command cmd) { if (!event_cmd_ctl(cmd, NULL)) - return action_ok_exit(); + return menu_cbs_exit(); return 0; } @@ -1230,7 +1225,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 action_ok_exit(); + return menu_cbs_exit(); return generic_action_ok_command(EVENT_CMD_RESUME); } @@ -1239,7 +1234,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 action_ok_exit(); + return menu_cbs_exit(); return generic_action_ok_command(EVENT_CMD_RESUME); } @@ -1652,7 +1647,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 action_ok_exit(); + return menu_cbs_exit(); event_cmd_ctl(EVENT_CMD_NETWORK_INIT, NULL); @@ -1729,7 +1724,7 @@ static int action_ok_rdb_entry_submenu(const char *path, struct string_list *str_list2 = NULL; if (!label) - return action_ok_exit(); + return menu_cbs_exit(); str_list = string_split(label, "|"); @@ -2033,7 +2028,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 action_ok_exit(); + return menu_cbs_exit(); menu_path = menu->scratch2_buf; content_path = menu->scratch_buf; @@ -2060,7 +2055,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 action_ok_exit(); + return menu_cbs_exit(); if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &idx)) return false; @@ -2090,7 +2085,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 action_ok_exit(); + return menu_cbs_exit(); case 0: return generic_action_ok_displaylist_push(path, label, type, idx, entry_idx, ACTION_OK_DL_DEFERRED_CORE_LIST); diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 67830b2e9a..54e041e8c7 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -44,7 +44,7 @@ static int generic_shader_action_parameter_right( unsigned type, const char *label, bool wraparound) { if (!shader) - return -1; + return menu_cbs_exit(); param->current += param->step; param->current = min(max(param->minimum, param->current), param->maximum); @@ -212,10 +212,10 @@ static int action_right_shader_scale_pass(unsigned type, const char *label, menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) - return -1; + return menu_cbs_exit(); shader_pass = &shader->pass[pass]; if (!shader_pass) - return -1; + return menu_cbs_exit(); { unsigned current_scale = shader_pass->fbo.scale_x; @@ -242,10 +242,10 @@ static int action_right_shader_filter_pass(unsigned type, const char *label, menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) - return -1; + return menu_cbs_exit(); shader_pass = &shader->pass[pass]; if (!shader_pass) - return -1; + return menu_cbs_exit(); shader_pass->filter = ((shader_pass->filter + delta) % 3); #endif @@ -258,7 +258,7 @@ static int action_right_shader_filter_default(unsigned type, const char *label, #ifdef HAVE_SHADER_MANAGER rarch_setting_t *setting = menu_setting_find(menu_hash_to_str(MENU_LABEL_VIDEO_SMOOTH)); if (!setting) - return -1; + return menu_cbs_exit(); return menu_action_handle_setting(setting, menu_setting_get_type(setting), MENU_ACTION_RIGHT, wraparound); #else @@ -290,7 +290,7 @@ static int action_right_shader_num_passes(unsigned type, const char *label, menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET, &shader); if (!shader) - return -1; + return menu_cbs_exit(); if ((shader->passes < GFX_MAX_SHADERS)) shader->passes++; @@ -325,7 +325,7 @@ static int playlist_association_right(unsigned type, const char *label, core_info_ctl(CORE_INFO_CTL_LIST_GET, &list); if (!list) - return -1; + return menu_cbs_exit(); stnames = string_split(settings->playlist_names, ";"); stcores = string_split(settings->playlist_cores, ";"); @@ -560,7 +560,7 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, uint32_t label_hash, uint32_t menu_label_hash) { if (!cbs) - return -1; + return menu_cbs_exit(); BIND_ACTION_RIGHT(cbs, bind_right_generic); @@ -584,5 +584,5 @@ int menu_cbs_init_bind_right(menu_file_list_cbs_t *cbs, if (menu_cbs_init_bind_right_compare_type(cbs, type, label_hash, menu_label_hash) == 0) return 0; - return -1; + return menu_cbs_exit(); } diff --git a/menu/cbs/menu_cbs_scan.c b/menu/cbs/menu_cbs_scan.c index 2b9b0bdba0..3c750d23aa 100644 --- a/menu/cbs/menu_cbs_scan.c +++ b/menu/cbs/menu_cbs_scan.c @@ -49,7 +49,7 @@ int action_scan_file(const char *path, menu_handle_t *menu = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return menu_cbs_exit(); menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL); @@ -69,7 +69,7 @@ int action_scan_directory(const char *path, menu_handle_t *menu = NULL; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return -1; + return menu_cbs_exit(); menu_entries_get_last_stack(&menu_path, &menu_label, NULL, NULL); diff --git a/menu/menu_cbs.c b/menu/menu_cbs.c index 7f28b9ff4d..89f36095b0 100644 --- a/menu/menu_cbs.c +++ b/menu/menu_cbs.c @@ -144,3 +144,8 @@ error: string_list_free(str_list); str_list = NULL; } + +int menu_cbs_exit(void) +{ + return -1; +} diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 54fb38e4e2..cc11efebc9 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -213,4 +213,6 @@ void menu_cbs_init(void *data, bool menu_playlist_find_associated_core(const char *path, char *s, size_t len); +int menu_cbs_exit(void); + #endif