diff --git a/menu/cbs/menu_cbs_info.c b/menu/cbs/menu_cbs_info.c index f6d673a212..bd880cd83d 100644 --- a/menu/cbs/menu_cbs_info.c +++ b/menu/cbs/menu_cbs_info.c @@ -30,10 +30,10 @@ #include "../../network/netplay/netplay_discovery.h" #endif -static int action_info_default(unsigned type, const char *label) +static int action_info_default(void *data, unsigned type, const char *label) { menu_displaylist_info_t info; - menu_handle_t *menu = NULL; + menu_handle_t *menu = (menu_handle_t*)data; file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); size_t selection = menu_navigation_get_selection(); @@ -45,8 +45,6 @@ static int action_info_default(unsigned type, const char *label) info.label = strdup( msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN)); - menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); - if (!menu_displaylist_ctl(DISPLAYLIST_HELP, &info, menu)) goto error; @@ -68,15 +66,14 @@ int generic_action_ok_help(void *data, const char *label, unsigned type, size_t idx, size_t entry_idx, enum msg_hash_enums id, enum menu_dialog_type id2); -static int action_info_cheevos(unsigned type, const char *label) +static int action_info_cheevos(void *data, + unsigned type, const char *label) { - menu_handle_t *menu = NULL; + menu_handle_t *menu = (menu_handle_t*)data; unsigned new_id = type - MENU_SETTINGS_CHEEVOS_START; menu_dialog_set_current_id(new_id); - menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); - return generic_action_ok_help(menu, NULL, label, new_id, 0, 0, MENU_ENUM_LABEL_CHEEVOS_DESCRIPTION, MENU_DIALOG_HELP_CHEEVOS_DESCRIPTION); diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 322d10ff0b..aa1d0c45f3 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -553,7 +553,7 @@ static int action_left_shader_filter_default(void *data, MENU_ENUM_LABEL_VIDEO_SMOOTH); if (!setting) return menu_cbs_exit(); - return menu_action_handle_setting(setting, + return menu_action_handle_setting(data, setting, setting_get_type(setting), MENU_ACTION_LEFT, wraparound); } @@ -743,7 +743,8 @@ static int bind_left_generic(void *data, unsigned type, const char *label, bool wraparound) { - return menu_setting_set(type, label, MENU_ACTION_LEFT, wraparound); + return menu_setting_set(data, + type, label, MENU_ACTION_LEFT, wraparound); } static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index a689c3ced4..d19808ae75 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1761,7 +1761,7 @@ static int action_ok_lookup_setting(void *data, const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { - return menu_setting_set(type, label, MENU_ACTION_OK, false); + return menu_setting_set(data, type, label, MENU_ACTION_OK, false); } static int action_ok_audio_add_to_mixer(void *data, diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 80572ebf28..e79fcc6809 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -312,7 +312,7 @@ static int action_right_shader_filter_default(void *data, rarch_setting_t *setting = menu_setting_find_enum(MENU_ENUM_LABEL_VIDEO_SMOOTH); if (!setting) return menu_cbs_exit(); - return menu_action_handle_setting(setting, + return menu_action_handle_setting(data, setting, setting_get_type(setting), MENU_ACTION_RIGHT, wraparound); } @@ -493,7 +493,8 @@ int bind_right_generic(void *data, unsigned type, const char *label, bool wraparound) { - return menu_setting_set(type, label, MENU_ACTION_RIGHT, wraparound); + return menu_setting_set(data, + type, label, MENU_ACTION_RIGHT, wraparound); } static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 6f3e821e87..6e5cf1d0b6 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -32,11 +32,12 @@ #ifndef BIND_ACTION_SELECT #define BIND_ACTION_SELECT(cbs, name) \ - cbs->action_select = name; \ + cbs->action_select = name; \ cbs->action_select_ident = #name; #endif -static int action_select_default(const char *path, const char *label, unsigned type, +static int action_select_default(void *data, + const char *path, const char *label, unsigned type, size_t idx) { menu_entry_t entry; @@ -44,6 +45,7 @@ static int action_select_default(const char *path, const char *label, unsigned t enum menu_action action = MENU_ACTION_NOOP; menu_file_list_cbs_t *cbs = NULL; file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); + menu_handle_t *menu = (menu_handle_t*)data; menu_entry_init(&entry); menu_entry_get(&entry, 0, idx, NULL, false); @@ -95,13 +97,7 @@ static int action_select_default(const char *path, const char *label, unsigned t } if (action != MENU_ACTION_NOOP) - { - menu_handle_t *menu = NULL; - - menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); - ret = menu_entry_action(&entry, menu, (unsigned)idx, action); - } menu_entry_free(&entry); @@ -110,88 +106,76 @@ static int action_select_default(const char *path, const char *label, unsigned t return ret; } -static int action_select_path_use_directory(const char *path, +static int action_select_path_use_directory( + void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return action_ok_path_use_directory(menu, + return action_ok_path_use_directory((menu_handle_t*)data, path, label, type, idx, 0 /* unused */); } -static int action_select_driver_setting(const char *path, +static int action_select_driver_setting(void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return bind_right_generic(menu, type, label, true); + return bind_right_generic((menu_handle_t*)data, type, label, true); } -static int action_select_core_setting(const char *path, +static int action_select_core_setting(void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return core_setting_right(menu, type, label, true); + return core_setting_right((menu_handle_t*)data, type, label, true); } -static int shader_action_parameter_select(const char *path, +static int shader_action_parameter_select(void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return shader_action_parameter_right(menu, type, label, true); + return shader_action_parameter_right((menu_handle_t*)data, type, label, true); } -static int shader_action_parameter_preset_select(const char *path, +static int shader_action_parameter_preset_select( + void *data, const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return shader_action_parameter_right(menu, type, label, true); + return shader_action_parameter_right( + (menu_handle_t*)data, type, label, true); } -static int action_select_cheat(const char *path, +static int action_select_cheat(void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return action_right_cheat(menu, type, label, true); + return action_right_cheat((menu_handle_t*)data, type, label, true); } -static int action_select_input_desc(const char *path, +static int action_select_input_desc(void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return action_right_input_desc(menu, type, label, true); + return action_right_input_desc((menu_handle_t*)data, type, label, true); } -static int action_select_input_desc_kbd(const char *path, +static int action_select_input_desc_kbd(void *data, + const char *path, const char *label, unsigned type, size_t idx) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); - return action_right_input_desc_kbd(menu, type, label, true); + return action_right_input_desc_kbd((menu_handle_t*)data, type, label, true); } #ifdef HAVE_NETWORKING -static int action_select_netplay_connect_room(const char *path, +static int action_select_netplay_connect_room( + void *data, + const char *path, const char *label, unsigned type, size_t idx) { diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 399c49b490..b91093329e 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -45,17 +45,19 @@ #ifndef BIND_ACTION_START #define BIND_ACTION_START(cbs, name) \ - cbs->action_start = name; \ + cbs->action_start = name; \ cbs->action_start_ident = #name; #endif -static int action_start_remap_file_load(unsigned type, const char *label) +static int action_start_remap_file_load(void *data, + unsigned type, const char *label) { input_remapping_set_defaults(true); return 0; } -static int action_start_video_filter_file_load(unsigned type, const char *label) +static int action_start_video_filter_file_load(void *data, + unsigned type, const char *label) { settings_t *settings = config_get_ptr(); @@ -79,7 +81,8 @@ static int generic_action_start_performance_counters(struct retro_perf_counter * return 0; } -static int action_start_performance_counters_core(unsigned type, const char *label) +static int action_start_performance_counters_core(void *data, + unsigned type, const char *label) { struct retro_perf_counter **counters = retro_get_perf_counter_libretro(); unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN; @@ -87,7 +90,8 @@ static int action_start_performance_counters_core(unsigned type, const char *lab return generic_action_start_performance_counters(counters, offset, type, label); } -static int action_start_performance_counters_frontend(unsigned type, +static int action_start_performance_counters_frontend( + void *data, unsigned type, const char *label) { struct retro_perf_counter **counters = retro_get_perf_counter_rarch(); @@ -95,7 +99,8 @@ static int action_start_performance_counters_frontend(unsigned type, return generic_action_start_performance_counters(counters, offset, type, label); } -static int action_start_input_desc(unsigned type, const char *label) +static int action_start_input_desc(void *data, + unsigned type, const char *label) { settings_t *settings = config_get_ptr(); unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; @@ -118,11 +123,12 @@ static int action_start_input_desc(unsigned type, const char *label) } static int action_start_shader_action_parameter( + void *data, unsigned type, const char *label) { video_shader_ctx_t shader_info; struct video_shader_parameter *param = NULL; - unsigned parameter = type - MENU_SETTINGS_SHADER_PARAMETER_0; + unsigned parameter = type - MENU_SETTINGS_SHADER_PARAMETER_0; video_shader_driver_get_current_shader(&shader_info); @@ -137,11 +143,12 @@ static int action_start_shader_action_parameter( return menu_shader_manager_clear_parameter(parameter); } -static int action_start_shader_pass(unsigned type, const char *label) +static int action_start_shader_pass(void *data, + unsigned type, const char *label) { - menu_handle_t *menu = NULL; + menu_handle_t *menu = (menu_handle_t*)data; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) + if (!menu) return menu_cbs_exit(); menu->hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; @@ -152,7 +159,8 @@ static int action_start_shader_pass(unsigned type, const char *label) } -static int action_start_shader_scale_pass(unsigned type, const char *label) +static int action_start_shader_scale_pass(void *data, + unsigned type, const char *label) { unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0; @@ -161,32 +169,39 @@ static int action_start_shader_scale_pass(unsigned type, const char *label) return 0; } -static int action_start_shader_filter_pass(unsigned type, const char *label) +static int action_start_shader_filter_pass(void *data, + unsigned type, const char *label) { unsigned pass = type - MENU_SETTINGS_SHADER_PASS_FILTER_0; return menu_shader_manager_clear_pass_filter(pass); } -static int action_start_netplay_mitm_server(unsigned type, const char *label) +static int action_start_netplay_mitm_server(void *data, + unsigned type, const char *label) { settings_t *settings = config_get_ptr(); - strlcpy(settings->arrays.netplay_mitm_server, netplay_mitm_server, sizeof(settings->arrays.netplay_mitm_server)); + strlcpy(settings->arrays.netplay_mitm_server, + netplay_mitm_server, + sizeof(settings->arrays.netplay_mitm_server)); return 0; } -static int action_start_shader_watch_for_changes(unsigned type, const char *label) +static int action_start_shader_watch_for_changes(void *data, + unsigned type, const char *label) { settings_t *settings = config_get_ptr(); settings->bools.video_shader_watch_files = video_shader_watch_files; return 0; } -static int action_start_shader_num_passes(unsigned type, const char *label) +static int action_start_shader_num_passes(void *data, + unsigned type, const char *label) { return menu_shader_manager_clear_num_passes(); } -static int action_start_cheat_num_passes(unsigned type, const char *label) +static int action_start_cheat_num_passes(void *data, + unsigned type, const char *label) { if (cheat_manager_get_size()) { @@ -198,7 +213,8 @@ static int action_start_cheat_num_passes(unsigned type, const char *label) return 0; } -static int action_start_core_setting(unsigned type, +static int action_start_core_setting(void *data, + unsigned type, const char *label) { unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START; @@ -210,7 +226,8 @@ static int action_start_core_setting(unsigned type, return 0; } -static int action_start_playlist_association(unsigned type, const char *label) +static int action_start_playlist_association(void *data, + unsigned type, const char *label) { int found; char new_playlist_cores[PATH_MAX_LENGTH]; @@ -245,7 +262,8 @@ static int action_start_playlist_association(unsigned type, const char *label) return 0; } -static int action_start_video_resolution(unsigned type, const char *label) +static int action_start_video_resolution(void *data, + unsigned type, const char *label) { unsigned width = 0, height = 0; global_t *global = global_get_ptr(); @@ -268,9 +286,9 @@ static int action_start_video_resolution(unsigned type, const char *label) return 0; } -static int action_start_lookup_setting(unsigned type, const char *label) +static int action_start_lookup_setting(void *data, unsigned type, const char *label) { - return menu_setting_set(type, label, MENU_ACTION_START, false); + return menu_setting_set(data, type, label, MENU_ACTION_START, false); } static int menu_cbs_init_bind_start_compare_label(menu_file_list_cbs_t *cbs) diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 069c3ead24..8d64746ff2 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -103,7 +103,8 @@ typedef struct menu_file_list_cbs int (*action_iterate)(const char *label, unsigned action); int (*action_deferred_push)(menu_displaylist_info_t *info, void *data); - int (*action_select)(const char *path, const char *label, unsigned type, + int (*action_select)(void *data, + const char *path, const char *label, unsigned type, size_t idx); int (*action_get_title)(const char *path, const char *label, unsigned type, char *s, size_t len); @@ -114,8 +115,8 @@ typedef struct menu_file_list_cbs size_t idx); int (*action_scan)(const char *path, const char *label, unsigned type, size_t idx); - int (*action_start)(unsigned type, const char *label); - int (*action_info)(unsigned type, const char *label); + int (*action_start)(void *data, unsigned type, const char *label); + int (*action_info)(void *data, unsigned type, const char *label); int (*action_content_list_switch)(void *data, void *data2, void *userdata, const char *path, const char *label, unsigned type); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index d1c46d6632..335d75adc3 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -655,7 +655,8 @@ static int setting_handler(rarch_setting_t *setting, unsigned action) return -1; } -int menu_action_handle_setting(rarch_setting_t *setting, +int menu_action_handle_setting(void *data, + rarch_setting_t *setting, unsigned type, unsigned action, bool wraparound) { if (!setting) @@ -667,7 +668,6 @@ int menu_action_handle_setting(rarch_setting_t *setting, if (action == MENU_ACTION_OK) { menu_displaylist_info_t info; - menu_handle_t *menu = NULL; file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); const char *name = setting->name; size_t selection = menu_navigation_get_selection(); @@ -680,9 +680,8 @@ int menu_action_handle_setting(rarch_setting_t *setting, info.directory_ptr = selection; info.list = menu_stack; - menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); - - if (menu_displaylist_ctl(DISPLAYLIST_GENERIC, &info, menu)) + if (menu_displaylist_ctl(DISPLAYLIST_GENERIC, + &info, (menu_handle_t*)data)) menu_displaylist_process(&info); menu_displaylist_info_free(&info); @@ -814,7 +813,8 @@ int menu_setting_set_flags(rarch_setting_t *setting) return 0; } -int menu_setting_set(unsigned type, const char *label, +int menu_setting_set(void *data, + unsigned type, const char *label, unsigned action, bool wraparound) { int ret = 0; @@ -826,7 +826,8 @@ int menu_setting_set(unsigned type, const char *label, if (!cbs) return 0; - ret = menu_action_handle_setting(cbs->setting, + ret = menu_action_handle_setting(data, + cbs->setting, type, action, wraparound); if (ret == -1) diff --git a/menu/menu_setting.h b/menu/menu_setting.h index 6fc32bdbfd..a0e6a98bee 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -76,7 +76,8 @@ int menu_setting_generic(rarch_setting_t *setting, bool wraparound); int menu_setting_set_flags(rarch_setting_t *setting); -int menu_setting_set(unsigned type, const char *label, +int menu_setting_set(void *data, + unsigned type, const char *label, unsigned action, bool wraparound); /** @@ -120,10 +121,12 @@ void menu_setting_get_label(void *data, char *s, size_t len, unsigned *w, unsigned type, const char *menu_label, const char *label, unsigned idx); -int menu_action_handle_setting(rarch_setting_t *setting, +int menu_action_handle_setting(void *data, + rarch_setting_t *setting, unsigned type, unsigned action, bool wraparound); -enum setting_type menu_setting_get_browser_selection_type(rarch_setting_t *setting); +enum setting_type menu_setting_get_browser_selection_type( + rarch_setting_t *setting); void *setting_get_ptr(rarch_setting_t *setting); diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 85175600cd..e7f26d8f7f 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -462,7 +462,7 @@ int menu_entry_action(menu_entry_t *entry, break; case MENU_ACTION_START: if (cbs && cbs->action_start) - ret = cbs->action_start(entry->type, entry->label); + ret = cbs->action_start(data, entry->type, entry->label); break; case MENU_ACTION_LEFT: if (cbs && cbs->action_left) @@ -474,11 +474,11 @@ int menu_entry_action(menu_entry_t *entry, break; case MENU_ACTION_INFO: if (cbs && cbs->action_info) - ret = cbs->action_info(entry->type, entry->label); + ret = cbs->action_info(data, entry->type, entry->label); break; case MENU_ACTION_SELECT: if (cbs && cbs->action_select) - ret = cbs->action_select(entry->path, + ret = cbs->action_select(data, entry->path, entry->label, entry->type, i); break; case MENU_ACTION_SEARCH: