Get rid of menu_hash_calculate - use msg_hash_calculate instead

This commit is contained in:
twinaphex 2016-06-20 00:37:38 +02:00
parent 65dff0a03a
commit 5075712cac
18 changed files with 55 additions and 61 deletions

View File

@ -408,7 +408,7 @@ static int menu_cbs_init_bind_left_compare_label(menu_file_list_cbs_t *cbs,
label_setting[0] = '\0';
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
label_setting_hash = menu_hash_calculate(label_setting);
label_setting_hash = msg_hash_calculate(label_setting);
if (label_hash != label_setting_hash)
continue;

View File

@ -589,7 +589,7 @@ static int action_ok_file_load_with_detect_core_carchive(
const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
uint32_t hash_label = menu_hash_calculate(label);
uint32_t hash_label = msg_hash_calculate(label);
fill_pathname_join_delim(detect_content_path, detect_content_path, path,
'#', sizeof(detect_content_path));
@ -604,7 +604,7 @@ static int action_ok_file_load_with_detect_core_carchive(
static int action_ok_file_load_with_detect_core(const char *path,
const char *label, unsigned type, size_t idx, size_t entry_idx)
{
uint32_t hash_label = menu_hash_calculate(label);
uint32_t hash_label = msg_hash_calculate(label);
type = 0;
label = NULL;
@ -753,7 +753,7 @@ static int action_ok_playlist_entry(const char *path,
const char *core_name = NULL;
playlist_t *tmp_playlist = NULL;
menu_handle_t *menu = NULL;
uint32_t hash_label = menu_hash_calculate(label);
uint32_t hash_label = msg_hash_calculate(label);
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
return menu_cbs_exit();
@ -1681,7 +1681,7 @@ static void cb_generic_download(void *task_data,
if (string_is_equal_noncase(file_ext, "zip"))
{
if (!task_push_decompress(output_path, dir_path, NULL, NULL, NULL,
cb_decompressed, (void*)(uintptr_t)menu_hash_calculate(msg_hash_to_str(transf->enum_idx))))
cb_decompressed, (void*)(uintptr_t)msg_hash_calculate(msg_hash_to_str(transf->enum_idx))))
{
err = "Decompression failed.";
goto finish;
@ -2607,7 +2607,7 @@ static int is_rdb_entry(uint32_t label_hash)
static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs,
const char *label, uint32_t hash, const char *elem0)
{
uint32_t elem0_hash = menu_hash_calculate(elem0);
uint32_t elem0_hash = msg_hash_calculate(elem0);
if (!string_is_empty(elem0) && (is_rdb_entry(elem0_hash) == 0))
{

View File

@ -526,7 +526,7 @@ static int menu_cbs_init_bind_right_compare_label(menu_file_list_cbs_t *cbs,
label_setting[0] = '\0';
snprintf(label_setting, sizeof(label_setting), "input_player%d_joypad_index", i + 1);
label_setting_hash = menu_hash_calculate(label_setting);
label_setting_hash = msg_hash_calculate(label_setting);
if (label_hash != label_setting_hash)
continue;

View File

@ -550,7 +550,7 @@ static void mui_render_label_value(mui_handle_t *mui,
}
else
{
enum menu_file_type entry_type = menu_hash_to_file_type(menu_hash_calculate(value));
enum menu_file_type entry_type = menu_hash_to_file_type(msg_hash_calculate(value));
switch (entry_type)
{

View File

@ -286,7 +286,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
return 0;
menu->menu_state.msg[0] = '\0';
hash = menu_hash_calculate(label);
hash = msg_hash_calculate(label);
iterate_type = action_iterate_type(hash);
if ( action != MENU_ACTION_NOOP
@ -333,7 +333,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
{
char needle[PATH_MAX_LENGTH] = {0};
strlcpy(needle, menu_setting_get_name(setting), sizeof(needle));
label_hash = menu_hash_calculate(needle);
label_hash = msg_hash_calculate(needle);
}
ret = menu_hash_get_help(label_hash,

View File

@ -1699,7 +1699,7 @@ static void xmb_draw_items(xmb_handle_t *xmb,
}
else
{
enum menu_file_type entry_type = menu_hash_to_file_type(menu_hash_calculate(entry.value));
enum menu_file_type entry_type = menu_hash_to_file_type(msg_hash_calculate(entry.value));
switch (entry_type)
{

View File

@ -19,6 +19,7 @@
#include <compat/strl.h>
#include "../menu_hash.h"
#include "../../msg_hash.h"
#include "../../configuration.h"
/* IMPORTANT:
@ -41,7 +42,7 @@ int menu_hash_get_help_de(uint32_t hash, char *s, size_t len)
switch (hash)
{
case MENU_LABEL_INPUT_DRIVER:
driver_hash = menu_hash_calculate(settings->input.driver);
driver_hash = msg_hash_calculate(settings->input.driver);
switch (driver_hash)
{
@ -146,7 +147,7 @@ int menu_hash_get_help_de(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_VIDEO_DRIVER:
driver_hash = menu_hash_calculate(settings->video.driver);
driver_hash = msg_hash_calculate(settings->video.driver);
switch (driver_hash)
{
@ -223,7 +224,7 @@ int menu_hash_get_help_de(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER:
driver_hash = menu_hash_calculate(settings->audio.resampler);
driver_hash = msg_hash_calculate(settings->audio.resampler);
switch (driver_hash)
{

View File

@ -126,7 +126,7 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_INPUT_DRIVER:
driver_hash = menu_hash_calculate(settings->input.driver);
driver_hash = msg_hash_calculate(settings->input.driver);
switch (driver_hash)
{
@ -239,7 +239,7 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_VIDEO_DRIVER:
driver_hash = menu_hash_calculate(settings->video.driver);
driver_hash = msg_hash_calculate(settings->video.driver);
switch (driver_hash)
{
@ -323,7 +323,7 @@ int menu_hash_get_help_es(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER:
driver_hash = menu_hash_calculate(settings->audio.resampler);
driver_hash = msg_hash_calculate(settings->audio.resampler);
switch (driver_hash)
{

View File

@ -120,7 +120,7 @@ int menu_hash_get_help_it(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_INPUT_DRIVER:
driver_hash = menu_hash_calculate(settings->input.driver);
driver_hash = msg_hash_calculate(settings->input.driver);
switch (driver_hash)
{
@ -212,7 +212,7 @@ int menu_hash_get_help_it(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_VIDEO_DRIVER:
driver_hash = menu_hash_calculate(settings->video.driver);
driver_hash = msg_hash_calculate(settings->video.driver);
switch (driver_hash)
{
@ -290,7 +290,7 @@ int menu_hash_get_help_it(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER:
driver_hash = menu_hash_calculate(settings->audio.resampler);
driver_hash = msg_hash_calculate(settings->audio.resampler);
switch (driver_hash)
{

View File

@ -43,7 +43,7 @@ int menu_hash_get_help_pt(uint32_t hash, char *s, size_t len)
switch (hash)
{
case MENU_LABEL_INPUT_DRIVER:
driver_hash = menu_hash_calculate(settings->input.driver);
driver_hash = msg_hash_calculate(settings->input.driver);
switch (driver_hash)
{
@ -136,7 +136,7 @@ int menu_hash_get_help_pt(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_VIDEO_DRIVER:
driver_hash = menu_hash_calculate(settings->video.driver);
driver_hash = msg_hash_calculate(settings->video.driver);
switch (driver_hash)
{
@ -214,7 +214,7 @@ int menu_hash_get_help_pt(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER:
driver_hash = menu_hash_calculate(settings->audio.resampler);
driver_hash = msg_hash_calculate(settings->audio.resampler);
switch (driver_hash)
{

View File

@ -111,7 +111,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_INPUT_DRIVER:
driver_hash = menu_hash_calculate(settings->input.driver);
driver_hash = msg_hash_calculate(settings->input.driver);
switch (driver_hash)
{
@ -203,7 +203,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_VIDEO_DRIVER:
driver_hash = menu_hash_calculate(settings->video.driver);
driver_hash = msg_hash_calculate(settings->video.driver);
switch (driver_hash)
{
@ -281,7 +281,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER:
driver_hash = menu_hash_calculate(settings->audio.resampler);
driver_hash = msg_hash_calculate(settings->audio.resampler);
switch (driver_hash)
{

View File

@ -113,7 +113,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_INPUT_DRIVER:
driver_hash = menu_hash_calculate(settings->input.driver);
driver_hash = msg_hash_calculate(settings->input.driver);
switch (driver_hash)
{
@ -205,7 +205,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_VIDEO_DRIVER:
driver_hash = menu_hash_calculate(settings->video.driver);
driver_hash = msg_hash_calculate(settings->video.driver);
switch (driver_hash)
{
@ -283,7 +283,7 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len)
);
break;
case MENU_LABEL_AUDIO_RESAMPLER_DRIVER:
driver_hash = menu_hash_calculate(settings->audio.resampler);
driver_hash = msg_hash_calculate(settings->audio.resampler);
switch (driver_hash)
{

View File

@ -68,8 +68,8 @@ void menu_cbs_init(void *data,
if (!label || !menu_label)
goto error;
label_hash = menu_hash_calculate(label);
menu_label_hash = menu_hash_calculate(menu_label);
label_hash = msg_hash_calculate(label);
menu_label_hash = msg_hash_calculate(menu_label);
#ifdef DEBUG_LOG
RARCH_LOG("\n");

View File

@ -1789,7 +1789,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
if (tmp_str_list->size > 1)
strlcpy(elem1, tmp_str_list->elems[1].data, sizeof(elem1));
switch (menu_hash_to_file_type(menu_hash_calculate(elem1)))
switch (menu_hash_to_file_type(msg_hash_calculate(elem1)))
{
case MENU_FILE_CRC:
if (string_is_equal(crc_str, elem0))
@ -3091,7 +3091,7 @@ static int menu_displaylist_parse_generic(
core_info_list_t *list = NULL;
unsigned items_found = 0;
settings_t *settings = config_get_ptr();
uint32_t hash_label = menu_hash_calculate(info->label);
uint32_t hash_label = msg_hash_calculate(info->label);
core_info_get_list(&list);
@ -3494,7 +3494,7 @@ static bool menu_displaylist_push_list_process(menu_displaylist_info_t *info)
if (info->need_push)
{
info->label_hash = menu_hash_calculate(info->label);
info->label_hash = msg_hash_calculate(info->label);
menu_driver_ctl(RARCH_MENU_CTL_POPULATE_ENTRIES, info);
ui_companion_driver_notify_list_loaded(info->list, info->menu_list);
}

View File

@ -68,8 +68,3 @@ int menu_hash_get_help(uint32_t hash, char *s, size_t len)
return menu_hash_get_help_us(hash, s, len);
}
uint32_t menu_hash_calculate(const char *s)
{
return djb2_calculate(s);
}

View File

@ -575,8 +575,6 @@ int menu_hash_get_help_us(uint32_t hash, char *s, size_t len);
int menu_hash_get_help(uint32_t hash, char *s, size_t len);
uint32_t menu_hash_calculate(const char *s);
RETRO_END_DECLS
#endif

View File

@ -1668,7 +1668,7 @@ bool START_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1680,7 +1680,7 @@ bool END_GROUP(rarch_setting_t **list, rarch_setting_info_t *list_info,
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1698,7 +1698,7 @@ bool START_SUB_GROUP(rarch_setting_t **list,
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1712,7 +1712,7 @@ bool END_SUB_GROUP(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1730,7 +1730,7 @@ bool CONFIG_ACTION(
if (!menu_settings_list_append(list, list_info))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1766,7 +1766,7 @@ static rarch_setting_t setting_bool_setting(const char* name,
result.size = sizeof(bool);
result.name = name;
result.name_hash = name ? menu_hash_calculate(name) : 0;
result.name_hash = name ? msg_hash_calculate(name) : 0;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
@ -1839,7 +1839,7 @@ static rarch_setting_t setting_int_setting(const char* name,
result.size = sizeof(int);
result.name = name;
result.name_hash = name ? menu_hash_calculate(name) : 0;
result.name_hash = name ? msg_hash_calculate(name) : 0;
result.short_description = short_description;
result.group = group;
result.subgroup = subgroup;
@ -1903,7 +1903,7 @@ bool CONFIG_BOOL(
if (!menu_settings_list_append(list, list_info))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
if (flags != SD_FLAG_NONE)
settings_data_list_current_add_flags(list, list_info, flags);
@ -1926,7 +1926,7 @@ bool CONFIG_INT(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1948,7 +1948,7 @@ bool CONFIG_UINT(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1969,7 +1969,7 @@ bool CONFIG_FLOAT(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -1990,7 +1990,7 @@ bool CONFIG_PATH(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY);
return true;
@ -2012,7 +2012,7 @@ bool CONFIG_DIR(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
settings_data_list_current_add_flags(
list,
@ -2037,7 +2037,7 @@ bool CONFIG_STRING(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -2059,7 +2059,7 @@ bool CONFIG_STRING_OPTIONS(
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
/* Request values to be freed later */
settings_data_list_current_add_free_flags(list, list_info, SD_FREE_FLAG_VALUES);
@ -2083,7 +2083,7 @@ bool CONFIG_HEX(
if (!(menu_settings_list_append(list, list_info)))
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
return true;
}
@ -2106,7 +2106,7 @@ bool CONFIG_BIND(
return false;
if (value.name)
value.name_hash = menu_hash_calculate(value.name);
value.name_hash = msg_hash_calculate(value.name);
(*list)[list_info->index++] = value;
/* Request name and short description to be freed later */
settings_data_list_current_add_free_flags(list, list_info, SD_FREE_FLAG_NAME | SD_FREE_FLAG_SHORT);
@ -2340,7 +2340,7 @@ uint32_t menu_setting_get_index(rarch_setting_t *setting)
static rarch_setting_t *menu_setting_find_internal(rarch_setting_t *setting,
const char *label)
{
uint32_t needle = menu_hash_calculate(label);
uint32_t needle = msg_hash_calculate(label);
for (; menu_setting_get_type(setting) != ST_NONE; menu_settings_list_increment(&setting))
{
@ -8169,7 +8169,7 @@ static rarch_setting_t *menu_setting_new_internal(rarch_setting_info_t *list_inf
if (!(menu_settings_list_append(&list, list_info)))
goto error;
if (terminator.name)
terminator.name_hash = menu_hash_calculate(terminator.name);
terminator.name_hash = msg_hash_calculate(terminator.name);
(*&list)[list_info->index++] = terminator;
/* flatten this array to save ourselves some kilobytes. */

View File

@ -85,7 +85,7 @@ void menu_shader_manager_init(menu_handle_t *menu)
sizeof(menu->default_slangp));
}
switch (menu_hash_to_file_type(menu_hash_calculate(path_get_extension(settings->path.shader))))
switch (menu_hash_to_file_type(msg_hash_calculate(path_get_extension(settings->path.shader))))
{
case MENU_FILE_SHADER_PRESET_GLSLP:
case MENU_FILE_SHADER_PRESET_CGP: