duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

rc_api_info.h (8327B)


      1 #ifndef RC_API_INFO_H
      2 #define RC_API_INFO_H
      3 
      4 #include "rc_api_request.h"
      5 
      6 #include <stdint.h>
      7 #include <time.h>
      8 
      9 RC_BEGIN_C_DECLS
     10 
     11 /* --- Fetch Achievement Info --- */
     12 
     13 /**
     14  * API parameters for a fetch achievement info request.
     15  */
     16 typedef struct rc_api_fetch_achievement_info_request_t {
     17   /* The username of the player */
     18   const char* username;
     19   /* The API token from the login request */
     20   const char* api_token;
     21   /* The unique identifier of the achievement */
     22   uint32_t achievement_id;
     23   /* The 1-based index of the first entry to retrieve */
     24   uint32_t first_entry;
     25   /* The number of entries to retrieve */
     26   uint32_t count;
     27   /* Non-zero to only return unlocks earned by the user's friends */
     28   uint32_t friends_only;
     29 }
     30 rc_api_fetch_achievement_info_request_t;
     31 
     32 /* An achievement awarded entry */
     33 typedef struct rc_api_achievement_awarded_entry_t {
     34   /* The user associated to the entry */
     35   const char* username;
     36   /* When the achievement was awarded */
     37   time_t awarded;
     38 }
     39 rc_api_achievement_awarded_entry_t;
     40 
     41 /**
     42  * Response data for a fetch achievement info request.
     43  */
     44 typedef struct rc_api_fetch_achievement_info_response_t {
     45   /* The unique identifier of the achievement */
     46   uint32_t id;
     47   /* The unique identifier of the game to which the leaderboard is associated */
     48   uint32_t game_id;
     49   /* The number of times the achievement has been awarded */
     50   uint32_t num_awarded;
     51   /* The number of players that have earned at least one achievement for the game */
     52   uint32_t num_players;
     53 
     54   /* An array of recently rewarded entries */
     55   rc_api_achievement_awarded_entry_t* recently_awarded;
     56   /* The number of items in the recently_awarded array */
     57   uint32_t num_recently_awarded;
     58 
     59   /* Common server-provided response information */
     60   rc_api_response_t response;
     61 }
     62 rc_api_fetch_achievement_info_response_t;
     63 
     64 RC_EXPORT int RC_CCONV rc_api_init_fetch_achievement_info_request(rc_api_request_t* request, const rc_api_fetch_achievement_info_request_t* api_params);
     65 /* [deprecated] use rc_api_process_fetch_achievement_info_server_response instead */
     66 RC_EXPORT int RC_CCONV rc_api_process_fetch_achievement_info_response(rc_api_fetch_achievement_info_response_t* response, const char* server_response);
     67 RC_EXPORT int RC_CCONV rc_api_process_fetch_achievement_info_server_response(rc_api_fetch_achievement_info_response_t* response, const rc_api_server_response_t* server_response);
     68 RC_EXPORT void RC_CCONV rc_api_destroy_fetch_achievement_info_response(rc_api_fetch_achievement_info_response_t* response);
     69 
     70 /* --- Fetch Leaderboard Info --- */
     71 
     72 /**
     73  * API parameters for a fetch leaderboard info request.
     74  */
     75 typedef struct rc_api_fetch_leaderboard_info_request_t {
     76   /* The unique identifier of the leaderboard */
     77   uint32_t leaderboard_id;
     78   /* The number of entries to retrieve */
     79   uint32_t count;
     80   /* The 1-based index of the first entry to retrieve */
     81   uint32_t first_entry;
     82   /* The username of the player around whom the entries should be returned */
     83   const char* username;
     84 }
     85 rc_api_fetch_leaderboard_info_request_t;
     86 
     87 /* A leaderboard info entry */
     88 typedef struct rc_api_lboard_info_entry_t {
     89   /* The user associated to the entry */
     90   const char* username;
     91   /* The rank of the entry */
     92   uint32_t rank;
     93   /* The index of the entry */
     94   uint32_t index;
     95   /* The value of the entry */
     96   int32_t score;
     97   /* When the entry was submitted */
     98   time_t submitted;
     99 }
    100 rc_api_lboard_info_entry_t;
    101 
    102 /**
    103  * Response data for a fetch leaderboard info request.
    104  */
    105 typedef struct rc_api_fetch_leaderboard_info_response_t {
    106   /* The unique identifier of the leaderboard */
    107   uint32_t id;
    108   /* The format to pass to rc_format_value to format the leaderboard value */
    109   int format;
    110   /* If non-zero, indicates that lower scores appear first */
    111   uint32_t lower_is_better;
    112   /* The title of the leaderboard */
    113   const char* title;
    114   /* The description of the leaderboard */
    115   const char* description;
    116   /* The definition of the leaderboard to be passed to rc_runtime_activate_lboard */
    117   const char* definition;
    118   /* The unique identifier of the game to which the leaderboard is associated */
    119   uint32_t game_id;
    120   /* The author of the leaderboard */
    121   const char* author;
    122   /* When the leaderboard was first uploaded to the server */
    123   time_t created;
    124   /* When the leaderboard was last modified on the server */
    125   time_t updated;
    126 
    127   /* An array of requested entries */
    128   rc_api_lboard_info_entry_t* entries;
    129   /* The number of items in the entries array */
    130   uint32_t num_entries;
    131 
    132   /* The total number of entries on the server */
    133   uint32_t total_entries;
    134 
    135   /* Common server-provided response information */
    136   rc_api_response_t response;
    137 }
    138 rc_api_fetch_leaderboard_info_response_t;
    139 
    140 RC_EXPORT int RC_CCONV rc_api_init_fetch_leaderboard_info_request(rc_api_request_t* request, const rc_api_fetch_leaderboard_info_request_t* api_params);
    141 /* [deprecated] use rc_api_process_fetch_leaderboard_info_server_response instead */
    142 RC_EXPORT int RC_CCONV rc_api_process_fetch_leaderboard_info_response(rc_api_fetch_leaderboard_info_response_t* response, const char* server_response);
    143 RC_EXPORT int RC_CCONV rc_api_process_fetch_leaderboard_info_server_response(rc_api_fetch_leaderboard_info_response_t* response, const rc_api_server_response_t* server_response);
    144 RC_EXPORT void RC_CCONV rc_api_destroy_fetch_leaderboard_info_response(rc_api_fetch_leaderboard_info_response_t* response);
    145 
    146 /* --- Fetch Games List --- */
    147 
    148 /**
    149  * API parameters for a fetch games list request.
    150  */
    151 typedef struct rc_api_fetch_games_list_request_t {
    152   /* The unique identifier of the console to query */
    153   uint32_t console_id;
    154 }
    155 rc_api_fetch_games_list_request_t;
    156 
    157 /* A game list entry */
    158 typedef struct rc_api_game_list_entry_t {
    159   /* The unique identifier of the game */
    160   uint32_t id;
    161   /* The name of the game */
    162   const char* name;
    163 }
    164 rc_api_game_list_entry_t;
    165 
    166 /**
    167  * Response data for a fetch games list request.
    168  */
    169 typedef struct rc_api_fetch_games_list_response_t {
    170   /* An array of requested entries */
    171   rc_api_game_list_entry_t* entries;
    172   /* The number of items in the entries array */
    173   uint32_t num_entries;
    174 
    175   /* Common server-provided response information */
    176   rc_api_response_t response;
    177 }
    178 rc_api_fetch_games_list_response_t;
    179 
    180 RC_EXPORT int RC_CCONV rc_api_init_fetch_games_list_request(rc_api_request_t* request, const rc_api_fetch_games_list_request_t* api_params);
    181 /* [deprecated] use rc_api_process_fetch_games_list_server_response instead */
    182 RC_EXPORT int RC_CCONV rc_api_process_fetch_games_list_response(rc_api_fetch_games_list_response_t* response, const char* server_response);
    183 RC_EXPORT int RC_CCONV rc_api_process_fetch_games_list_server_response(rc_api_fetch_games_list_response_t* response, const rc_api_server_response_t* server_response);
    184 RC_EXPORT void RC_CCONV rc_api_destroy_fetch_games_list_response(rc_api_fetch_games_list_response_t* response);
    185 
    186 /* --- Fetch Game Titles --- */
    187 
    188 /**
    189  * API parameters for a fetch games list request.
    190  */
    191 typedef struct rc_api_fetch_game_titles_request_t {
    192   /* An array of game ids to fetch titles for */
    193   const uint32_t* game_ids;
    194   /* The number of items in the game_ids array */
    195   uint32_t num_game_ids;
    196 }
    197 rc_api_fetch_game_titles_request_t;
    198 
    199 /* A game title entry */
    200 typedef struct rc_api_game_title_entry_t {
    201   /* The unique identifier of the game */
    202   uint32_t id;
    203   /* The title of the game */
    204   const char* title;
    205   /* The image name for the game badge */
    206   const char* image_name;
    207 }
    208 rc_api_game_title_entry_t;
    209 
    210 /**
    211  * Response data for a fetch games title request.
    212  */
    213 typedef struct rc_api_fetch_game_titles_response_t {
    214   /* An array of requested entries */
    215   rc_api_game_title_entry_t* entries;
    216   /* The number of items in the entries array */
    217   uint32_t num_entries;
    218 
    219   /* Common server-provided response information */
    220   rc_api_response_t response;
    221 }
    222 rc_api_fetch_game_titles_response_t;
    223 
    224 RC_EXPORT int RC_CCONV rc_api_init_fetch_game_titles_request(rc_api_request_t* request, const rc_api_fetch_game_titles_request_t* api_params);
    225 RC_EXPORT int RC_CCONV rc_api_process_fetch_game_titles_server_response(rc_api_fetch_game_titles_response_t* response, const rc_api_server_response_t* server_response);
    226 RC_EXPORT void RC_CCONV rc_api_destroy_fetch_game_titles_response(rc_api_fetch_game_titles_response_t* response);
    227 
    228 RC_END_C_DECLS
    229 
    230 #endif /* RC_API_INFO_H */