mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
show RetroAchievements hash in content information list
This commit is contained in:
parent
2688805872
commit
79b51595a5
@ -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;
|
||||
@ -1198,6 +1200,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;
|
||||
@ -1698,6 +1705,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();
|
||||
|
||||
@ -2219,11 +2227,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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user