diff --git a/menu/cbs/menu_cbs_info.c b/menu/cbs/menu_cbs_info.c index bd880cd83d..f6d673a212 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(void *data, unsigned type, const char *label) +static int action_info_default(unsigned type, const char *label) { menu_displaylist_info_t info; - menu_handle_t *menu = (menu_handle_t*)data; + menu_handle_t *menu = NULL; file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0); size_t selection = menu_navigation_get_selection(); @@ -45,6 +45,8 @@ static int action_info_default(void *data, 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; @@ -66,14 +68,15 @@ 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(void *data, - unsigned type, const char *label) +static int action_info_cheevos(unsigned type, const char *label) { - menu_handle_t *menu = (menu_handle_t*)data; + menu_handle_t *menu = NULL; 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 aa1d0c45f3..322d10ff0b 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(data, setting, + return menu_action_handle_setting(setting, setting_get_type(setting), MENU_ACTION_LEFT, wraparound); } @@ -743,8 +743,7 @@ static int bind_left_generic(void *data, unsigned type, const char *label, bool wraparound) { - return menu_setting_set(data, - type, label, MENU_ACTION_LEFT, wraparound); + return menu_setting_set(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 d19808ae75..a689c3ced4 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(data, type, label, MENU_ACTION_OK, false); + return menu_setting_set(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 e79fcc6809..80572ebf28 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(data, setting, + return menu_action_handle_setting(setting, setting_get_type(setting), MENU_ACTION_RIGHT, wraparound); } @@ -493,8 +493,7 @@ int bind_right_generic(void *data, unsigned type, const char *label, bool wraparound) { - return menu_setting_set(data, - type, label, MENU_ACTION_RIGHT, wraparound); + return menu_setting_set(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 6e5cf1d0b6..6f3e821e87 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -32,12 +32,11 @@ #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(void *data, - const char *path, const char *label, unsigned type, +static int action_select_default(const char *path, const char *label, unsigned type, size_t idx) { menu_entry_t entry; @@ -45,7 +44,6 @@ static int action_select_default(void *data, 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); @@ -97,7 +95,13 @@ static int action_select_default(void *data, } 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); @@ -106,76 +110,88 @@ static int action_select_default(void *data, return ret; } -static int action_select_path_use_directory( - void *data, - const char *path, +static int action_select_path_use_directory(const char *path, const char *label, unsigned type, size_t idx) { - return action_ok_path_use_directory((menu_handle_t*)data, + 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, path, label, type, idx, 0 /* unused */); } -static int action_select_driver_setting(void *data, - const char *path, +static int action_select_driver_setting(const char *path, const char *label, unsigned type, size_t idx) { - return bind_right_generic((menu_handle_t*)data, type, label, true); + 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); } -static int action_select_core_setting(void *data, - const char *path, +static int action_select_core_setting(const char *path, const char *label, unsigned type, size_t idx) { - return core_setting_right((menu_handle_t*)data, type, label, true); + 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); } -static int shader_action_parameter_select(void *data, - const char *path, +static int shader_action_parameter_select(const char *path, const char *label, unsigned type, size_t idx) { - return shader_action_parameter_right((menu_handle_t*)data, type, label, true); + 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); } -static int shader_action_parameter_preset_select( - void *data, const char *path, +static int shader_action_parameter_preset_select(const char *path, const char *label, unsigned type, size_t idx) { - return shader_action_parameter_right( - (menu_handle_t*)data, type, label, true); + 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); } -static int action_select_cheat(void *data, - const char *path, +static int action_select_cheat(const char *path, const char *label, unsigned type, size_t idx) { - return action_right_cheat((menu_handle_t*)data, type, label, true); + 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); } -static int action_select_input_desc(void *data, - const char *path, +static int action_select_input_desc(const char *path, const char *label, unsigned type, size_t idx) { - return action_right_input_desc((menu_handle_t*)data, type, label, true); + 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); } -static int action_select_input_desc_kbd(void *data, - const char *path, +static int action_select_input_desc_kbd(const char *path, const char *label, unsigned type, size_t idx) { - return action_right_input_desc_kbd((menu_handle_t*)data, type, label, true); + 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); } #ifdef HAVE_NETWORKING -static int action_select_netplay_connect_room( - void *data, - const char *path, +static int action_select_netplay_connect_room(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 b91093329e..399c49b490 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -45,19 +45,17 @@ #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(void *data, - unsigned type, const char *label) +static int action_start_remap_file_load(unsigned type, const char *label) { input_remapping_set_defaults(true); return 0; } -static int action_start_video_filter_file_load(void *data, - unsigned type, const char *label) +static int action_start_video_filter_file_load(unsigned type, const char *label) { settings_t *settings = config_get_ptr(); @@ -81,8 +79,7 @@ static int generic_action_start_performance_counters(struct retro_perf_counter * return 0; } -static int action_start_performance_counters_core(void *data, - unsigned type, const char *label) +static int action_start_performance_counters_core(unsigned type, const char *label) { struct retro_perf_counter **counters = retro_get_perf_counter_libretro(); unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN; @@ -90,8 +87,7 @@ static int action_start_performance_counters_core(void *data, return generic_action_start_performance_counters(counters, offset, type, label); } -static int action_start_performance_counters_frontend( - void *data, unsigned type, +static int action_start_performance_counters_frontend(unsigned type, const char *label) { struct retro_perf_counter **counters = retro_get_perf_counter_rarch(); @@ -99,8 +95,7 @@ static int action_start_performance_counters_frontend( return generic_action_start_performance_counters(counters, offset, type, label); } -static int action_start_input_desc(void *data, - unsigned type, const char *label) +static int action_start_input_desc(unsigned type, const char *label) { settings_t *settings = config_get_ptr(); unsigned inp_desc_index_offset = type - MENU_SETTINGS_INPUT_DESC_BEGIN; @@ -123,12 +118,11 @@ static int action_start_input_desc(void *data, } 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); @@ -143,12 +137,11 @@ static int action_start_shader_action_parameter( return menu_shader_manager_clear_parameter(parameter); } -static int action_start_shader_pass(void *data, - unsigned type, const char *label) +static int action_start_shader_pass(unsigned type, const char *label) { - menu_handle_t *menu = (menu_handle_t*)data; + menu_handle_t *menu = NULL; - if (!menu) + if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) return menu_cbs_exit(); menu->hack_shader_pass = type - MENU_SETTINGS_SHADER_PASS_0; @@ -159,8 +152,7 @@ static int action_start_shader_pass(void *data, } -static int action_start_shader_scale_pass(void *data, - unsigned type, const char *label) +static int action_start_shader_scale_pass(unsigned type, const char *label) { unsigned pass = type - MENU_SETTINGS_SHADER_PASS_SCALE_0; @@ -169,39 +161,32 @@ static int action_start_shader_scale_pass(void *data, return 0; } -static int action_start_shader_filter_pass(void *data, - unsigned type, const char *label) +static int action_start_shader_filter_pass(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(void *data, - unsigned type, const char *label) +static int action_start_netplay_mitm_server(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(void *data, - unsigned type, const char *label) +static int action_start_shader_watch_for_changes(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(void *data, - unsigned type, const char *label) +static int action_start_shader_num_passes(unsigned type, const char *label) { return menu_shader_manager_clear_num_passes(); } -static int action_start_cheat_num_passes(void *data, - unsigned type, const char *label) +static int action_start_cheat_num_passes(unsigned type, const char *label) { if (cheat_manager_get_size()) { @@ -213,8 +198,7 @@ static int action_start_cheat_num_passes(void *data, return 0; } -static int action_start_core_setting(void *data, - unsigned type, +static int action_start_core_setting(unsigned type, const char *label) { unsigned idx = type - MENU_SETTINGS_CORE_OPTION_START; @@ -226,8 +210,7 @@ static int action_start_core_setting(void *data, return 0; } -static int action_start_playlist_association(void *data, - unsigned type, const char *label) +static int action_start_playlist_association(unsigned type, const char *label) { int found; char new_playlist_cores[PATH_MAX_LENGTH]; @@ -262,8 +245,7 @@ static int action_start_playlist_association(void *data, return 0; } -static int action_start_video_resolution(void *data, - unsigned type, const char *label) +static int action_start_video_resolution(unsigned type, const char *label) { unsigned width = 0, height = 0; global_t *global = global_get_ptr(); @@ -286,9 +268,9 @@ static int action_start_video_resolution(void *data, return 0; } -static int action_start_lookup_setting(void *data, unsigned type, const char *label) +static int action_start_lookup_setting(unsigned type, const char *label) { - return menu_setting_set(data, type, label, MENU_ACTION_START, false); + return menu_setting_set(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 8d64746ff2..069c3ead24 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -103,8 +103,7 @@ 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)(void *data, - const char *path, const char *label, unsigned type, + int (*action_select)(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); @@ -115,8 +114,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)(void *data, unsigned type, const char *label); - int (*action_info)(void *data, unsigned type, const char *label); + int (*action_start)(unsigned type, const char *label); + int (*action_info)(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 335d75adc3..d1c46d6632 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -655,8 +655,7 @@ static int setting_handler(rarch_setting_t *setting, unsigned action) return -1; } -int menu_action_handle_setting(void *data, - rarch_setting_t *setting, +int menu_action_handle_setting(rarch_setting_t *setting, unsigned type, unsigned action, bool wraparound) { if (!setting) @@ -668,6 +667,7 @@ int menu_action_handle_setting(void *data, 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,8 +680,9 @@ int menu_action_handle_setting(void *data, info.directory_ptr = selection; info.list = menu_stack; - if (menu_displaylist_ctl(DISPLAYLIST_GENERIC, - &info, (menu_handle_t*)data)) + menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu); + + if (menu_displaylist_ctl(DISPLAYLIST_GENERIC, &info, menu)) menu_displaylist_process(&info); menu_displaylist_info_free(&info); @@ -813,8 +814,7 @@ int menu_setting_set_flags(rarch_setting_t *setting) return 0; } -int menu_setting_set(void *data, - unsigned type, const char *label, +int menu_setting_set(unsigned type, const char *label, unsigned action, bool wraparound) { int ret = 0; @@ -826,8 +826,7 @@ int menu_setting_set(void *data, if (!cbs) return 0; - ret = menu_action_handle_setting(data, - cbs->setting, + ret = menu_action_handle_setting(cbs->setting, type, action, wraparound); if (ret == -1) diff --git a/menu/menu_setting.h b/menu/menu_setting.h index a0e6a98bee..6fc32bdbfd 100644 --- a/menu/menu_setting.h +++ b/menu/menu_setting.h @@ -76,8 +76,7 @@ int menu_setting_generic(rarch_setting_t *setting, bool wraparound); int menu_setting_set_flags(rarch_setting_t *setting); -int menu_setting_set(void *data, - unsigned type, const char *label, +int menu_setting_set(unsigned type, const char *label, unsigned action, bool wraparound); /** @@ -121,12 +120,10 @@ 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(void *data, - rarch_setting_t *setting, +int menu_action_handle_setting(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 e7f26d8f7f..85175600cd 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(data, entry->type, entry->label); + ret = cbs->action_start(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(data, entry->type, entry->label); + ret = cbs->action_info(entry->type, entry->label); break; case MENU_ACTION_SELECT: if (cbs && cbs->action_select) - ret = cbs->action_select(data, entry->path, + ret = cbs->action_select(entry->path, entry->label, entry->type, i); break; case MENU_ACTION_SEARCH: