diff --git a/cheevos-new/cheevos.c b/cheevos-new/cheevos.c index 31739eacd8..0d7a369b3a 100644 --- a/cheevos-new/cheevos.c +++ b/cheevos-new/cheevos.c @@ -132,6 +132,7 @@ typedef struct rcheevos_fixups_t fixups; char token[32]; + char hash[33]; } rcheevos_locals_t; typedef struct @@ -165,6 +166,7 @@ static rcheevos_locals_t rcheevos_locals = NULL, /* lboards */ {0}, /* fixups */ {0}, /* token */ + "N/A",/* hash */ }; bool rcheevos_loaded = false; @@ -1212,6 +1214,11 @@ int rcheevos_get_console(void) return rcheevos_locals.patchdata.console_id; } +const char* rcheevos_get_hash(void) +{ + return rcheevos_locals.hash; +} + static void rcheevos_unlock_cb(unsigned id, void* userdata) { rcheevos_cheevo_t* cheevo = NULL; @@ -1712,6 +1719,7 @@ static int rcheevos_iterate(rcheevos_coro_t* coro) } CHEEVOS_LOG(RCHEEVOS_TAG "this game doesn't feature achievements\n"); + strcpy(rcheevos_locals.hash, "N/A"); rcheevos_hardcore_paused = true; CORO_STOP(); @@ -2233,11 +2241,13 @@ found: CORO_RET(); } - CHEEVOS_LOG(RCHEEVOS_TAG "checking %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + sprintf(rcheevos_locals.hash, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", coro->hash[0], coro->hash[1], coro->hash[2], coro->hash[3], coro->hash[4], coro->hash[5], coro->hash[6], coro->hash[7], coro->hash[8], coro->hash[9], coro->hash[10], coro->hash[11], coro->hash[12], coro->hash[13], coro->hash[14], coro->hash[15]); + + CHEEVOS_LOG(RCHEEVOS_TAG "checking %s\n", rcheevos_locals.hash); rcheevos_log_url(RCHEEVOS_TAG "rc_url_get_gameid: %s\n", coro->url); CORO_GOSUB(RCHEEVOS_HTTP_GET); diff --git a/cheevos-new/cheevos.h b/cheevos-new/cheevos.h index fce51e482c..22b646feee 100644 --- a/cheevos-new/cheevos.h +++ b/cheevos-new/cheevos.h @@ -64,6 +64,8 @@ bool rcheevos_get_support_cheevos(void); int rcheevos_get_console(void); +const char* rcheevos_get_hash(void); + extern bool rcheevos_loaded; extern bool rcheevos_hardcore_active; extern bool rcheevos_hardcore_paused; diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 5aaddcd2d9..c634f5b74f 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2706,6 +2706,10 @@ MSG_HASH( MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LAST_PLAYED, "Last Played" ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH, + "RetroAchievements Hash" + ) #ifdef HAVE_LAKKA_SWITCH MSG_HASH( MENU_ENUM_LABEL_VALUE_REBOOT, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 43b1618f1b..30e12311b7 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3126,41 +3126,6 @@ static unsigned menu_displaylist_parse_content_information( count++; } - /* Database */ - if (!string_is_empty(db_name)) - { - char *db_name_no_ext = NULL; - char db_name_no_ext_buff[PATH_MAX_LENGTH]; - - db_name_no_ext_buff[0] = '\0'; - - /* Remove .lpl extension - * > path_remove_extension() requires a char * (not const) - * so have to use a temporary buffer... */ - strlcpy(db_name_no_ext_buff, db_name, sizeof(db_name_no_ext_buff)); - db_name_no_ext = path_remove_extension(db_name_no_ext_buff); - - if (!string_is_empty(db_name_no_ext)) - { - tmp[0] = '\0'; - - n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE), sizeof(tmp)); - n = strlcat(tmp, ": ", sizeof(tmp)); - n = strlcat(tmp, db_name_no_ext, sizeof(tmp)); - - /* Silence gcc compiler warning - * (getting so sick of these...) */ - if ((n < 0) || (n >= PATH_MAX_LENGTH)) - n = 0; - - if (menu_entries_append_enum(info->list, tmp, - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_DATABASE), - MENU_ENUM_LABEL_CONTENT_INFO_DATABASE, - 0, 0, 0)) - count++; - } - } - /* Runtime */ if (((settings->uints.playlist_sublabel_runtime_type == PLAYLIST_RUNTIME_PER_CORE) && settings->bools.content_runtime_log) || @@ -3206,6 +3171,65 @@ static unsigned menu_displaylist_parse_content_information( } } +#ifdef HAVE_CHEEVOS + /* RetroAchievements Hash */ + if (settings->bools.cheevos_enable && settings->arrays.cheevos_token[0] && + !string_is_empty(loaded_content_path)) + { + tmp[0] = '\0'; + + n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH), sizeof(tmp)); + n = strlcat(tmp, ": ", sizeof(tmp)); + n = strlcat(tmp, rcheevos_get_hash(), sizeof(tmp)); + + /* Silence gcc compiler warning + * (getting so sick of these...) */ + if ((n < 0) || (n >= PATH_MAX_LENGTH)) + n = 0; + + if (menu_entries_append_enum(info->list, tmp, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH), + MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH, + 0, 0, 0)) + count++; + } +#endif + + /* Database */ + if (!string_is_empty(db_name)) + { + char *db_name_no_ext = NULL; + char db_name_no_ext_buff[PATH_MAX_LENGTH]; + + db_name_no_ext_buff[0] = '\0'; + + /* Remove .lpl extension + * > path_remove_extension() requires a char * (not const) + * so have to use a temporary buffer... */ + strlcpy(db_name_no_ext_buff, db_name, sizeof(db_name_no_ext_buff)); + db_name_no_ext = path_remove_extension(db_name_no_ext_buff); + + if (!string_is_empty(db_name_no_ext)) + { + tmp[0] = '\0'; + + n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE), sizeof(tmp)); + n = strlcat(tmp, ": ", sizeof(tmp)); + n = strlcat(tmp, db_name_no_ext, sizeof(tmp)); + + /* Silence gcc compiler warning + * (getting so sick of these...) */ + if ((n < 0) || (n >= PATH_MAX_LENGTH)) + n = 0; + + if (menu_entries_append_enum(info->list, tmp, + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_DATABASE), + MENU_ENUM_LABEL_CONTENT_INFO_DATABASE, + 0, 0, 0)) + count++; + } + } + #ifdef HAVE_LIBRETRODB /* Database entry */ diff --git a/msg_hash.h b/msg_hash.h index 4f0be461a4..1834aef9f1 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1761,6 +1761,7 @@ enum msg_hash_enums MENU_LABEL(CONTENT_INFO_DATABASE), MENU_LABEL(CONTENT_INFO_RUNTIME), MENU_LABEL(CONTENT_INFO_LAST_PLAYED), + MENU_LABEL(CONTENT_INFO_CHEEVOS_HASH), MENU_LABEL(NO_PLAYLIST_ENTRIES_AVAILABLE),