mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-26 12:48:27 +00:00
Turn menu_entry_init into macro
This commit is contained in:
parent
2e87e3bc64
commit
80e4524878
@ -94,7 +94,7 @@ static int action_select_default(
|
||||
if (action != MENU_ACTION_NOOP)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
|
||||
/* Note: If menu_entry_action() is modified,
|
||||
* will have to verify that these parameters
|
||||
|
@ -2668,7 +2668,7 @@ static unsigned materialui_count_sublabel_lines(
|
||||
wrapped_sublabel_str[0] = '\0';
|
||||
|
||||
/* Get entry sublabel */
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
@ -4931,7 +4931,7 @@ static void materialui_render_menu_list(
|
||||
break;
|
||||
|
||||
/* Get current entry */
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.value_enabled = entry_value_enabled;
|
||||
entry.sublabel_enabled = entry_sublabel_enabled;
|
||||
@ -6060,7 +6060,7 @@ static void materialui_show_fullscreen_thumbnails(
|
||||
mui->fullscreen_thumbnail_label[0] = '\0';
|
||||
|
||||
/* > Get menu entry */
|
||||
menu_entry_init(&selected_entry);
|
||||
MENU_ENTRY_INIT(selected_entry);
|
||||
selected_entry.path_enabled = false;
|
||||
selected_entry.value_enabled = false;
|
||||
selected_entry.sublabel_enabled = false;
|
||||
@ -8791,7 +8791,7 @@ static int materialui_menu_entry_action(
|
||||
/* Selection has changed - must update entry
|
||||
* pointer (we could probably get away without
|
||||
* doing this, but it would break the API...) */
|
||||
menu_entry_init(&new_entry);
|
||||
MENU_ENTRY_INIT(new_entry);
|
||||
new_entry.path_enabled = false;
|
||||
new_entry.label_enabled = false;
|
||||
new_entry.rich_label_enabled = false;
|
||||
@ -9186,7 +9186,7 @@ static int materialui_pointer_up_swipe_horz_default(
|
||||
menu_entry_t last_entry;
|
||||
|
||||
/* Get entry */
|
||||
menu_entry_init(&last_entry);
|
||||
MENU_ENTRY_INIT(last_entry);
|
||||
last_entry.path_enabled = false;
|
||||
last_entry.label_enabled = false;
|
||||
last_entry.rich_label_enabled = false;
|
||||
|
@ -103,7 +103,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
menu_entry_t entry;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
@ -124,7 +124,7 @@ static void ozone_set_thumbnail_content(void *data, const char *s)
|
||||
|
||||
if (node)
|
||||
{
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
@ -511,7 +511,7 @@ static int ozone_menu_entry_action(
|
||||
{
|
||||
/* Selection has changed - must update
|
||||
* entry pointer */
|
||||
menu_entry_init(&new_entry);
|
||||
MENU_ENTRY_INIT(new_entry);
|
||||
new_entry.path_enabled = false;
|
||||
new_entry.label_enabled = false;
|
||||
new_entry.rich_label_enabled = false;
|
||||
@ -2508,7 +2508,7 @@ static void ozone_selection_changed(ozone_handle_t *ozone, bool allow_animation)
|
||||
uintptr_t tag = (uintptr_t)selection_buf;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
@ -3869,7 +3869,7 @@ void ozone_show_fullscreen_thumbnails(ozone_handle_t *ozone)
|
||||
ozone->fullscreen_thumbnail_label[0] = '\0';
|
||||
|
||||
/* > Get menu entry */
|
||||
menu_entry_init(&selected_entry);
|
||||
MENU_ENTRY_INIT(selected_entry);
|
||||
selected_entry.path_enabled = false;
|
||||
selected_entry.value_enabled = false;
|
||||
selected_entry.sublabel_enabled = false;
|
||||
|
@ -340,7 +340,7 @@ void ozone_compute_entries_position(ozone_handle_t *ozone)
|
||||
menu_entry_t entry;
|
||||
ozone_node_t *node = NULL;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
@ -682,7 +682,7 @@ border_iterate:
|
||||
|
||||
entry_selected = selection == i;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
menu_entry_get(&entry, 0, (unsigned)i, selection_buf, true);
|
||||
|
@ -3831,7 +3831,7 @@ static void rgui_render(void *data,
|
||||
type_str_buf[0] = '\0';
|
||||
|
||||
/* Get current entry */
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.sublabel_enabled = false;
|
||||
@ -5107,7 +5107,7 @@ static void rgui_update_menu_sublabel(rgui_t *rgui)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
|
@ -900,7 +900,7 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos)
|
||||
|
||||
new_path[0] = '\0';
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
|
||||
entry_type = entry.type;
|
||||
@ -1031,7 +1031,7 @@ static void stripes_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||
if (!stripes)
|
||||
return;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, i, NULL, true);
|
||||
|
||||
if (!string_is_empty(stripes->savestate_thumbnail_file_path))
|
||||
@ -1192,11 +1192,10 @@ static void stripes_selection_pointer_changed(
|
||||
const char *thumb_ident = stripes_thumbnails_ident('R');
|
||||
const char *lft_thumb_ident= stripes_thumbnails_ident('L');
|
||||
|
||||
menu_entry_init(&entry);
|
||||
|
||||
if (!stripes)
|
||||
return;
|
||||
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
end = (unsigned)menu_entries_get_size();
|
||||
@ -1751,7 +1750,7 @@ static void stripes_list_switch(stripes_handle_t *stripes)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
@ -1765,7 +1764,7 @@ static void stripes_list_switch(stripes_handle_t *stripes)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, selection, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.path))
|
||||
@ -2660,7 +2659,7 @@ static void stripes_draw_items(
|
||||
{
|
||||
int ret;
|
||||
menu_entry_t entry;
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, i, list, true);
|
||||
ret = stripes_draw_item(
|
||||
userdata,
|
||||
|
@ -1068,7 +1068,7 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||
{
|
||||
menu_entry_t entry;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
@ -1290,7 +1290,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
|
||||
menu_entry_t entry;
|
||||
size_t selection = menu_navigation_get_selection();
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
@ -1314,7 +1314,7 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
|
||||
|
||||
if (node)
|
||||
{
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
entry.value_enabled = false;
|
||||
@ -1444,7 +1444,7 @@ static void xmb_selection_pointer_changed(
|
||||
{
|
||||
menu_entry_t entry;
|
||||
unsigned entry_type;
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
@ -3082,7 +3082,7 @@ static int xmb_draw_item(
|
||||
if (icon_x < -half_size || icon_x > width)
|
||||
return 0;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.label_enabled = false;
|
||||
entry.sublabel_enabled = (i == current);
|
||||
menu_entry_get(&entry, 0, i, list, true);
|
||||
@ -3667,7 +3667,7 @@ static void xmb_show_fullscreen_thumbnails(
|
||||
xmb->fullscreen_thumbnail_label[0] = '\0';
|
||||
|
||||
/* > Get menu entry */
|
||||
menu_entry_init(&selected_entry);
|
||||
MENU_ENTRY_INIT(selected_entry);
|
||||
selected_entry.path_enabled = false;
|
||||
selected_entry.value_enabled = false;
|
||||
selected_entry.sublabel_enabled = false;
|
||||
@ -3928,7 +3928,7 @@ static void xmb_render(void *data,
|
||||
|
||||
if (get_entry)
|
||||
{
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
|
@ -198,13 +198,43 @@ 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);
|
||||
|
||||
/* Menu entry interface -
|
||||
*
|
||||
* This provides an abstraction of the currently displayed
|
||||
* menu.
|
||||
*
|
||||
* It is organized into an event-based system where the UI companion
|
||||
* calls this functions and RetroArch responds by changing the global
|
||||
* state (including arranging for these functions to return different
|
||||
* values).
|
||||
*
|
||||
* Its only interaction back to the UI is to arrange for
|
||||
* notify_list_loaded on the UI companion.
|
||||
*/
|
||||
|
||||
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
size_t i, void *userdata, bool use_representation);
|
||||
|
||||
int menu_entry_action(
|
||||
menu_entry_t *entry, size_t i, enum menu_action action);
|
||||
|
||||
void menu_entry_init(menu_entry_t *entry);
|
||||
#define MENU_ENTRY_INIT(entry) \
|
||||
entry.path[0] = '\0'; \
|
||||
entry.label[0] = '\0'; \
|
||||
entry.sublabel[0] = '\0'; \
|
||||
entry.rich_label[0] = '\0'; \
|
||||
entry.value[0] = '\0'; \
|
||||
entry.password_value[0] = '\0'; \
|
||||
entry.enum_idx = MSG_UNKNOWN; \
|
||||
entry.entry_idx = 0; \
|
||||
entry.idx = 0; \
|
||||
entry.type = 0; \
|
||||
entry.spacing = 0; \
|
||||
entry.path_enabled = true; \
|
||||
entry.label_enabled = true; \
|
||||
entry.rich_label_enabled = true; \
|
||||
entry.value_enabled = true; \
|
||||
entry.sublabel_enabled = true
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
|
43
retroarch.c
43
retroarch.c
@ -4357,7 +4357,7 @@ static void get_current_menu_value(struct rarch_state *p_rarch,
|
||||
const char* entry_label;
|
||||
struct menu_state *menu_st = &p_rarch->menu_driver_state;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
@ -4379,7 +4379,7 @@ static void get_current_menu_label(struct rarch_state *p_rarch,
|
||||
const char* entry_label;
|
||||
struct menu_state *menu_st = &p_rarch->menu_driver_state;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
menu_entry_get(&entry, 0, menu_st->selection_ptr, NULL, true);
|
||||
|
||||
if (!string_is_empty(entry.rich_label))
|
||||
@ -4396,7 +4396,7 @@ static void get_current_menu_sublabel(struct rarch_state *p_rarch,
|
||||
menu_entry_t entry;
|
||||
struct menu_state *menu_st = &p_rarch->menu_driver_state;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
entry.path_enabled = false;
|
||||
entry.label_enabled = false;
|
||||
entry.rich_label_enabled = false;
|
||||
@ -4694,7 +4694,7 @@ static int generic_menu_iterate(
|
||||
* should not rely on a hack like this in order to work. */
|
||||
selection = MAX(MIN(selection, (menu_entries_get_size() - 1)), 0);
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
/* NOTE: If menu_entry_action() is modified,
|
||||
* will have to verify that these parameters
|
||||
* remain unused... */
|
||||
@ -5030,39 +5030,6 @@ void menu_navigation_set_selection(size_t val)
|
||||
menu_st->selection_ptr = val;
|
||||
}
|
||||
|
||||
/* Menu entry interface -
|
||||
*
|
||||
* This provides an abstraction of the currently displayed
|
||||
* menu.
|
||||
*
|
||||
* It is organized into an event-based system where the UI companion
|
||||
* calls this functions and RetroArch responds by changing the global
|
||||
* state (including arranging for these functions to return different
|
||||
* values).
|
||||
*
|
||||
* Its only interaction back to the UI is to arrange for
|
||||
* notify_list_loaded on the UI companion.
|
||||
*/
|
||||
|
||||
void menu_entry_init(menu_entry_t *entry)
|
||||
{
|
||||
entry->path[0] = '\0';
|
||||
entry->label[0] = '\0';
|
||||
entry->sublabel[0] = '\0';
|
||||
entry->rich_label[0] = '\0';
|
||||
entry->value[0] = '\0';
|
||||
entry->password_value[0] = '\0';
|
||||
entry->enum_idx = MSG_UNKNOWN;
|
||||
entry->entry_idx = 0;
|
||||
entry->idx = 0;
|
||||
entry->type = 0;
|
||||
entry->spacing = 0;
|
||||
entry->path_enabled = true;
|
||||
entry->label_enabled = true;
|
||||
entry->rich_label_enabled = true;
|
||||
entry->value_enabled = true;
|
||||
entry->sublabel_enabled = true;
|
||||
}
|
||||
|
||||
void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
|
||||
size_t i, void *userdata, bool use_representation)
|
||||
@ -26367,7 +26334,7 @@ static void menu_input_post_iterate(
|
||||
(menu_file_list_cbs_t*)selection_buf->list[selection].actiondata
|
||||
: NULL;
|
||||
|
||||
menu_entry_init(&entry);
|
||||
MENU_ENTRY_INIT(entry);
|
||||
/* Note: If menu_input_pointer_post_iterate() is
|
||||
* modified, will have to verify that these
|
||||
* parameters remain unused... */
|
||||
|
Loading…
x
Reference in New Issue
Block a user