From 07f46bad2bbd60cf14e1216894cc127aef260a5b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 1 Sep 2020 00:42:24 +0200 Subject: [PATCH] Remove unused event loop glue functions for menu entries --- menu/menu_entries.h | 40 +----- retroarch.c | 287 -------------------------------------------- 2 files changed, 2 insertions(+), 325 deletions(-) diff --git a/menu/menu_entries.h b/menu/menu_entries.h index 7e79d6ef35..bfe959f2a1 100644 --- a/menu/menu_entries.h +++ b/menu/menu_entries.h @@ -155,7 +155,6 @@ typedef struct menu_entry bool sublabel_enabled; } menu_entry_t; - int menu_entries_get_title(char *title, size_t title_len); int menu_entries_get_core_title(char *title_msg, size_t title_msg_len); @@ -184,7 +183,8 @@ void menu_entries_get_at_offset(const file_list_t *list, size_t idx, const char **path, const char **label, unsigned *file_type, size_t *entry_idx, const char **alt); -void menu_entries_prepend(file_list_t *list, const char *path, const char *label, +void menu_entries_prepend(file_list_t *list, + const char *path, const char *label, enum msg_hash_enums enum_idx, unsigned type, size_t directory_ptr, size_t entry_idx); @@ -198,49 +198,13 @@ bool menu_entries_ctl(enum menu_entries_ctl_state state, void *data); void menu_entries_set_checked(file_list_t *list, size_t entry_idx, bool checked); -enum menu_entry_type menu_entry_get_type(uint32_t i); - -uint32_t menu_entry_get_bool_value(uint32_t i); - -struct string_list *menu_entry_enum_values(uint32_t i); - -void menu_entry_enum_set_value_with_string(uint32_t i, const char *s); - -int32_t menu_entry_bind_index(uint32_t i); - -void menu_entry_bind_key_set(uint32_t i, int32_t value); - -void menu_entry_bind_joykey_set(uint32_t i, int32_t value); - -void menu_entry_bind_joyaxis_set(uint32_t i, int32_t value); - -void menu_entry_pathdir_selected(uint32_t i); - -bool menu_entry_pathdir_allow_empty(uint32_t i); - -uint32_t menu_entry_pathdir_for_directory(uint32_t i); - -void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len); - -void menu_entry_reset(uint32_t i); - void menu_entry_get_rich_label(menu_entry_t *entry, const char **rich_label); void menu_entry_get_value(menu_entry_t *entry, const char **value); -void menu_entry_set_value(uint32_t i, const char *s); - -uint32_t menu_entry_num_has_range(uint32_t i); - -float menu_entry_num_min(uint32_t i); - -float menu_entry_num_max(uint32_t i); - void menu_entry_get(menu_entry_t *entry, size_t stack_idx, size_t i, void *userdata, bool use_representation); -int menu_entry_select(uint32_t i); - int menu_entry_action( menu_entry_t *entry, size_t i, enum menu_action action); diff --git a/retroarch.c b/retroarch.c index 6663e1a7e1..2a2f9fecc5 100644 --- a/retroarch.c +++ b/retroarch.c @@ -4946,58 +4946,6 @@ void menu_navigation_set_selection(size_t val) * notify_list_loaded on the UI companion. */ -enum menu_entry_type menu_entry_get_type(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = NULL; - rarch_setting_t *setting = NULL; - - /* FIXME/TODO - XXX Really a special kind of ST_ACTION, - * but this should be changed */ - if (menu_setting_ctl(MENU_SETTING_CTL_IS_OF_PATH_TYPE, (void*)setting)) - return MENU_ENTRY_PATH; - - cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - setting = cbs ? cbs->setting : NULL; - - if (setting) - { - switch (setting->type) - { - case ST_BOOL: - return MENU_ENTRY_BOOL; - case ST_BIND: - return MENU_ENTRY_BIND; - case ST_INT: - return MENU_ENTRY_INT; - case ST_UINT: - return MENU_ENTRY_UINT; - case ST_SIZE: - return MENU_ENTRY_SIZE; - case ST_FLOAT: - return MENU_ENTRY_FLOAT; - case ST_PATH: - return MENU_ENTRY_PATH; - case ST_DIR: - return MENU_ENTRY_DIR; - case ST_STRING_OPTIONS: - return MENU_ENTRY_ENUM; - case ST_STRING: - return MENU_ENTRY_STRING; - case ST_HEX: - return MENU_ENTRY_HEX; - - default: - break; - } - } - - return MENU_ENTRY_ACTION; -} - void menu_entry_init(menu_entry_t *entry) { entry->path[0] = '\0'; @@ -5029,168 +4977,6 @@ void menu_entry_get_rich_label(menu_entry_t *entry, const char **rich_label) *rich_label = entry->path; } -uint32_t menu_entry_get_bool_value(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - bool *ptr = setting ? (bool*)setting->value.target.boolean : NULL; - if (!ptr) - return 0; - return *ptr; -} - -struct string_list *menu_entry_enum_values(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - const char *values = setting ? setting->values : NULL; - - if (!values) - return NULL; - return string_split(values, "|"); -} - -void menu_entry_enum_set_value_with_string(uint32_t i, const char *s) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - setting_set_with_string_representation(setting, s); -} - -int32_t menu_entry_bind_index(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - - if (setting) - return setting->index - 1; - return 0; -} - -void menu_entry_bind_key_set(uint32_t i, int32_t value) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - struct retro_keybind *keybind = setting ? (struct retro_keybind*)setting->value.target.keybind : NULL; - if (keybind) - keybind->key = (enum retro_key)value; -} - -void menu_entry_bind_joykey_set(uint32_t i, int32_t value) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - struct retro_keybind *keybind = setting ? (struct retro_keybind*)setting->value.target.keybind : NULL; - if (keybind) - keybind->joykey = value; -} - -void menu_entry_bind_joyaxis_set(uint32_t i, int32_t value) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - struct retro_keybind *keybind = setting ? (struct retro_keybind*)setting->value.target.keybind : NULL; - if (keybind) - keybind->joyaxis = value; -} - -void menu_entry_pathdir_selected(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - - if (menu_setting_ctl(MENU_SETTING_CTL_IS_OF_PATH_TYPE, (void*)setting)) - menu_setting_ctl(MENU_SETTING_CTL_ACTION_RIGHT, setting); -} - -bool menu_entry_pathdir_allow_empty(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - uint64_t flags = setting ? setting->flags : 0; - - return flags & SD_FLAG_ALLOW_EMPTY; -} - -uint32_t menu_entry_pathdir_for_directory(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - uint64_t flags = setting ? setting->flags : 0; - - return flags & SD_FLAG_PATH_DIR; -} - -void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - const char *values = setting ? setting->values : NULL; - - if (!values) - return; - - strlcpy(s, values, len); -} - -void menu_entry_reset(uint32_t i) -{ - menu_entry_t entry; - struct rarch_state *p_rarch = &rarch_st; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - if ( p_rarch->menu_driver_ctx - && p_rarch->menu_driver_ctx->entry_action) - p_rarch->menu_driver_ctx->entry_action( - p_rarch->menu_userdata, &entry, (size_t)i, MENU_ACTION_START); -} - void menu_entry_get_value(menu_entry_t *entry, const char **value) { if (!entry || !value) @@ -5202,54 +4988,6 @@ void menu_entry_get_value(menu_entry_t *entry, const char **value) *value = entry->value; } -void menu_entry_set_value(uint32_t i, const char *s) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - setting_set_with_string_representation(setting, s); -} - -uint32_t menu_entry_num_has_range(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - uint64_t flags = setting ? setting->flags : 0; - - return (flags & SD_FLAG_HAS_RANGE); -} - -float menu_entry_num_min(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - double min = setting ? setting->min : 0.0f; - return (float)min; -} - -float menu_entry_num_max(uint32_t i) -{ - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - file_list_t *selection_buf = MENU_ENTRIES_GET_SELECTION_BUF_PTR_INTERNAL(0); - menu_file_list_cbs_t *cbs = selection_buf ? - (menu_file_list_cbs_t*)selection_buf->list[i].actiondata : NULL; - rarch_setting_t *setting = cbs ? cbs->setting : NULL; - double max = setting ? setting->max : 0.00f; - return (float)max; -} - void menu_entry_get(menu_entry_t *entry, size_t stack_idx, size_t i, void *userdata, bool use_representation) { @@ -5369,31 +5107,6 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, } } -/* Performs whatever actions are associated with menu entry 'i'. - * - * This is the most important function because it does all the work - * associated with clicking on things in the UI. - * - * This includes loading cores and updating the - * currently displayed menu. */ -int menu_entry_select(uint32_t i) -{ - menu_entry_t entry; - struct rarch_state *p_rarch = &rarch_st; - struct menu_state *menu_st = &p_rarch->menu_driver_state; - - menu_st->selection_ptr = i; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, false); - - if ( p_rarch->menu_driver_ctx - && p_rarch->menu_driver_ctx->entry_action) - return p_rarch->menu_driver_ctx->entry_action( - p_rarch->menu_userdata, &entry, (size_t)i, MENU_ACTION_SELECT); - return -1; -} - int menu_entry_action( menu_entry_t *entry, size_t i, enum menu_action action) {