Create menu_hash_to_file_type

This commit is contained in:
twinaphex 2016-06-17 23:16:59 +02:00
parent e122fd95dd
commit 99f1d6123e
4 changed files with 69 additions and 28 deletions

View File

@ -550,28 +550,28 @@ static void mui_render_label_value(mui_handle_t *mui,
}
else
{
uint32_t hash_value = menu_hash_calculate(value);
enum menu_file_type entry_type = menu_hash_to_file_type(menu_hash_calculate(value));
switch (hash_value)
switch (entry_type)
{
case MENU_VALUE_COMP:
case MENU_VALUE_MORE:
case MENU_VALUE_CORE:
case MENU_VALUE_RDB:
case MENU_VALUE_CURSOR:
case MENU_VALUE_FILE:
case MENU_VALUE_DIR:
case MENU_VALUE_MUSIC:
case MENU_VALUE_IMAGE:
case MENU_VALUE_MOVIE:
case MENU_FILE_COMPRESSED:
case MENU_FILE_MORE:
case MENU_FILE_CORE:
case MENU_FILE_RDB:
case MENU_FILE_CURSOR:
case MENU_FILE_PLAIN:
case MENU_FILE_DIRECTORY:
case MENU_FILE_MUSIC:
case MENU_FILE_IMAGE:
case MENU_FILE_MOVIE:
break;
case MENU_VALUE_ON:
case MENU_FILE_BOOL_ON:
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON])
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON];
else
do_draw_text = true;
break;
case MENU_VALUE_OFF:
case MENU_FILE_BOOL_OFF:
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF])
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF];
else

View File

@ -1698,28 +1698,28 @@ static void xmb_draw_items(xmb_handle_t *xmb,
}
else
{
uint32_t hash_value = menu_hash_calculate(entry.value);
enum menu_file_type entry_type = menu_hash_to_file_type(menu_hash_calculate(entry.value));
switch (hash_value)
switch (entry_type)
{
case MENU_VALUE_COMP:
case MENU_VALUE_MORE:
case MENU_VALUE_CORE:
case MENU_VALUE_RDB:
case MENU_VALUE_CURSOR:
case MENU_VALUE_FILE:
case MENU_VALUE_DIR:
case MENU_VALUE_MUSIC:
case MENU_VALUE_IMAGE:
case MENU_VALUE_MOVIE:
case MENU_FILE_COMPRESSED:
case MENU_FILE_MORE:
case MENU_FILE_CORE:
case MENU_FILE_RDB:
case MENU_FILE_CURSOR:
case MENU_FILE_PLAIN:
case MENU_FILE_DIRECTORY:
case MENU_FILE_MUSIC:
case MENU_FILE_IMAGE:
case MENU_FILE_MOVIE:
break;
case MENU_VALUE_ON:
case MENU_FILE_BOOL_ON:
if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON])
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON];
else
do_draw_text = true;
break;
case MENU_VALUE_OFF:
case MENU_FILE_BOOL_OFF:
if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF])
texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF];
else

View File

@ -948,3 +948,38 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
return true;
}
enum menu_file_type menu_hash_to_file_type(uint32_t hash)
{
switch (hash)
{
case MENU_VALUE_COMP:
return MENU_FILE_COMPRESSED;
case MENU_VALUE_MORE:
return MENU_FILE_MORE;
case MENU_VALUE_CORE:
return MENU_FILE_CORE;
case MENU_VALUE_RDB:
return MENU_FILE_RDB;
case MENU_VALUE_CURSOR:
return MENU_FILE_CURSOR;
case MENU_VALUE_FILE:
return MENU_FILE_PLAIN;
case MENU_VALUE_DIR:
return MENU_FILE_DIRECTORY;
case MENU_VALUE_MUSIC:
return MENU_FILE_MUSIC;
case MENU_VALUE_IMAGE:
return MENU_FILE_IMAGE;
case MENU_VALUE_MOVIE:
return MENU_FILE_MOVIE;
case MENU_VALUE_ON:
return MENU_FILE_BOOL_ON;
case MENU_VALUE_OFF:
return MENU_FILE_BOOL_OFF;
default:
break;
}
return MENU_FILE_NONE;
}

View File

@ -206,6 +206,8 @@ enum menu_file_type
MENU_FILE_RDB_ENTRY,
MENU_FILE_RPL_ENTRY,
MENU_FILE_CURSOR,
MENU_FILE_BOOL_ON,
MENU_FILE_BOOL_OFF,
MENU_FILE_RECORD_CONFIG,
MENU_FILE_PLAYLIST_COLLECTION,
MENU_FILE_PLAYLIST_ASSOCIATION,
@ -237,6 +239,8 @@ enum menu_file_type
MENU_SETTING_HORIZONTAL_MENU,
MENU_INFO_MESSAGE,
MENU_FILE_DOWNLOAD_THUMBNAIL,
MENU_FILE_MORE,
MENU_FILE_COMPRESSED,
MENU_FILE_TYPE_T_LAST
};
@ -469,6 +473,8 @@ const char* config_get_menu_driver_options(void);
/* HACK */
extern unsigned int rdb_entry_start_game_selection_ptr;
enum menu_file_type menu_hash_to_file_type(uint32_t hash);
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data);
extern menu_ctx_driver_t menu_ctx_xui;