Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion cheevos/cheevos_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ typedef struct rc_client_download_task_data_t
rc_client_download_queue_t* queue;
char badge_fullpath[PATH_MAX_LENGTH];
char badge_name[32];
char url[256];
int retry_count;
} rc_client_download_task_data_t;

static void rcheevos_client_download_task_callback(retro_task_t* task,
Expand All @@ -454,6 +456,17 @@ static void rcheevos_client_download_task_callback(retro_task_t* task,
else if (http_data->status != 200)
{
CHEEVOS_LOG(RCHEEVOS_TAG "HTTP status code %d for badge %s\n", http_data->status, callback_data->badge_name);

/* -1 status code is an internal networking failure. go ahead and retry a few times */
if (http_data->status == -1 && callback_data->retry_count++ < 4)
{
rcheevos_locals_t* rcheevos_locals = get_rcheevos_locals();

task_push_http_transfer_with_user_agent(callback_data->url,
true, "GET", rcheevos_locals->user_agent_core,
rcheevos_client_download_task_callback, callback_data);
return;
}
}
else if (!filestream_write_file(callback_data->badge_fullpath, http_data->data, http_data->len))
{
Expand Down Expand Up @@ -563,8 +576,15 @@ bool rcheevos_client_download_badge(rc_client_download_queue_t* queue,
taskdata->queue = queue;
strlcpy(taskdata->badge_fullpath, badge_fullpath, sizeof(taskdata->badge_fullpath));
strlcpy(taskdata->badge_name, badge_name, sizeof(taskdata->badge_name));
strlcpy(taskdata->url, url, sizeof(taskdata->url));
taskdata->retry_count = 0;

#ifndef HAVE_SSL
if (string_starts_with(taskdata->url, "https:"))
strlcpy(&taskdata->url[4], &url[5], sizeof(taskdata->url) - 4);
#endif

task_push_http_transfer_with_user_agent(url,
task_push_http_transfer_with_user_agent(taskdata->url,
true, "GET", rcheevos_locals->user_agent_core,
rcheevos_client_download_task_callback, taskdata);

Expand Down
13 changes: 13 additions & 0 deletions deps/rcheevos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# v12.4.0
* add avatar_last_updated field to rc_client_user_t and rc_api_login_response_t
* add more fields to fetch_games_list API
* add rc_client_begin_fetch_game_list
* add extended RAM to memory map for PSP
* add memory map for XBOX
* add hash generation for .neo files (geolith-specific NeoGeo ROMs)
* add validation warning if Mem and Delta conditions exist for same address and value
* ignore warning achievements when reporting achievement count in rc_client_get_user_game_summary
* fix crash when {recall} exists without a Remember
* fix crash when legacy value contains invalid syntax that overflows the conversion buffer
* fix handling of SubSource chain starting with a constant

# v12.3.0
* add rc_client_get_next_achievement_info
* rc_client image functions will now return RC_INSUFFICENT_BUFFER instead of truncating if buffer is not large enough
Expand Down
18 changes: 18 additions & 0 deletions deps/rcheevos/include/rc_api_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,26 @@ rc_api_fetch_games_list_request_t;
typedef struct rc_api_game_list_entry_t {
/* The unique identifier of the game */
uint32_t id;
/* The number of achievements in the game */
uint32_t num_achievements;
/* The number of leaderboards in the game */
uint32_t num_leaderboards;
/* The number of points in the game */
uint32_t points;
/* The name of the game */
const char* name;
/* The image name for the game badge */
const char* image_name;
/* The URL for the game badge image */
const char* image_url;
/* An array of supported hashes */
const char** supported_hashes;
/* An array of unsupported hashes */
const char** unsupported_hashes;
/* The number of items in the supported_hashes array */
uint32_t num_supported_hashes;
/* The number of items in the unsupported_hashes array */
uint32_t num_unsupported_hashes;
}
rc_api_game_list_entry_t;

Expand Down
4 changes: 4 additions & 0 deletions deps/rcheevos/include/rc_api_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ typedef struct rc_api_login_response_t {
const char* display_name;
/* A URL to the user's avatar image */
const char* avatar_url;
/* When the avatar was last updated */
time_t avatar_last_updated;

/* Common server-provided response information */
rc_api_response_t response;
Expand Down Expand Up @@ -187,6 +189,8 @@ typedef struct rc_api_followed_user_t {
const char* display_name;
/* A URL to the user's avatar image */
const char* avatar_url;
/* When the avatar was last updated */
time_t avatar_last_updated;
/* The player's last registered activity */
rc_api_followed_user_activity_t recent_activity;
/* The current score of the player */
Expand Down
57 changes: 57 additions & 0 deletions deps/rcheevos/include/rc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ typedef struct rc_client_user_t {
uint32_t num_unread_messages;
/* minimum version: 12.0 */
const char* avatar_url;
/* minimum version: 12.4 */
time_t avatar_last_updated;
} rc_client_user_t;

/**
Expand Down Expand Up @@ -450,6 +452,61 @@ RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_fetch_game_titles(
*/
RC_EXPORT void RC_CCONV rc_client_destroy_game_title_list(rc_client_game_title_list_t* list);

/*****************************************************************************\
| Fetch Games List |
\*****************************************************************************/

typedef struct rc_client_game_list_entry_t {
/* The unique identifier of the game */
uint32_t id;
/* The number of achievements in the game */
uint32_t num_achievements;
/* The number of leaderboards in the game */
uint32_t num_leaderboards;
/* The number of points in the game */
uint32_t points;
/* The name of the game */
const char* name;
/* The image name for the game badge */
const char* image_name;
/* The URL for the game badge image */
const char* image_url;
/* An array of supported hashes */
const char** supported_hashes;
/* An array of unsupported hashes */
const char** unsupported_hashes;
/* The number of items in the supported_hashes array */
uint32_t num_supported_hashes;
/* The number of items in the unsupported_hashes array */
uint32_t num_unsupported_hashes;
} rc_client_game_list_entry_t;

typedef struct rc_client_game_list_t {
rc_client_game_list_entry_t* entries;
uint32_t num_entries;
} rc_client_game_list_t;

/**
* Callback that is fired when a games list request completes. list may be null if the query failed.
*/
typedef void(RC_CCONV* rc_client_fetch_game_list_callback_t)(int result, const char* error_message,
rc_client_game_list_t* list, rc_client_t* client,
void* callback_userdata);

/**
* Starts an asynchronous request for all games for the given console.
* This request returns the game metadata and supported/unsupported hashes for each game on the console,
* described by the rc_client_game_list_entry_t struct. After use, the list should be freed by calling
* the rc_client_destroy_game_list() function.
*/
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_fetch_game_list(
rc_client_t* client, uint32_t console_id, rc_client_fetch_game_list_callback_t callback, void* callback_userdata);

/**
* Destroys a previously-allocated result from the rc_client_begin_fetch_game_list() callback.
*/
RC_EXPORT void RC_CCONV rc_client_destroy_game_list(rc_client_game_list_t* list);

/*****************************************************************************\
| Achievements |
\*****************************************************************************/
Expand Down
3 changes: 2 additions & 1 deletion deps/rcheevos/include/rc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ enum {
RC_INSUFFICIENT_BUFFER = -36,
RC_INVALID_VARIABLE_NAME = -37,
RC_UNKNOWN_VARIABLE_NAME = -38,
RC_NOT_FOUND = -39
RC_NOT_FOUND = -39,
RC_INVALID_VALUE = -40
};

RC_EXPORT const char* RC_CCONV rc_error_str(int ret);
Expand Down
Loading
Loading