Skip to content

Commit

Permalink
Input icons (User binds)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfrix committed Nov 12, 2018
1 parent 0b29a93 commit e5c7de8
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 14 deletions.
26 changes: 22 additions & 4 deletions menu/drivers/ozone.c
Original file line number Diff line number Diff line change
Expand Up @@ -1249,15 +1249,33 @@ static unsigned ozone_entries_icon_get_id(ozone_handle_t *ozone,
#endif

if (
(type >= MENU_SETTINGS_INPUT_DESC_BEGIN) &&
(type >= MENU_SETTINGS_INPUT_BEGIN) &&
(type <= MENU_SETTINGS_INPUT_DESC_END)
)
{
unsigned input_id;
input_id = MENU_SETTINGS_INPUT_DESC_BEGIN;
while (type > (input_id + 23))
if (type < MENU_SETTINGS_INPUT_DESC_BEGIN)
{
input_id = (input_id + 24) ;
input_id = MENU_SETTINGS_INPUT_BEGIN;
if ( type == input_id + 2)
return OZONE_ENTRIES_ICONS_TEXTURE_INPUT_SETTINGS;
if ( type == input_id + 4)
return OZONE_ENTRIES_ICONS_TEXTURE_RELOAD;
if ( type == input_id + 5)
return OZONE_ENTRIES_ICONS_TEXTURE_SAVING;
input_id = input_id + 7;
while (type > (input_id + 35))
{
input_id = (input_id + 36) ;
}
}
else
{
input_id = MENU_SETTINGS_INPUT_DESC_BEGIN;
while (type > (input_id + 23))
{
input_id = (input_id + 24) ;
}
}
if ( type == input_id )
return OZONE_ENTRIES_ICONS_TEXTURE_INPUT_BTN_D;
Expand Down
27 changes: 23 additions & 4 deletions menu/drivers/xmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
case MENU_ENUM_LABEL_INPUT_USER_14_BINDS:
case MENU_ENUM_LABEL_INPUT_USER_15_BINDS:
case MENU_ENUM_LABEL_INPUT_USER_16_BINDS:
case MENU_ENUM_LABEL_INPUT_PLAYER1_JOYPAD_INDEX:
return xmb->textures.list[XMB_TEXTURE_INPUT_SETTINGS];
case MENU_ENUM_LABEL_LATENCY_SETTINGS:
return xmb->textures.list[XMB_TEXTURE_LATENCY];
Expand Down Expand Up @@ -2619,15 +2620,33 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb,
#endif

if (
(type >= MENU_SETTINGS_INPUT_DESC_BEGIN) &&
(type >= MENU_SETTINGS_INPUT_BEGIN) &&
(type <= MENU_SETTINGS_INPUT_DESC_END)
)
{
unsigned input_id;
input_id = MENU_SETTINGS_INPUT_DESC_BEGIN;
while (type > (input_id + 23))
if (type < MENU_SETTINGS_INPUT_DESC_BEGIN)
{
input_id = (input_id + 24) ;
input_id = MENU_SETTINGS_INPUT_BEGIN;
if ( type == input_id + 2)
return xmb->textures.list[XMB_TEXTURE_INPUT_SETTINGS];
if ( type == input_id + 4)
return xmb->textures.list[XMB_TEXTURE_RELOAD];
if ( type == input_id + 5)
return xmb->textures.list[XMB_TEXTURE_SAVING];
input_id = input_id + 7;
while (type > (input_id + 35))
{
input_id = (input_id + 36) ;
}
}
else
{
input_id = MENU_SETTINGS_INPUT_DESC_BEGIN;
while (type > (input_id + 23))
{
input_id = (input_id + 24) ;
}
}
if ( type == input_id )
return xmb->textures.list[XMB_TEXTURE_INPUT_BTN_D];
Expand Down
21 changes: 15 additions & 6 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,7 @@ static int menu_displaylist_parse_settings_internal(void *data,
menu_displaylist_info_t *info,
enum menu_displaylist_parse_type parse_type,
bool add_empty_entry,
unsigned entry_type,
rarch_setting_t *setting
)
{
Expand Down Expand Up @@ -2231,8 +2232,16 @@ static int menu_displaylist_parse_settings_internal(void *data,
goto loop;
#endif

if (
(entry_type >= MENU_SETTINGS_INPUT_BEGIN) &&
(entry_type < MENU_SETTINGS_INPUT_END)
)
entry_type = MENU_SETTINGS_INPUT_BEGIN + count;
if (entry_type == 0)
entry_type = menu_setting_set_flags(setting);

menu_entries_append(info->list, short_description,
name, menu_setting_set_flags(setting), 0, 0);
name, entry_type, 0, 0);
count++;

loop:
Expand Down Expand Up @@ -2481,7 +2490,7 @@ static int menu_displaylist_parse_settings_internal_enum(void *data,
return 0;
}

#define menu_displaylist_parse_settings(data, info, info_label, parse_type, add_empty_entry) menu_displaylist_parse_settings_internal(data, info, parse_type, add_empty_entry, menu_setting_find(info_label))
#define menu_displaylist_parse_settings(data, info, info_label, parse_type, add_empty_entry, entry_type) menu_displaylist_parse_settings_internal(data, info, parse_type, add_empty_entry, entry_type, menu_setting_find(info_label))

#define menu_displaylist_parse_settings_enum(data, info, label, parse_type, add_empty_entry) menu_displaylist_parse_settings_internal_enum(data, info, parse_type, add_empty_entry, menu_setting_find_enum(label), label)

Expand Down Expand Up @@ -3310,9 +3319,9 @@ static int menu_displaylist_parse_options_remappings(
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_PLAYER_ANALOG_DPAD_MODE), val);

menu_displaylist_parse_settings(menu, info,
key_type, PARSE_ONLY_UINT, true);
key_type, PARSE_ONLY_UINT, true, 0);
menu_displaylist_parse_settings(menu, info,
key_analog, PARSE_ONLY_UINT, true);
key_analog, PARSE_ONLY_UINT, true, 0);
}

