Skip to content

Commit

Permalink
Merge branch 'develop' into feature/unlock_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras committed Aug 17, 2024
2 parents 0ec1018 + 563230b commit 836bfb9
Show file tree
Hide file tree
Showing 16 changed files with 817 additions and 153 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# v11.5.0
* add total_entries to rc_api_fetch_leaderboard_info_response_t
* add RC_CLIENT_RAINTEGRATION_EVENT_MENU_CHANGED event
* modify rc_client_begin_identify_and_load_game and rc_client_begin_change_media to use locally
registered filereader/cdreader for hash resolution when using rc_client_raintegration
* add support for ISO-8601 timestamps in JSON responses
* update RC_CONSOLE_MS_DOS hash logic to support parent archives
* fix infinite loop that sometimes occurs when resetting while progress tracker is onscreen

# v11.4.0
* add RC_CONDITION_REMEMBER and RC_OPERAND_RECALL
* add RC_OPERATOR_ADD and RC_OPERATOR_SUB
Expand Down
3 changes: 3 additions & 0 deletions include/rc_api_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ typedef struct rc_api_fetch_leaderboard_info_response_t {
/* The number of items in the entries array */
uint32_t num_entries;

/* The total number of entries on the server */
uint32_t total_entries;

/* Common server-provided response information */
rc_api_response_t response;
}
Expand Down
1 change: 1 addition & 0 deletions include/rc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ typedef struct rc_client_leaderboard_entry_t {
typedef struct rc_client_leaderboard_entry_list_t {
rc_client_leaderboard_entry_t* entries;
uint32_t num_entries;
uint32_t total_entries;
int32_t user_index;
} rc_client_leaderboard_entry_list_t;

Expand Down
3 changes: 2 additions & 1 deletion include/rc_client_raintegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ enum {
RC_CLIENT_RAINTEGRATION_EVENT_TYPE_NONE = 0,
RC_CLIENT_RAINTEGRATION_EVENT_MENUITEM_CHECKED_CHANGED = 1, /* [menu_item] checked changed */
RC_CLIENT_RAINTEGRATION_EVENT_HARDCORE_CHANGED = 2, /* hardcore was enabled or disabled */
RC_CLIENT_RAINTEGRATION_EVENT_PAUSE = 3 /* emulated system should be paused */
RC_CLIENT_RAINTEGRATION_EVENT_PAUSE = 3, /* emulated system should be paused */
RC_CLIENT_RAINTEGRATION_EVENT_MENU_CHANGED = 4 /* one or more items were added/removed from the menu and it should be rebuilt */
};

typedef struct rc_client_raintegration_event_t {
Expand Down
7 changes: 5 additions & 2 deletions src/rapi/rc_api_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,11 @@ int rc_json_get_datetime(time_t* out, const rc_json_field_t* field, const char*

if (*field->value_start == '\"') {
memset(&tm, 0, sizeof(tm));
if (sscanf_s(field->value_start + 1, "%d-%d-%d %d:%d:%d",
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6) {
if (sscanf_s(field->value_start + 1, "%d-%d-%d %d:%d:%d", /* DB format "2013-10-20 22:12:21" */
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6 ||
/* NOTE: relies on sscanf stopping when it sees a non-digit after the seconds. could be 'Z', '.', '+', or '-' */
sscanf_s(field->value_start + 1, "%d-%d-%dT%d:%d:%d", /* ISO format "2013-10-20T22:12:21.000000Z */
&tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6) {
tm.tm_mon--; /* 0-based */
tm.tm_year -= 1900; /* 1900 based */

Expand Down
5 changes: 4 additions & 1 deletion src/rapi/rc_api_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ int rc_api_process_fetch_leaderboard_info_server_response(rc_api_fetch_leaderboa
RC_JSON_NEW_FIELD("LBAuthor"),
RC_JSON_NEW_FIELD("LBCreated"),
RC_JSON_NEW_FIELD("LBUpdated"),
RC_JSON_NEW_FIELD("Entries") /* array */
RC_JSON_NEW_FIELD("Entries"), /* array */
RC_JSON_NEW_FIELD("TotalEntries")
/* unused fields
RC_JSON_NEW_FIELD("GameTitle"),
RC_JSON_NEW_FIELD("ConsoleID"),
Expand Down Expand Up @@ -235,6 +236,8 @@ int rc_api_process_fetch_leaderboard_info_server_response(rc_api_fetch_leaderboa
return RC_MISSING_VALUE;
if (!rc_json_get_required_datetime(&response->updated, &response->response, &leaderboarddata_fields[9], "LBUpdated"))
return RC_MISSING_VALUE;
if (!rc_json_get_required_unum(&response->total_entries, &response->response, &leaderboarddata_fields[11], "TotalEntries"))
return RC_MISSING_VALUE;

if (!leaderboarddata_fields[1].value_end)
return RC_MISSING_VALUE;
Expand Down
Loading

0 comments on commit 836bfb9

Please sign in to comment.