diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b96337cb74..f1012037f8 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "menu.h" #include "menu_display.h" @@ -1106,6 +1107,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info) bool match_found = false; struct string_list *tmp_str_list = string_split( playlist->entries[j].crc32, "|"); + uint32_t hash_value = 0; if (!tmp_str_list) continue; @@ -1115,20 +1117,22 @@ 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)); - if (!strcmp(elem1, "crc")) + hash_value = djb2_calculate(elem1); + + switch (hash_value) { - if (!strcmp(db_info_entry->crc32, elem0)) - match_found = true; - } - else if (!strcmp(elem1, "sha1")) - { - if (!strcmp(db_info_entry->sha1, elem0)) - match_found = true; - } - else if (!strcmp(elem1, "md5")) - { - if (!strcmp(db_info_entry->md5, elem0)) - match_found = true; + case MENU_VALUE_CRC: + if (!strcmp(db_info_entry->crc32, elem0)) + match_found = true; + break; + case MENU_VALUE_SHA1: + if (!strcmp(db_info_entry->sha1, elem0)) + match_found = true; + break; + case MENU_VALUE_MD5: + if (!strcmp(db_info_entry->md5, elem0)) + match_found = true; + break; } string_list_free(tmp_str_list); diff --git a/menu/menu_hash.h b/menu/menu_hash.h index d91d31efc1..2f5dd8cabf 100644 --- a/menu/menu_hash.h +++ b/menu/menu_hash.h @@ -174,8 +174,10 @@ extern "C" { #define MENU_LABEL_VIDEO_SHADER_NUM_PASSES 0x79b2992fU #define MENU_LABEL_CHEAT_NUM_PASSES 0x1910eb87U +#define MENU_VALUE_MD5 0x0b888fabU +#define MENU_VALUE_SHA1 0x7c9de632U +#define MENU_VALUE_CRC 0x0b88671dU #define MENU_VALUE_MORE 0x0b877cafU - #define MENU_VALUE_INPUT_SETTINGS 0xddd30846U #define MENU_VALUE_HORIZONTAL_MENU 0x35761704U #define MENU_VALUE_MAIN_MENU 0x1625971fU @@ -183,7 +185,6 @@ extern "C" { #define MENU_VALUE_OFF 0x0b880c40U #define MENU_VALUE_TRUE 0x7c9e9fe5U #define MENU_VALUE_FALSE 0x0f6bcef0U - #define MENU_VALUE_COMP 0x6a166ba5U #define MENU_VALUE_CORE 0x6a167f7fU #define MENU_VALUE_CURSOR 0x57bba8b4U