menu_entries_append_enum(info->list,
Expand Down Expand Up @@ -6855,7 +6864,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_SPLIT_JOYCON), val);

menu_displaylist_parse_settings(menu, info,
key_split_joycon, PARSE_ONLY_UINT, true);
key_split_joycon, PARSE_ONLY_UINT, true, 0);
}
}
#endif
Expand Down Expand Up @@ -7643,7 +7652,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist

strlcpy(lbl, temp_val, sizeof(lbl));
ret = menu_displaylist_parse_settings(menu, info,
lbl, PARSE_NONE, true);
lbl, PARSE_NONE, true, MENU_SETTINGS_INPUT_BEGIN);
info->need_refresh = true;
info->need_push = true;
}
Expand Down
2 changes: 2 additions & 0 deletions menu/menu_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ enum menu_settings_type
MENU_SETTINGS_PERF_COUNTERS_END = MENU_SETTINGS_PERF_COUNTERS_BEGIN + (MAX_COUNTERS - 1),
MENU_SETTINGS_CHEAT_BEGIN,
MENU_SETTINGS_CHEAT_END = MENU_SETTINGS_CHEAT_BEGIN + (MAX_CHEAT_COUNTERS - 1),
MENU_SETTINGS_INPUT_BEGIN,
MENU_SETTINGS_INPUT_END = MENU_SETTINGS_INPUT_BEGIN + RARCH_CUSTOM_BIND_LIST_END,
MENU_SETTINGS_INPUT_DESC_BEGIN,
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + ((RARCH_FIRST_CUSTOM_BIND + 8) * MAX_USERS),
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
Expand Down

0 comments on commit e5c7de8

Please sign in to comment.