First Commit
This commit is contained in:
259
3rdparty/rcheevos/include/rc_api_editor.h
vendored
Normal file
259
3rdparty/rcheevos/include/rc_api_editor.h
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
#ifndef RC_API_EDITOR_H
|
||||
#define RC_API_EDITOR_H
|
||||
|
||||
#include "rc_api_request.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/* --- Fetch Code Notes --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch code notes request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_code_notes_request_t {
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
}
|
||||
rc_api_fetch_code_notes_request_t;
|
||||
|
||||
/* A code note definiton */
|
||||
typedef struct rc_api_code_note_t {
|
||||
/* The address the note is associated to */
|
||||
uint32_t address;
|
||||
/* The name of the use who last updated the note */
|
||||
const char* author;
|
||||
/* The contents of the note */
|
||||
const char* note;
|
||||
} rc_api_code_note_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch code notes request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_code_notes_response_t {
|
||||
/* An array of code notes for the game */
|
||||
rc_api_code_note_t* notes;
|
||||
/* The number of items in the notes array */
|
||||
uint32_t num_notes;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_code_notes_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_fetch_code_notes_request(rc_api_request_t* request, const rc_api_fetch_code_notes_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_fetch_code_notes_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_code_notes_response(rc_api_fetch_code_notes_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_code_notes_server_response(rc_api_fetch_code_notes_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_code_notes_response(rc_api_fetch_code_notes_response_t* response);
|
||||
|
||||
/* --- Update Code Note --- */
|
||||
|
||||
/**
|
||||
* API parameters for an update code note request.
|
||||
*/
|
||||
typedef struct rc_api_update_code_note_request_t {
|
||||
/* The username of the developer */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
/* The address the note is associated to */
|
||||
uint32_t address;
|
||||
/* The contents of the note (NULL or empty to delete a note) */
|
||||
const char* note;
|
||||
}
|
||||
rc_api_update_code_note_request_t;
|
||||
|
||||
/**
|
||||
* Response data for an update code note request.
|
||||
*/
|
||||
typedef struct rc_api_update_code_note_response_t {
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_update_code_note_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_update_code_note_request(rc_api_request_t* request, const rc_api_update_code_note_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_update_code_note_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_update_code_note_response(rc_api_update_code_note_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_update_code_note_server_response(rc_api_update_code_note_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_update_code_note_response(rc_api_update_code_note_response_t* response);
|
||||
|
||||
/* --- Update Achievement --- */
|
||||
|
||||
/**
|
||||
* API parameters for an update achievement request.
|
||||
*/
|
||||
typedef struct rc_api_update_achievement_request_t {
|
||||
/* The username of the developer */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the achievement (0 to create a new achievement) */
|
||||
uint32_t achievement_id;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
/* The name of the achievement */
|
||||
const char* title;
|
||||
/* The description of the achievement */
|
||||
const char* description;
|
||||
/* The badge name for the achievement */
|
||||
const char* badge;
|
||||
/* The serialized trigger for the achievement */
|
||||
const char* trigger;
|
||||
/* The number of points the achievement is worth */
|
||||
uint32_t points;
|
||||
/* The category of the achievement */
|
||||
uint32_t category;
|
||||
/* The type of the achievement */
|
||||
uint32_t type;
|
||||
}
|
||||
rc_api_update_achievement_request_t;
|
||||
|
||||
/**
|
||||
* Response data for an update achievement request.
|
||||
*/
|
||||
typedef struct rc_api_update_achievement_response_t {
|
||||
/* The unique identifier of the achievement */
|
||||
uint32_t achievement_id;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_update_achievement_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_update_achievement_request(rc_api_request_t* request, const rc_api_update_achievement_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_update_achievement_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_update_achievement_response(rc_api_update_achievement_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_update_achievement_server_response(rc_api_update_achievement_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_update_achievement_response(rc_api_update_achievement_response_t* response);
|
||||
|
||||
/* --- Update Leaderboard --- */
|
||||
|
||||
/**
|
||||
* API parameters for an update leaderboard request.
|
||||
*/
|
||||
typedef struct rc_api_update_leaderboard_request_t {
|
||||
/* The username of the developer */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the leaderboard (0 to create a new leaderboard) */
|
||||
uint32_t leaderboard_id;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
/* The name of the leaderboard */
|
||||
const char* title;
|
||||
/* The description of the leaderboard */
|
||||
const char* description;
|
||||
/* The start trigger for the leaderboard */
|
||||
const char* start_trigger;
|
||||
/* The submit trigger for the leaderboard */
|
||||
const char* submit_trigger;
|
||||
/* The cancel trigger for the leaderboard */
|
||||
const char* cancel_trigger;
|
||||
/* The value definition for the leaderboard */
|
||||
const char* value_definition;
|
||||
/* The format of leaderboard values */
|
||||
const char* format;
|
||||
/* Whether or not lower scores are better for the leaderboard */
|
||||
uint32_t lower_is_better;
|
||||
}
|
||||
rc_api_update_leaderboard_request_t;
|
||||
|
||||
/**
|
||||
* Response data for an update leaderboard request.
|
||||
*/
|
||||
typedef struct rc_api_update_leaderboard_response_t {
|
||||
/* The unique identifier of the leaderboard */
|
||||
uint32_t leaderboard_id;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_update_leaderboard_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_update_leaderboard_request(rc_api_request_t* request, const rc_api_update_leaderboard_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_update_leaderboard_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_update_leaderboard_response(rc_api_update_leaderboard_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_update_leaderboard_server_response(rc_api_update_leaderboard_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_update_leaderboard_response(rc_api_update_leaderboard_response_t* response);
|
||||
|
||||
/* --- Fetch Badge Range --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch badge range request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_badge_range_request_t {
|
||||
/* Unused */
|
||||
uint32_t unused;
|
||||
}
|
||||
rc_api_fetch_badge_range_request_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch badge range request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_badge_range_response_t {
|
||||
/* The numeric identifier of the first valid badge ID */
|
||||
uint32_t first_badge_id;
|
||||
/* The numeric identifier of the first unassigned badge ID */
|
||||
uint32_t next_badge_id;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_badge_range_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_fetch_badge_range_request(rc_api_request_t* request, const rc_api_fetch_badge_range_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_fetch_badge_range_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_badge_range_response(rc_api_fetch_badge_range_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_badge_range_server_response(rc_api_fetch_badge_range_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_badge_range_response(rc_api_fetch_badge_range_response_t* response);
|
||||
|
||||
/* --- Add Game Hash --- */
|
||||
|
||||
/**
|
||||
* API parameters for an add game hash request.
|
||||
*/
|
||||
typedef struct rc_api_add_game_hash_request_t {
|
||||
/* The username of the developer */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the game (0 to create a new game entry) */
|
||||
uint32_t game_id;
|
||||
/* The unique identifier of the console for the game */
|
||||
uint32_t console_id;
|
||||
/* The title of the game */
|
||||
const char* title;
|
||||
/* The hash being added */
|
||||
const char* hash;
|
||||
/* A description of the hash being added (usually the normalized ROM name) */
|
||||
const char* hash_description;
|
||||
}
|
||||
rc_api_add_game_hash_request_t;
|
||||
|
||||
/**
|
||||
* Response data for an update code note request.
|
||||
*/
|
||||
typedef struct rc_api_add_game_hash_response_t {
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_add_game_hash_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_add_game_hash_request(rc_api_request_t* request, const rc_api_add_game_hash_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_add_game_hash_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_add_game_hash_response(rc_api_add_game_hash_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_add_game_hash_server_response(rc_api_add_game_hash_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_add_game_hash_response(rc_api_add_game_hash_response_t* response);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_EDITOR_H */
|
||||
230
3rdparty/rcheevos/include/rc_api_info.h
vendored
Normal file
230
3rdparty/rcheevos/include/rc_api_info.h
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
#ifndef RC_API_INFO_H
|
||||
#define RC_API_INFO_H
|
||||
|
||||
#include "rc_api_request.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/* --- Fetch Achievement Info --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch achievement info request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_achievement_info_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the achievement */
|
||||
uint32_t achievement_id;
|
||||
/* The 1-based index of the first entry to retrieve */
|
||||
uint32_t first_entry;
|
||||
/* The number of entries to retrieve */
|
||||
uint32_t count;
|
||||
/* Non-zero to only return unlocks earned by the user's friends */
|
||||
uint32_t friends_only;
|
||||
}
|
||||
rc_api_fetch_achievement_info_request_t;
|
||||
|
||||
/* An achievement awarded entry */
|
||||
typedef struct rc_api_achievement_awarded_entry_t {
|
||||
/* The user associated to the entry */
|
||||
const char* username;
|
||||
/* When the achievement was awarded */
|
||||
time_t awarded;
|
||||
}
|
||||
rc_api_achievement_awarded_entry_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch achievement info request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_achievement_info_response_t {
|
||||
/* The unique identifier of the achievement */
|
||||
uint32_t id;
|
||||
/* The unique identifier of the game to which the leaderboard is associated */
|
||||
uint32_t game_id;
|
||||
/* The number of times the achievement has been awarded */
|
||||
uint32_t num_awarded;
|
||||
/* The number of players that have earned at least one achievement for the game */
|
||||
uint32_t num_players;
|
||||
|
||||
/* An array of recently rewarded entries */
|
||||
rc_api_achievement_awarded_entry_t* recently_awarded;
|
||||
/* The number of items in the recently_awarded array */
|
||||
uint32_t num_recently_awarded;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_achievement_info_response_t;
|
||||
|
||||
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);
|
||||
/* [deprecated] use rc_api_process_fetch_achievement_info_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_achievement_info_response(rc_api_fetch_achievement_info_response_t* response, const char* server_response);
|
||||
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);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_achievement_info_response(rc_api_fetch_achievement_info_response_t* response);
|
||||
|
||||
/* --- Fetch Leaderboard Info --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch leaderboard info request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_leaderboard_info_request_t {
|
||||
/* The unique identifier of the leaderboard */
|
||||
uint32_t leaderboard_id;
|
||||
/* The number of entries to retrieve */
|
||||
uint32_t count;
|
||||
/* The 1-based index of the first entry to retrieve */
|
||||
uint32_t first_entry;
|
||||
/* The username of the player around whom the entries should be returned */
|
||||
const char* username;
|
||||
}
|
||||
rc_api_fetch_leaderboard_info_request_t;
|
||||
|
||||
/* A leaderboard info entry */
|
||||
typedef struct rc_api_lboard_info_entry_t {
|
||||
/* The user associated to the entry */
|
||||
const char* username;
|
||||
/* The rank of the entry */
|
||||
uint32_t rank;
|
||||
/* The index of the entry */
|
||||
uint32_t index;
|
||||
/* The value of the entry */
|
||||
int32_t score;
|
||||
/* When the entry was submitted */
|
||||
time_t submitted;
|
||||
}
|
||||
rc_api_lboard_info_entry_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch leaderboard info request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_leaderboard_info_response_t {
|
||||
/* The unique identifier of the leaderboard */
|
||||
uint32_t id;
|
||||
/* The format to pass to rc_format_value to format the leaderboard value */
|
||||
int format;
|
||||
/* If non-zero, indicates that lower scores appear first */
|
||||
uint32_t lower_is_better;
|
||||
/* The title of the leaderboard */
|
||||
const char* title;
|
||||
/* The description of the leaderboard */
|
||||
const char* description;
|
||||
/* The definition of the leaderboard to be passed to rc_runtime_activate_lboard */
|
||||
const char* definition;
|
||||
/* The unique identifier of the game to which the leaderboard is associated */
|
||||
uint32_t game_id;
|
||||
/* The author of the leaderboard */
|
||||
const char* author;
|
||||
/* When the leaderboard was first uploaded to the server */
|
||||
time_t created;
|
||||
/* When the leaderboard was last modified on the server */
|
||||
time_t updated;
|
||||
|
||||
/* An array of requested entries */
|
||||
rc_api_lboard_info_entry_t* entries;
|
||||
/* 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;
|
||||
}
|
||||
rc_api_fetch_leaderboard_info_response_t;
|
||||
|
||||
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);
|
||||
/* [deprecated] use rc_api_process_fetch_leaderboard_info_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_leaderboard_info_response(rc_api_fetch_leaderboard_info_response_t* response, const char* server_response);
|
||||
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);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_leaderboard_info_response(rc_api_fetch_leaderboard_info_response_t* response);
|
||||
|
||||
/* --- Fetch Games List --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch games list request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_games_list_request_t {
|
||||
/* The unique identifier of the console to query */
|
||||
uint32_t console_id;
|
||||
}
|
||||
rc_api_fetch_games_list_request_t;
|
||||
|
||||
/* A game list entry */
|
||||
typedef struct rc_api_game_list_entry_t {
|
||||
/* The unique identifier of the game */
|
||||
uint32_t id;
|
||||
/* The name of the game */
|
||||
const char* name;
|
||||
}
|
||||
rc_api_game_list_entry_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch games list request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_games_list_response_t {
|
||||
/* An array of requested entries */
|
||||
rc_api_game_list_entry_t* entries;
|
||||
/* The number of items in the entries array */
|
||||
uint32_t num_entries;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_games_list_response_t;
|
||||
|
||||
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);
|
||||
/* [deprecated] use rc_api_process_fetch_games_list_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_games_list_response(rc_api_fetch_games_list_response_t* response, const char* server_response);
|
||||
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);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_games_list_response(rc_api_fetch_games_list_response_t* response);
|
||||
|
||||
/* --- Fetch Game Titles --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch games list request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_game_titles_request_t {
|
||||
/* An array of game ids to fetch titles for */
|
||||
const uint32_t* game_ids;
|
||||
/* The number of items in the game_ids array */
|
||||
uint32_t num_game_ids;
|
||||
}
|
||||
rc_api_fetch_game_titles_request_t;
|
||||
|
||||
/* A game title entry */
|
||||
typedef struct rc_api_game_title_entry_t {
|
||||
/* The unique identifier of the game */
|
||||
uint32_t id;
|
||||
/* The title of the game */
|
||||
const char* title;
|
||||
/* The image name for the game badge */
|
||||
const char* image_name;
|
||||
}
|
||||
rc_api_game_title_entry_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch games title request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_game_titles_response_t {
|
||||
/* An array of requested entries */
|
||||
rc_api_game_title_entry_t* entries;
|
||||
/* The number of items in the entries array */
|
||||
uint32_t num_entries;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_game_titles_response_t;
|
||||
|
||||
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);
|
||||
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);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_game_titles_response(rc_api_fetch_game_titles_response_t* response);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_API_INFO_H */
|
||||
64
3rdparty/rcheevos/include/rc_api_request.h
vendored
Normal file
64
3rdparty/rcheevos/include/rc_api_request.h
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef RC_API_REQUEST_H
|
||||
#define RC_API_REQUEST_H
|
||||
|
||||
#include "rc_error.h"
|
||||
#include "rc_util.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* A constructed request to send to the retroachievements server.
|
||||
*/
|
||||
typedef struct rc_api_request_t {
|
||||
/* The URL to send the request to (contains protocol, host, path, and query args) */
|
||||
const char* url;
|
||||
/* Additional query args that should be sent via a POST command. If null, GET may be used */
|
||||
const char* post_data;
|
||||
/* The HTTP Content-Type of the POST data. */
|
||||
const char* content_type;
|
||||
|
||||
/* Storage for the url and post_data */
|
||||
rc_buffer_t buffer;
|
||||
}
|
||||
rc_api_request_t;
|
||||
|
||||
/**
|
||||
* Common attributes for all server responses.
|
||||
*/
|
||||
typedef struct rc_api_response_t {
|
||||
/* Server-provided success indicator (non-zero on success, zero on failure) */
|
||||
int succeeded;
|
||||
/* Server-provided message associated to the failure */
|
||||
const char* error_message;
|
||||
/* Server-provided error code associated to the failure */
|
||||
const char* error_code;
|
||||
|
||||
/* Storage for the response data */
|
||||
rc_buffer_t buffer;
|
||||
}
|
||||
rc_api_response_t;
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_request(rc_api_request_t* request);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_api_set_host(const char* hostname);
|
||||
RC_EXPORT void RC_CCONV rc_api_set_image_host(const char* hostname);
|
||||
|
||||
typedef struct rc_api_server_response_t {
|
||||
/* Pointer to the data returned from the server */
|
||||
const char* body;
|
||||
/* Length of data returned from the server (Content-Length) */
|
||||
size_t body_length;
|
||||
/* HTTP status code returned from the server */
|
||||
int http_status_code;
|
||||
} rc_api_server_response_t;
|
||||
|
||||
enum {
|
||||
RC_API_SERVER_RESPONSE_CLIENT_ERROR = -1,
|
||||
RC_API_SERVER_RESPONSE_RETRYABLE_CLIENT_ERROR = -2
|
||||
};
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_API_REQUEST_H */
|
||||
314
3rdparty/rcheevos/include/rc_api_runtime.h
vendored
Normal file
314
3rdparty/rcheevos/include/rc_api_runtime.h
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
#ifndef RC_API_RUNTIME_H
|
||||
#define RC_API_RUNTIME_H
|
||||
|
||||
#include "rc_api_request.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/* --- Fetch Image --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch image request.
|
||||
* NOTE: fetch image server response is the raw image data. There is no rc_api_process_fetch_image_response function.
|
||||
*/
|
||||
typedef struct rc_api_fetch_image_request_t {
|
||||
/* The name of the image to fetch */
|
||||
const char* image_name;
|
||||
/* The type of image to fetch */
|
||||
uint32_t image_type;
|
||||
}
|
||||
rc_api_fetch_image_request_t;
|
||||
|
||||
#define RC_IMAGE_TYPE_GAME 1
|
||||
#define RC_IMAGE_TYPE_ACHIEVEMENT 2
|
||||
#define RC_IMAGE_TYPE_ACHIEVEMENT_LOCKED 3
|
||||
#define RC_IMAGE_TYPE_USER 4
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_fetch_image_request(rc_api_request_t* request, const rc_api_fetch_image_request_t* api_params);
|
||||
|
||||
/* --- Resolve Hash --- */
|
||||
|
||||
/**
|
||||
* API parameters for a resolve hash request.
|
||||
*/
|
||||
typedef struct rc_api_resolve_hash_request_t {
|
||||
/* Unused - hash lookup does not require credentials */
|
||||
const char* username;
|
||||
/* Unused - hash lookup does not require credentials */
|
||||
const char* api_token;
|
||||
/* The generated hash of the game to be identified */
|
||||
const char* game_hash;
|
||||
}
|
||||
rc_api_resolve_hash_request_t;
|
||||
|
||||
/**
|
||||
* Response data for a resolve hash request.
|
||||
*/
|
||||
typedef struct rc_api_resolve_hash_response_t {
|
||||
/* The unique identifier of the game, 0 if no match was found */
|
||||
uint32_t game_id;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_resolve_hash_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_resolve_hash_request(rc_api_request_t* request, const rc_api_resolve_hash_request_t* api_params);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_resolve_hash_response(rc_api_resolve_hash_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_resolve_hash_server_response(rc_api_resolve_hash_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_resolve_hash_response(rc_api_resolve_hash_response_t* response);
|
||||
|
||||
/* --- Fetch Game Data --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch game data request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_game_data_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
}
|
||||
rc_api_fetch_game_data_request_t;
|
||||
|
||||
/* A leaderboard definition */
|
||||
typedef struct rc_api_leaderboard_definition_t {
|
||||
/* The unique identifier of the leaderboard */
|
||||
uint32_t id;
|
||||
/* The format to pass to rc_format_value to format the leaderboard value */
|
||||
int format;
|
||||
/* The title of the leaderboard */
|
||||
const char* title;
|
||||
/* The description of the leaderboard */
|
||||
const char* description;
|
||||
/* The definition of the leaderboard to be passed to rc_runtime_activate_lboard */
|
||||
const char* definition;
|
||||
/* Non-zero if lower values are better for this leaderboard */
|
||||
uint8_t lower_is_better;
|
||||
/* Non-zero if the leaderboard should not be displayed in a list of leaderboards */
|
||||
uint8_t hidden;
|
||||
}
|
||||
rc_api_leaderboard_definition_t;
|
||||
|
||||
/* An achievement definition */
|
||||
typedef struct rc_api_achievement_definition_t {
|
||||
/* The unique identifier of the achievement */
|
||||
uint32_t id;
|
||||
/* The number of points the achievement is worth */
|
||||
uint32_t points;
|
||||
/* The achievement category (core, unofficial) */
|
||||
uint32_t category;
|
||||
/* The title of the achievement */
|
||||
const char* title;
|
||||
/* The dscription of the achievement */
|
||||
const char* description;
|
||||
/* The definition of the achievement to be passed to rc_runtime_activate_achievement */
|
||||
const char* definition;
|
||||
/* The author of the achievment */
|
||||
const char* author;
|
||||
/* The image name for the achievement badge */
|
||||
const char* badge_name;
|
||||
/* When the achievement was first uploaded to the server */
|
||||
time_t created;
|
||||
/* When the achievement was last modified on the server */
|
||||
time_t updated;
|
||||
/* The achievement type (win/progression/missable) */
|
||||
uint32_t type;
|
||||
/* The approximate rarity of the achievement (X% of users have earned the achievement) */
|
||||
float rarity;
|
||||
/* The approximate rarity of the achievement in hardcore (X% of users have earned the achievement in hardcore) */
|
||||
float rarity_hardcore;
|
||||
}
|
||||
rc_api_achievement_definition_t;
|
||||
|
||||
#define RC_ACHIEVEMENT_CATEGORY_CORE 3
|
||||
#define RC_ACHIEVEMENT_CATEGORY_UNOFFICIAL 5
|
||||
|
||||
#define RC_ACHIEVEMENT_TYPE_STANDARD 0
|
||||
#define RC_ACHIEVEMENT_TYPE_MISSABLE 1
|
||||
#define RC_ACHIEVEMENT_TYPE_PROGRESSION 2
|
||||
#define RC_ACHIEVEMENT_TYPE_WIN 3
|
||||
|
||||
/**
|
||||
* Response data for a fetch game data request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_game_data_response_t {
|
||||
/* The unique identifier of the game */
|
||||
uint32_t id;
|
||||
/* The console associated to the game */
|
||||
uint32_t console_id;
|
||||
/* The title of the game */
|
||||
const char* title;
|
||||
/* The image name for the game badge */
|
||||
const char* image_name;
|
||||
/* The rich presence script for the game to be passed to rc_runtime_activate_richpresence */
|
||||
const char* rich_presence_script;
|
||||
|
||||
/* An array of achievements for the game */
|
||||
rc_api_achievement_definition_t* achievements;
|
||||
/* The number of items in the achievements array */
|
||||
uint32_t num_achievements;
|
||||
|
||||
/* An array of leaderboards for the game */
|
||||
rc_api_leaderboard_definition_t* leaderboards;
|
||||
/* The number of items in the leaderboards array */
|
||||
uint32_t num_leaderboards;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_game_data_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_fetch_game_data_request(rc_api_request_t* request, const rc_api_fetch_game_data_request_t* api_params);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_game_data_response(rc_api_fetch_game_data_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_game_data_server_response(rc_api_fetch_game_data_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_game_data_response(rc_api_fetch_game_data_response_t* response);
|
||||
|
||||
/* --- Ping --- */
|
||||
|
||||
/**
|
||||
* API parameters for a ping request.
|
||||
*/
|
||||
typedef struct rc_api_ping_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
/* (optional) The current rich presence evaluation for the user */
|
||||
const char* rich_presence;
|
||||
/* (recommended) The hash associated to the game being played */
|
||||
const char* game_hash;
|
||||
/* Non-zero if hardcore is currently enabled (ignored if game_hash is null) */
|
||||
uint32_t hardcore;
|
||||
}
|
||||
rc_api_ping_request_t;
|
||||
|
||||
/**
|
||||
* Response data for a ping request.
|
||||
*/
|
||||
typedef struct rc_api_ping_response_t {
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_ping_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_ping_request(rc_api_request_t* request, const rc_api_ping_request_t* api_params);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_ping_response(rc_api_ping_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_ping_server_response(rc_api_ping_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_ping_response(rc_api_ping_response_t* response);
|
||||
|
||||
/* --- Award Achievement --- */
|
||||
|
||||
/**
|
||||
* API parameters for an award achievement request.
|
||||
*/
|
||||
typedef struct rc_api_award_achievement_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the achievement */
|
||||
uint32_t achievement_id;
|
||||
/* Non-zero if the achievement was earned in hardcore */
|
||||
uint32_t hardcore;
|
||||
/* The hash associated to the game being played */
|
||||
const char* game_hash;
|
||||
/* The number of seconds since the achievement was unlocked */
|
||||
uint32_t seconds_since_unlock;
|
||||
}
|
||||
rc_api_award_achievement_request_t;
|
||||
|
||||
/**
|
||||
* Response data for an award achievement request.
|
||||
*/
|
||||
typedef struct rc_api_award_achievement_response_t {
|
||||
/* The unique identifier of the achievement that was awarded */
|
||||
uint32_t awarded_achievement_id;
|
||||
/* The updated player score */
|
||||
uint32_t new_player_score;
|
||||
/* The updated player softcore score */
|
||||
uint32_t new_player_score_softcore;
|
||||
/* The number of achievements the user has not yet unlocked for this game
|
||||
* (in hardcore/non-hardcore per hardcore flag in request) */
|
||||
uint32_t achievements_remaining;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_award_achievement_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_award_achievement_request(rc_api_request_t* request, const rc_api_award_achievement_request_t* api_params);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_award_achievement_response(rc_api_award_achievement_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_award_achievement_server_response(rc_api_award_achievement_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_award_achievement_response(rc_api_award_achievement_response_t* response);
|
||||
|
||||
/* --- Submit Leaderboard Entry --- */
|
||||
|
||||
/**
|
||||
* API parameters for a submit lboard entry request.
|
||||
*/
|
||||
typedef struct rc_api_submit_lboard_entry_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the leaderboard */
|
||||
uint32_t leaderboard_id;
|
||||
/* The value being submitted */
|
||||
int32_t score;
|
||||
/* The hash associated to the game being played */
|
||||
const char* game_hash;
|
||||
/* The number of seconds since the leaderboard attempt was completed */
|
||||
uint32_t seconds_since_completion;
|
||||
}
|
||||
rc_api_submit_lboard_entry_request_t;
|
||||
|
||||
/* A leaderboard entry */
|
||||
typedef struct rc_api_lboard_entry_t {
|
||||
/* The user associated to the entry */
|
||||
const char* username;
|
||||
/* The rank of the entry */
|
||||
uint32_t rank;
|
||||
/* The value of the entry */
|
||||
int32_t score;
|
||||
}
|
||||
rc_api_lboard_entry_t;
|
||||
|
||||
/**
|
||||
* Response data for a submit lboard entry request.
|
||||
*/
|
||||
typedef struct rc_api_submit_lboard_entry_response_t {
|
||||
/* The value that was submitted */
|
||||
int32_t submitted_score;
|
||||
/* The player's best submitted value */
|
||||
int32_t best_score;
|
||||
/* The player's new rank within the leaderboard */
|
||||
uint32_t new_rank;
|
||||
/* The total number of entries in the leaderboard */
|
||||
uint32_t num_entries;
|
||||
|
||||
/* An array of the top entries for the leaderboard */
|
||||
rc_api_lboard_entry_t* top_entries;
|
||||
/* The number of items in the top_entries array */
|
||||
uint32_t num_top_entries;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_submit_lboard_entry_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_submit_lboard_entry_request(rc_api_request_t* request, const rc_api_submit_lboard_entry_request_t* api_params);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_submit_lboard_entry_response(rc_api_submit_lboard_entry_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_submit_lboard_entry_server_response(rc_api_submit_lboard_entry_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_submit_lboard_entry_response(rc_api_submit_lboard_entry_response_t* response);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_API_RUNTIME_H */
|
||||
152
3rdparty/rcheevos/include/rc_api_user.h
vendored
Normal file
152
3rdparty/rcheevos/include/rc_api_user.h
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
#ifndef RC_API_USER_H
|
||||
#define RC_API_USER_H
|
||||
|
||||
#include "rc_api_request.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/* --- Login --- */
|
||||
|
||||
/**
|
||||
* API parameters for a login request.
|
||||
* If both password and api_token are provided, api_token will be ignored.
|
||||
*/
|
||||
typedef struct rc_api_login_request_t {
|
||||
/* The username of the player being logged in */
|
||||
const char* username;
|
||||
/* The API token from a previous login */
|
||||
const char* api_token;
|
||||
/* The player's password */
|
||||
const char* password;
|
||||
}
|
||||
rc_api_login_request_t;
|
||||
|
||||
/**
|
||||
* Response data for a login request.
|
||||
*/
|
||||
typedef struct rc_api_login_response_t {
|
||||
/* The case-corrected username of the player */
|
||||
const char* username;
|
||||
/* The API token to use for all future requests */
|
||||
const char* api_token;
|
||||
/* The current score of the player */
|
||||
uint32_t score;
|
||||
/* The current softcore score of the player */
|
||||
uint32_t score_softcore;
|
||||
/* The number of unread messages waiting for the player on the web site */
|
||||
uint32_t num_unread_messages;
|
||||
/* The preferred name to display for the player */
|
||||
const char* display_name;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_login_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_login_request(rc_api_request_t* request, const rc_api_login_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_login_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_login_response(rc_api_login_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_login_server_response(rc_api_login_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_login_response(rc_api_login_response_t* response);
|
||||
|
||||
/* --- Start Session --- */
|
||||
|
||||
/**
|
||||
* API parameters for a start session request.
|
||||
*/
|
||||
typedef struct rc_api_start_session_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
/* (recommended) The hash associated to the game being played */
|
||||
const char* game_hash;
|
||||
/* Non-zero if hardcore is currently enabled (ignored if game_hash is null) */
|
||||
uint32_t hardcore;
|
||||
}
|
||||
rc_api_start_session_request_t;
|
||||
|
||||
/**
|
||||
* Response data for an achievement unlock.
|
||||
*/
|
||||
typedef struct rc_api_unlock_entry_t {
|
||||
/* The unique identifier of the unlocked achievement */
|
||||
uint32_t achievement_id;
|
||||
/* When the achievement was unlocked */
|
||||
time_t when;
|
||||
}
|
||||
rc_api_unlock_entry_t;
|
||||
|
||||
/**
|
||||
* Response data for a start session request.
|
||||
*/
|
||||
typedef struct rc_api_start_session_response_t {
|
||||
/* An array of hardcore user unlocks */
|
||||
rc_api_unlock_entry_t* hardcore_unlocks;
|
||||
/* An array of user unlocks */
|
||||
rc_api_unlock_entry_t* unlocks;
|
||||
|
||||
/* The number of items in the hardcore_unlocks array */
|
||||
uint32_t num_hardcore_unlocks;
|
||||
/* The number of items in the unlocks array */
|
||||
uint32_t num_unlocks;
|
||||
|
||||
/* The server timestamp when the response was generated */
|
||||
time_t server_now;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_start_session_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_start_session_request(rc_api_request_t* request, const rc_api_start_session_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_start_session_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_start_session_response(rc_api_start_session_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_start_session_server_response(rc_api_start_session_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_start_session_response(rc_api_start_session_response_t* response);
|
||||
|
||||
/* --- Fetch User Unlocks --- */
|
||||
|
||||
/**
|
||||
* API parameters for a fetch user unlocks request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_user_unlocks_request_t {
|
||||
/* The username of the player */
|
||||
const char* username;
|
||||
/* The API token from the login request */
|
||||
const char* api_token;
|
||||
/* The unique identifier of the game */
|
||||
uint32_t game_id;
|
||||
/* Non-zero to fetch hardcore unlocks, 0 to fetch non-hardcore unlocks */
|
||||
uint32_t hardcore;
|
||||
}
|
||||
rc_api_fetch_user_unlocks_request_t;
|
||||
|
||||
/**
|
||||
* Response data for a fetch user unlocks request.
|
||||
*/
|
||||
typedef struct rc_api_fetch_user_unlocks_response_t {
|
||||
/* An array of achievement IDs previously unlocked by the user */
|
||||
uint32_t* achievement_ids;
|
||||
/* The number of items in the achievement_ids array */
|
||||
uint32_t num_achievement_ids;
|
||||
|
||||
/* Common server-provided response information */
|
||||
rc_api_response_t response;
|
||||
}
|
||||
rc_api_fetch_user_unlocks_response_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_api_init_fetch_user_unlocks_request(rc_api_request_t* request, const rc_api_fetch_user_unlocks_request_t* api_params);
|
||||
/* [deprecated] use rc_api_process_fetch_user_unlocks_server_response instead */
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_user_unlocks_response(rc_api_fetch_user_unlocks_response_t* response, const char* server_response);
|
||||
RC_EXPORT int RC_CCONV rc_api_process_fetch_user_unlocks_server_response(rc_api_fetch_user_unlocks_response_t* response, const rc_api_server_response_t* server_response);
|
||||
RC_EXPORT void RC_CCONV rc_api_destroy_fetch_user_unlocks_response(rc_api_fetch_user_unlocks_response_t* response);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_API_H */
|
||||
722
3rdparty/rcheevos/include/rc_client.h
vendored
Normal file
722
3rdparty/rcheevos/include/rc_client.h
vendored
Normal file
@@ -0,0 +1,722 @@
|
||||
#ifndef RC_CLIENT_H
|
||||
#define RC_CLIENT_H
|
||||
|
||||
#include "rc_api_request.h"
|
||||
#include "rc_error.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/* implementation abstracted in rc_client_internal.h */
|
||||
typedef struct rc_client_t rc_client_t;
|
||||
typedef struct rc_client_async_handle_t rc_client_async_handle_t;
|
||||
|
||||
/*****************************************************************************\
|
||||
| Callbacks |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Callback used to read num_bytes bytes from memory starting at address into buffer.
|
||||
* Returns the number of bytes read. A return value of 0 indicates the address was invalid.
|
||||
*/
|
||||
typedef uint32_t (RC_CCONV *rc_client_read_memory_func_t)(uint32_t address, uint8_t* buffer, uint32_t num_bytes, rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Internal method passed to rc_client_server_call_t to process the server response.
|
||||
*/
|
||||
typedef void (RC_CCONV *rc_client_server_callback_t)(const rc_api_server_response_t* server_response, void* callback_data);
|
||||
|
||||
/**
|
||||
* Callback used to issue a request to the server.
|
||||
*/
|
||||
typedef void (RC_CCONV *rc_client_server_call_t)(const rc_api_request_t* request, rc_client_server_callback_t callback, void* callback_data, rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Generic callback for asynchronous eventing.
|
||||
*/
|
||||
typedef void (RC_CCONV *rc_client_callback_t)(int result, const char* error_message, rc_client_t* client, void* userdata);
|
||||
|
||||
/**
|
||||
* Callback for logging or displaying a message.
|
||||
*/
|
||||
typedef void (RC_CCONV *rc_client_message_callback_t)(const char* message, const rc_client_t* client);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Runtime |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Creates a new rc_client_t object.
|
||||
*/
|
||||
RC_EXPORT rc_client_t* RC_CCONV rc_client_create(rc_client_read_memory_func_t read_memory_function, rc_client_server_call_t server_call_function);
|
||||
|
||||
/**
|
||||
* Releases resources associated to a rc_client_t object.
|
||||
* Pointer will no longer be valid after making this call.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_destroy(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Sets whether hardcore is enabled (on by default).
|
||||
* Can be called with a game loaded.
|
||||
* Enabling hardcore with a game loaded will raise an RC_CLIENT_EVENT_RESET
|
||||
* event. Processing will be disabled until rc_client_reset is called.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_hardcore_enabled(rc_client_t* client, int enabled);
|
||||
|
||||
/**
|
||||
* Gets whether hardcore is enabled (on by default).
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_get_hardcore_enabled(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Sets whether encore mode is enabled (off by default).
|
||||
* Evaluated when loading a game. Has no effect while a game is loaded.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_encore_mode_enabled(rc_client_t* client, int enabled);
|
||||
|
||||
/**
|
||||
* Gets whether encore mode is enabled (off by default).
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_get_encore_mode_enabled(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Sets whether unofficial achievements should be loaded.
|
||||
* Evaluated when loading a game. Has no effect while a game is loaded.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_unofficial_enabled(rc_client_t* client, int enabled);
|
||||
|
||||
/**
|
||||
* Gets whether unofficial achievements should be loaded.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_get_unofficial_enabled(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Sets whether spectator mode is enabled (off by default).
|
||||
* If enabled, events for achievement unlocks and leaderboard submissions will be
|
||||
* raised, but server calls to actually perform the unlock/submit will not occur.
|
||||
* Can be modified while a game is loaded. Evaluated at unlock/submit time.
|
||||
* Cannot be modified if disabled before a game is loaded.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_spectator_mode_enabled(rc_client_t* client, int enabled);
|
||||
|
||||
/**
|
||||
* Gets whether spectator mode is enabled (off by default).
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_get_spectator_mode_enabled(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Attaches client-specific data to the runtime.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_userdata(rc_client_t* client, void* userdata);
|
||||
|
||||
/**
|
||||
* Gets the client-specific data attached to the runtime.
|
||||
*/
|
||||
RC_EXPORT void* RC_CCONV rc_client_get_userdata(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Sets the name of the server to use.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_host(const rc_client_t* client, const char* hostname);
|
||||
|
||||
typedef uint64_t rc_clock_t;
|
||||
typedef rc_clock_t (RC_CCONV *rc_get_time_millisecs_func_t)(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Specifies a function that returns a value that increases once per millisecond.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_get_time_millisecs_function(rc_client_t* client, rc_get_time_millisecs_func_t handler);
|
||||
|
||||
/**
|
||||
* Marks an async process as aborted. The associated callback will not be called.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_abort_async(rc_client_t* client, rc_client_async_handle_t* async_handle);
|
||||
|
||||
/**
|
||||
* Gets a clause that can be added to the User-Agent to identify the version of rcheevos being used.
|
||||
*/
|
||||
RC_EXPORT size_t RC_CCONV rc_client_get_user_agent_clause(rc_client_t* client, char buffer[], size_t buffer_size);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Logging |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Sets the logging level and provides a callback to be called to do the logging.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_enable_logging(rc_client_t* client, int level, rc_client_message_callback_t callback);
|
||||
enum {
|
||||
RC_CLIENT_LOG_LEVEL_NONE = 0,
|
||||
RC_CLIENT_LOG_LEVEL_ERROR = 1,
|
||||
RC_CLIENT_LOG_LEVEL_WARN = 2,
|
||||
RC_CLIENT_LOG_LEVEL_INFO = 3,
|
||||
RC_CLIENT_LOG_LEVEL_VERBOSE = 4,
|
||||
NUM_RC_CLIENT_LOG_LEVELS = 5
|
||||
};
|
||||
|
||||
/*****************************************************************************\
|
||||
| User |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Attempt to login a user.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_login_with_password(rc_client_t* client,
|
||||
const char* username, const char* password,
|
||||
rc_client_callback_t callback, void* callback_userdata);
|
||||
|
||||
/**
|
||||
* Attempt to login a user.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_login_with_token(rc_client_t* client,
|
||||
const char* username, const char* token,
|
||||
rc_client_callback_t callback, void* callback_userdata);
|
||||
|
||||
/**
|
||||
* Logout the user.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_logout(rc_client_t* client);
|
||||
|
||||
typedef struct rc_client_user_t {
|
||||
const char* display_name;
|
||||
const char* username;
|
||||
const char* token;
|
||||
uint32_t score;
|
||||
uint32_t score_softcore;
|
||||
uint32_t num_unread_messages;
|
||||
} rc_client_user_t;
|
||||
|
||||
/**
|
||||
* Gets information about the logged in user. Will return NULL if the user is not logged in.
|
||||
*/
|
||||
RC_EXPORT const rc_client_user_t* RC_CCONV rc_client_get_user_info(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Gets the URL for the user's profile picture.
|
||||
* Returns RC_OK on success.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_user_get_image_url(const rc_client_user_t* user, char buffer[], size_t buffer_size);
|
||||
|
||||
typedef struct rc_client_user_game_summary_t {
|
||||
uint32_t num_core_achievements;
|
||||
uint32_t num_unofficial_achievements;
|
||||
uint32_t num_unlocked_achievements;
|
||||
uint32_t num_unsupported_achievements;
|
||||
|
||||
uint32_t points_core;
|
||||
uint32_t points_unlocked;
|
||||
} rc_client_user_game_summary_t;
|
||||
|
||||
/**
|
||||
* Gets a breakdown of the number of achievements in the game, and how many the user has unlocked.
|
||||
* Used for the "You have unlocked X of Y achievements" message shown when the game starts.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_get_user_game_summary(const rc_client_t* client, rc_client_user_game_summary_t* summary);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Game |
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifdef RC_CLIENT_SUPPORTS_HASH
|
||||
/**
|
||||
* Start loading an unidentified game.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_identify_and_load_game(rc_client_t* client,
|
||||
uint32_t console_id, const char* file_path,
|
||||
const uint8_t* data, size_t data_size,
|
||||
rc_client_callback_t callback, void* callback_userdata);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Start loading a game.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_load_game(rc_client_t* client, const char* hash,
|
||||
rc_client_callback_t callback, void* callback_userdata);
|
||||
|
||||
/**
|
||||
* Gets the current progress of the asynchronous load game process.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_get_load_game_state(const rc_client_t* client);
|
||||
enum {
|
||||
RC_CLIENT_LOAD_GAME_STATE_NONE,
|
||||
RC_CLIENT_LOAD_GAME_STATE_IDENTIFYING_GAME,
|
||||
RC_CLIENT_LOAD_GAME_STATE_AWAIT_LOGIN,
|
||||
RC_CLIENT_LOAD_GAME_STATE_FETCHING_GAME_DATA,
|
||||
RC_CLIENT_LOAD_GAME_STATE_STARTING_SESSION,
|
||||
RC_CLIENT_LOAD_GAME_STATE_DONE,
|
||||
RC_CLIENT_LOAD_GAME_STATE_ABORTED
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines if a game was successfully identified and loaded.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_is_game_loaded(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Unloads the current game.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_unload_game(rc_client_t* client);
|
||||
|
||||
typedef struct rc_client_game_t {
|
||||
uint32_t id;
|
||||
uint32_t console_id;
|
||||
const char* title;
|
||||
const char* hash;
|
||||
const char* badge_name;
|
||||
} rc_client_game_t;
|
||||
|
||||
/**
|
||||
* Get information about the current game. Returns NULL if no game is loaded.
|
||||
* NOTE: returns a dummy game record if an unidentified game is loaded.
|
||||
*/
|
||||
RC_EXPORT const rc_client_game_t* RC_CCONV rc_client_get_game_info(const rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Gets the URL for the game image.
|
||||
* Returns RC_OK on success.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_game_get_image_url(const rc_client_game_t* game, char buffer[], size_t buffer_size);
|
||||
|
||||
#ifdef RC_CLIENT_SUPPORTS_HASH
|
||||
/**
|
||||
* Changes the active disc in a multi-disc game.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_change_media(rc_client_t* client, const char* file_path,
|
||||
const uint8_t* data, size_t data_size, rc_client_callback_t callback, void* callback_userdata);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Changes the active disc in a multi-disc game.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_change_media_from_hash(rc_client_t* client, const char* hash,
|
||||
rc_client_callback_t callback, void* callback_userdata);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Subsets |
|
||||
\*****************************************************************************/
|
||||
|
||||
typedef struct rc_client_subset_t {
|
||||
uint32_t id;
|
||||
const char* title;
|
||||
char badge_name[16];
|
||||
|
||||
uint32_t num_achievements;
|
||||
uint32_t num_leaderboards;
|
||||
} rc_client_subset_t;
|
||||
|
||||
RC_EXPORT const rc_client_subset_t* RC_CCONV rc_client_get_subset_info(rc_client_t* client, uint32_t subset_id);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Achievements |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_CLIENT_ACHIEVEMENT_STATE_INACTIVE = 0, /* unprocessed */
|
||||
RC_CLIENT_ACHIEVEMENT_STATE_ACTIVE = 1, /* eligible to trigger */
|
||||
RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED = 2, /* earned by user */
|
||||
RC_CLIENT_ACHIEVEMENT_STATE_DISABLED = 3, /* not supported by this version of the runtime */
|
||||
NUM_RC_CLIENT_ACHIEVEMENT_STATES = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
RC_CLIENT_ACHIEVEMENT_CATEGORY_NONE = 0,
|
||||
RC_CLIENT_ACHIEVEMENT_CATEGORY_CORE = (1 << 0),
|
||||
RC_CLIENT_ACHIEVEMENT_CATEGORY_UNOFFICIAL = (1 << 1),
|
||||
RC_CLIENT_ACHIEVEMENT_CATEGORY_CORE_AND_UNOFFICIAL = RC_CLIENT_ACHIEVEMENT_CATEGORY_CORE | RC_CLIENT_ACHIEVEMENT_CATEGORY_UNOFFICIAL
|
||||
};
|
||||
|
||||
enum {
|
||||
RC_CLIENT_ACHIEVEMENT_TYPE_STANDARD = 0,
|
||||
RC_CLIENT_ACHIEVEMENT_TYPE_MISSABLE = 1,
|
||||
RC_CLIENT_ACHIEVEMENT_TYPE_PROGRESSION = 2,
|
||||
RC_CLIENT_ACHIEVEMENT_TYPE_WIN = 3
|
||||
};
|
||||
|
||||
enum {
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_UNKNOWN = 0,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_LOCKED = 1,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_UNLOCKED = 2,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_UNSUPPORTED = 3,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_UNOFFICIAL = 4,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_RECENTLY_UNLOCKED = 5,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_ACTIVE_CHALLENGE = 6,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_ALMOST_THERE = 7,
|
||||
RC_CLIENT_ACHIEVEMENT_BUCKET_UNSYNCED = 8,
|
||||
NUM_RC_CLIENT_ACHIEVEMENT_BUCKETS = 9
|
||||
};
|
||||
|
||||
enum {
|
||||
RC_CLIENT_ACHIEVEMENT_UNLOCKED_NONE = 0,
|
||||
RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE = (1 << 0),
|
||||
RC_CLIENT_ACHIEVEMENT_UNLOCKED_HARDCORE = (1 << 1),
|
||||
RC_CLIENT_ACHIEVEMENT_UNLOCKED_BOTH = RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE | RC_CLIENT_ACHIEVEMENT_UNLOCKED_HARDCORE
|
||||
};
|
||||
|
||||
typedef struct rc_client_achievement_t {
|
||||
const char* title;
|
||||
const char* description;
|
||||
char badge_name[8];
|
||||
char measured_progress[24];
|
||||
float measured_percent;
|
||||
uint32_t id;
|
||||
uint32_t points;
|
||||
time_t unlock_time;
|
||||
uint8_t state;
|
||||
uint8_t category;
|
||||
uint8_t bucket;
|
||||
uint8_t unlocked;
|
||||
/* minimum version: 11.1 */
|
||||
float rarity;
|
||||
float rarity_hardcore;
|
||||
uint8_t type;
|
||||
} rc_client_achievement_t;
|
||||
|
||||
/**
|
||||
* Get information about an achievement. Returns NULL if not found.
|
||||
*/
|
||||
RC_EXPORT const rc_client_achievement_t* RC_CCONV rc_client_get_achievement_info(rc_client_t* client, uint32_t id);
|
||||
|
||||
/**
|
||||
* Gets the URL for the achievement image.
|
||||
* Returns RC_OK on success.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_achievement_get_image_url(const rc_client_achievement_t* achievement, int state, char buffer[], size_t buffer_size);
|
||||
|
||||
typedef struct rc_client_achievement_bucket_t {
|
||||
rc_client_achievement_t** achievements;
|
||||
uint32_t num_achievements;
|
||||
|
||||
const char* label;
|
||||
uint32_t subset_id;
|
||||
uint8_t bucket_type;
|
||||
} rc_client_achievement_bucket_t;
|
||||
|
||||
typedef struct rc_client_achievement_list_t {
|
||||
rc_client_achievement_bucket_t* buckets;
|
||||
uint32_t num_buckets;
|
||||
} rc_client_achievement_list_t;
|
||||
|
||||
enum {
|
||||
RC_CLIENT_ACHIEVEMENT_LIST_GROUPING_LOCK_STATE = 0,
|
||||
RC_CLIENT_ACHIEVEMENT_LIST_GROUPING_PROGRESS = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a list of achievements matching the specified category and grouping.
|
||||
* Returns an allocated list that must be free'd by calling rc_client_destroy_achievement_list.
|
||||
*/
|
||||
RC_EXPORT rc_client_achievement_list_t* RC_CCONV rc_client_create_achievement_list(rc_client_t* client, int category, int grouping);
|
||||
|
||||
/**
|
||||
* Destroys a list allocated by rc_client_get_achievement_list.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_destroy_achievement_list(rc_client_achievement_list_t* list);
|
||||
|
||||
/**
|
||||
* Returns non-zero if there are any achievements that can be queried through rc_client_create_achievement_list().
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_has_achievements(rc_client_t* client);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Leaderboards |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_CLIENT_LEADERBOARD_STATE_INACTIVE = 0,
|
||||
RC_CLIENT_LEADERBOARD_STATE_ACTIVE = 1,
|
||||
RC_CLIENT_LEADERBOARD_STATE_TRACKING = 2,
|
||||
RC_CLIENT_LEADERBOARD_STATE_DISABLED = 3,
|
||||
NUM_RC_CLIENT_LEADERBOARD_STATES = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
RC_CLIENT_LEADERBOARD_FORMAT_TIME = 0,
|
||||
RC_CLIENT_LEADERBOARD_FORMAT_SCORE = 1,
|
||||
RC_CLIENT_LEADERBOARD_FORMAT_VALUE = 2,
|
||||
NUM_RC_CLIENT_LEADERBOARD_FORMATS = 3
|
||||
};
|
||||
|
||||
#define RC_CLIENT_LEADERBOARD_DISPLAY_SIZE 24
|
||||
|
||||
typedef struct rc_client_leaderboard_t {
|
||||
const char* title;
|
||||
const char* description;
|
||||
const char* tracker_value;
|
||||
uint32_t id;
|
||||
uint8_t state;
|
||||
uint8_t format;
|
||||
uint8_t lower_is_better;
|
||||
} rc_client_leaderboard_t;
|
||||
|
||||
/**
|
||||
* Get information about a leaderboard. Returns NULL if not found.
|
||||
*/
|
||||
RC_EXPORT const rc_client_leaderboard_t* RC_CCONV rc_client_get_leaderboard_info(const rc_client_t* client, uint32_t id);
|
||||
|
||||
typedef struct rc_client_leaderboard_tracker_t {
|
||||
char display[RC_CLIENT_LEADERBOARD_DISPLAY_SIZE];
|
||||
uint32_t id;
|
||||
} rc_client_leaderboard_tracker_t;
|
||||
|
||||
typedef struct rc_client_leaderboard_bucket_t {
|
||||
rc_client_leaderboard_t** leaderboards;
|
||||
uint32_t num_leaderboards;
|
||||
|
||||
const char* label;
|
||||
uint32_t subset_id;
|
||||
uint8_t bucket_type;
|
||||
} rc_client_leaderboard_bucket_t;
|
||||
|
||||
typedef struct rc_client_leaderboard_list_t {
|
||||
rc_client_leaderboard_bucket_t* buckets;
|
||||
uint32_t num_buckets;
|
||||
} rc_client_leaderboard_list_t;
|
||||
|
||||
enum {
|
||||
RC_CLIENT_LEADERBOARD_BUCKET_UNKNOWN = 0,
|
||||
RC_CLIENT_LEADERBOARD_BUCKET_INACTIVE = 1,
|
||||
RC_CLIENT_LEADERBOARD_BUCKET_ACTIVE = 2,
|
||||
RC_CLIENT_LEADERBOARD_BUCKET_UNSUPPORTED = 3,
|
||||
RC_CLIENT_LEADERBOARD_BUCKET_ALL = 4,
|
||||
NUM_RC_CLIENT_LEADERBOARD_BUCKETS = 5
|
||||
};
|
||||
|
||||
enum {
|
||||
RC_CLIENT_LEADERBOARD_LIST_GROUPING_NONE = 0,
|
||||
RC_CLIENT_LEADERBOARD_LIST_GROUPING_TRACKING = 1
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a list of leaderboards matching the specified grouping.
|
||||
* Returns an allocated list that must be free'd by calling rc_client_destroy_leaderboard_list.
|
||||
*/
|
||||
RC_EXPORT rc_client_leaderboard_list_t* RC_CCONV rc_client_create_leaderboard_list(rc_client_t* client, int grouping);
|
||||
|
||||
/**
|
||||
* Destroys a list allocated by rc_client_get_leaderboard_list.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_destroy_leaderboard_list(rc_client_leaderboard_list_t* list);
|
||||
|
||||
/**
|
||||
* Returns non-zero if the current game has any leaderboards.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_has_leaderboards(rc_client_t* client);
|
||||
|
||||
typedef struct rc_client_leaderboard_entry_t {
|
||||
const char* user;
|
||||
char display[RC_CLIENT_LEADERBOARD_DISPLAY_SIZE];
|
||||
time_t submitted;
|
||||
uint32_t rank;
|
||||
uint32_t index;
|
||||
} 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;
|
||||
|
||||
typedef void (RC_CCONV *rc_client_fetch_leaderboard_entries_callback_t)(int result, const char* error_message,
|
||||
rc_client_leaderboard_entry_list_t* list, rc_client_t* client, void* callback_userdata);
|
||||
|
||||
/**
|
||||
* Fetches a list of leaderboard entries from the server.
|
||||
* Callback receives an allocated list that must be free'd by calling rc_client_destroy_leaderboard_entry_list.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_fetch_leaderboard_entries(rc_client_t* client, uint32_t leaderboard_id,
|
||||
uint32_t first_entry, uint32_t count, rc_client_fetch_leaderboard_entries_callback_t callback, void* callback_userdata);
|
||||
|
||||
/**
|
||||
* Fetches a list of leaderboard entries from the server containing the logged-in user.
|
||||
* Callback receives an allocated list that must be free'd by calling rc_client_destroy_leaderboard_entry_list.
|
||||
*/
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_fetch_leaderboard_entries_around_user(rc_client_t* client, uint32_t leaderboard_id,
|
||||
uint32_t count, rc_client_fetch_leaderboard_entries_callback_t callback, void* callback_userdata);
|
||||
|
||||
/**
|
||||
* Gets the URL for the profile picture of the user associated to a leaderboard entry.
|
||||
* Returns RC_OK on success.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_leaderboard_entry_get_user_image_url(const rc_client_leaderboard_entry_t* entry, char buffer[], size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Destroys a list allocated by rc_client_begin_fetch_leaderboard_entries or rc_client_begin_fetch_leaderboard_entries_around_user.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_destroy_leaderboard_entry_list(rc_client_leaderboard_entry_list_t* list);
|
||||
|
||||
/**
|
||||
* Used for scoreboard events. Contains the response from the server when a leaderboard entry is submitted.
|
||||
* NOTE: This structure is only valid within the event callback. If you want to make use of the data outside
|
||||
* of the callback, you should create copies of both the top entries and usernames within.
|
||||
*/
|
||||
typedef struct rc_client_leaderboard_scoreboard_entry_t {
|
||||
/* The user associated to the entry */
|
||||
const char* username;
|
||||
/* The rank of the entry */
|
||||
uint32_t rank;
|
||||
/* The value of the entry */
|
||||
char score[RC_CLIENT_LEADERBOARD_DISPLAY_SIZE];
|
||||
} rc_client_leaderboard_scoreboard_entry_t;
|
||||
|
||||
typedef struct rc_client_leaderboard_scoreboard_t {
|
||||
/* The ID of the leaderboard which was submitted */
|
||||
uint32_t leaderboard_id;
|
||||
/* The value that was submitted */
|
||||
char submitted_score[RC_CLIENT_LEADERBOARD_DISPLAY_SIZE];
|
||||
/* The player's best submitted value */
|
||||
char best_score[RC_CLIENT_LEADERBOARD_DISPLAY_SIZE];
|
||||
/* The player's new rank within the leaderboard */
|
||||
uint32_t new_rank;
|
||||
/* The total number of entries in the leaderboard */
|
||||
uint32_t num_entries;
|
||||
|
||||
/* An array of the top entries for the leaderboard */
|
||||
rc_client_leaderboard_scoreboard_entry_t* top_entries;
|
||||
/* The number of items in the top_entries array */
|
||||
uint32_t num_top_entries;
|
||||
} rc_client_leaderboard_scoreboard_t;
|
||||
|
||||
/*****************************************************************************\
|
||||
| Rich Presence |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns non-zero if the current game supports rich presence.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_has_rich_presence(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Gets the current rich presence message.
|
||||
* Returns the number of characters written to buffer.
|
||||
*/
|
||||
RC_EXPORT size_t RC_CCONV rc_client_get_rich_presence_message(rc_client_t* client, char buffer[], size_t buffer_size);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Processing |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_CLIENT_EVENT_TYPE_NONE = 0,
|
||||
RC_CLIENT_EVENT_ACHIEVEMENT_TRIGGERED = 1, /* [achievement] was earned by the player */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_STARTED = 2, /* [leaderboard] attempt has started */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_FAILED = 3, /* [leaderboard] attempt failed */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_SUBMITTED = 4, /* [leaderboard] attempt submitted */
|
||||
RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_SHOW = 5, /* [achievement] challenge indicator should be shown */
|
||||
RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_HIDE = 6, /* [achievement] challenge indicator should be hidden */
|
||||
RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_SHOW = 7, /* progress indicator should be shown for [achievement] */
|
||||
RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_HIDE = 8, /* progress indicator should be hidden */
|
||||
RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_UPDATE = 9, /* progress indicator should be updated to reflect new badge/progress for [achievement] */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_TRACKER_SHOW = 10, /* [leaderboard_tracker] should be shown */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_TRACKER_HIDE = 11, /* [leaderboard_tracker] should be hidden */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_TRACKER_UPDATE = 12, /* [leaderboard_tracker] updated */
|
||||
RC_CLIENT_EVENT_LEADERBOARD_SCOREBOARD = 13, /* [leaderboard_scoreboard] possibly-new ranking received for [leaderboard] */
|
||||
RC_CLIENT_EVENT_RESET = 14, /* emulated system should be reset (as the result of enabling hardcore) */
|
||||
RC_CLIENT_EVENT_GAME_COMPLETED = 15, /* all achievements for the game have been earned */
|
||||
RC_CLIENT_EVENT_SERVER_ERROR = 16, /* an API response returned a [server_error] and will not be retried */
|
||||
RC_CLIENT_EVENT_DISCONNECTED = 17, /* an unlock request could not be completed and is pending */
|
||||
RC_CLIENT_EVENT_RECONNECTED = 18 /* all pending unlocks have been completed */
|
||||
};
|
||||
|
||||
typedef struct rc_client_server_error_t {
|
||||
const char* error_message;
|
||||
const char* api;
|
||||
int result;
|
||||
uint32_t related_id;
|
||||
} rc_client_server_error_t;
|
||||
|
||||
typedef struct rc_client_event_t {
|
||||
uint32_t type;
|
||||
|
||||
rc_client_achievement_t* achievement;
|
||||
rc_client_leaderboard_t* leaderboard;
|
||||
rc_client_leaderboard_tracker_t* leaderboard_tracker;
|
||||
rc_client_leaderboard_scoreboard_t* leaderboard_scoreboard;
|
||||
rc_client_server_error_t* server_error;
|
||||
|
||||
} rc_client_event_t;
|
||||
|
||||
/**
|
||||
* Callback used to notify the client when certain events occur.
|
||||
*/
|
||||
typedef void (RC_CCONV *rc_client_event_handler_t)(const rc_client_event_t* event, rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Provides a callback for event handling.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_event_handler(rc_client_t* client, rc_client_event_handler_t handler);
|
||||
|
||||
/**
|
||||
* Provides a callback for reading memory.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_set_read_memory_function(rc_client_t* client, rc_client_read_memory_func_t handler);
|
||||
|
||||
/**
|
||||
* Determines if there are any active achievements/leaderboards/rich presence that need processing.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_is_processing_required(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Processes achievements for the current frame.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_do_frame(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Processes the periodic queue.
|
||||
* Called internally by rc_client_do_frame.
|
||||
* Should be explicitly called if rc_client_do_frame is not being called because emulation is paused.
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_idle(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Determines if a sufficient amount of frames have been processed since the last call to rc_client_can_pause.
|
||||
* Should not be called unless the client is trying to pause.
|
||||
* If false is returned, and frames_remaining is not NULL, frames_remaining will be set to the number of frames
|
||||
* still required before pause is allowed, which can be converted to a time in seconds for displaying to the user.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_can_pause(rc_client_t* client, uint32_t* frames_remaining);
|
||||
|
||||
/**
|
||||
* Informs the runtime that the emulator has been reset. Will reset all achievements and leaderboards
|
||||
* to their initial state (includes hiding indicators/trackers).
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_client_reset(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Gets the number of bytes needed to serialized the runtime state.
|
||||
*/
|
||||
RC_EXPORT size_t RC_CCONV rc_client_progress_size(rc_client_t* client);
|
||||
|
||||
/**
|
||||
* Serializes the runtime state into a buffer.
|
||||
* Returns RC_OK on success, or an error indicator.
|
||||
* [deprecated] use rc_client_serialize_progress_sized instead
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_serialize_progress(rc_client_t* client, uint8_t* buffer);
|
||||
|
||||
/**
|
||||
* Serializes the runtime state into a buffer.
|
||||
* Returns RC_OK on success, or an error indicator.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_serialize_progress_sized(rc_client_t* client, uint8_t* buffer, size_t buffer_size);
|
||||
|
||||
/**
|
||||
* Deserializes the runtime state from a buffer.
|
||||
* Returns RC_OK on success, or an error indicator.
|
||||
* [deprecated] use rc_client_deserialize_progress_sized instead
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_deserialize_progress(rc_client_t* client, const uint8_t* serialized);
|
||||
|
||||
/**
|
||||
* Serializes the runtime state into a buffer.
|
||||
* Returns RC_OK on success, or an error indicator.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_client_deserialize_progress_sized(rc_client_t* client, const uint8_t* serialized, size_t serialized_size);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_RUNTIME_H */
|
||||
101
3rdparty/rcheevos/include/rc_client_raintegration.h
vendored
Normal file
101
3rdparty/rcheevos/include/rc_client_raintegration.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
#ifndef RC_CLIENT_RAINTEGRATION_H
|
||||
#define RC_CLIENT_RAINTEGRATION_H
|
||||
|
||||
#ifndef _WIN32
|
||||
#undef RC_CLIENT_SUPPORTS_RAINTEGRATION /* Windows required for RAIntegration */
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "rc_export.h"
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
typedef struct rc_client_t rc_client_t; /* forward reference; in rc_client.h */
|
||||
|
||||
/* types needed to implement raintegration */
|
||||
|
||||
typedef struct rc_client_raintegration_menu_item_t {
|
||||
const char* label;
|
||||
uint32_t id;
|
||||
uint8_t checked;
|
||||
uint8_t enabled;
|
||||
} rc_client_raintegration_menu_item_t;
|
||||
|
||||
typedef struct rc_client_raintegration_menu_t {
|
||||
rc_client_raintegration_menu_item_t* items;
|
||||
uint32_t num_items;
|
||||
} rc_client_raintegration_menu_t;
|
||||
|
||||
enum {
|
||||
RC_CLIENT_RAINTEGRATION_ACHIEVEMENT_STATE_NONE = 0,
|
||||
RC_CLIENT_RAINTEGRATION_ACHIEVEMENT_STATE_PUBLISHED = 1,
|
||||
RC_CLIENT_RAINTEGRATION_ACHIEVEMENT_STATE_LOCAL = 2,
|
||||
RC_CLIENT_RAINTEGRATION_ACHIEVEMENT_STATE_MODIFIED = 3,
|
||||
RC_CLIENT_RAINTEGRATION_ACHIEVEMENT_STATE_INSECURE = 4,
|
||||
};
|
||||
|
||||
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_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 {
|
||||
uint32_t type;
|
||||
|
||||
const rc_client_raintegration_menu_item_t* menu_item;
|
||||
} rc_client_raintegration_event_t;
|
||||
|
||||
typedef void (RC_CCONV *rc_client_raintegration_event_handler_t)(const rc_client_raintegration_event_t* event,
|
||||
rc_client_t* client);
|
||||
|
||||
typedef void (RC_CCONV *rc_client_raintegration_write_memory_func_t)(uint32_t address, uint8_t* buffer,
|
||||
uint32_t num_bytes, rc_client_t* client);
|
||||
|
||||
typedef void (RC_CCONV* rc_client_raintegration_get_game_name_func_t)(char* buffer, uint32_t buffer_size, rc_client_t* client);
|
||||
|
||||
/* types needed to integrate raintegration */
|
||||
|
||||
#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION
|
||||
|
||||
#ifndef RC_CLIENT_SUPPORTS_EXTERNAL
|
||||
#define RC_CLIENT_SUPPORTS_EXTERNAL /* external rc_client required for RAIntegration */
|
||||
#endif
|
||||
|
||||
#include <wtypes.h> /* HWND */
|
||||
|
||||
#include "rc_client.h"
|
||||
|
||||
RC_EXPORT rc_client_async_handle_t* RC_CCONV rc_client_begin_load_raintegration(rc_client_t* client,
|
||||
const wchar_t* search_directory, HWND main_window_handle,
|
||||
const char* client_name, const char* client_version,
|
||||
rc_client_callback_t callback, void* callback_userdata);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_client_unload_raintegration(rc_client_t* client);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_update_main_window_handle(rc_client_t* client, HWND main_window_handle);
|
||||
|
||||
RC_EXPORT const rc_client_raintegration_menu_t* RC_CCONV rc_client_raintegration_get_menu(const rc_client_t* client);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_rebuild_submenu(rc_client_t* client, HMENU hMenu);
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_update_menu_item(const rc_client_t* client, const rc_client_raintegration_menu_item_t* menu_item);
|
||||
RC_EXPORT int RC_CCONV rc_client_raintegration_activate_menu_item(const rc_client_t* client, uint32_t menu_item_id);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_set_write_memory_function(rc_client_t* client, rc_client_raintegration_write_memory_func_t handler);
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_set_get_game_name_function(rc_client_t* client, rc_client_raintegration_get_game_name_func_t handler);
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_set_console_id(rc_client_t* client, uint32_t console_id);
|
||||
RC_EXPORT int RC_CCONV rc_client_raintegration_has_modifications(const rc_client_t* client);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_client_raintegration_set_event_handler(rc_client_t* client,
|
||||
rc_client_raintegration_event_handler_t handler);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_client_raintegration_get_achievement_state(const rc_client_t* client, uint32_t achievement_id);
|
||||
|
||||
#endif /* RC_CLIENT_SUPPORTS_RAINTEGRATION */
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_CLIENT_RAINTEGRATION_H */
|
||||
137
3rdparty/rcheevos/include/rc_consoles.h
vendored
Normal file
137
3rdparty/rcheevos/include/rc_consoles.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
#ifndef RC_CONSOLES_H
|
||||
#define RC_CONSOLES_H
|
||||
|
||||
#include "rc_export.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/*****************************************************************************\
|
||||
| Console identifiers |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_CONSOLE_UNKNOWN = 0,
|
||||
RC_CONSOLE_MEGA_DRIVE = 1,
|
||||
RC_CONSOLE_NINTENDO_64 = 2,
|
||||
RC_CONSOLE_SUPER_NINTENDO = 3,
|
||||
RC_CONSOLE_GAMEBOY = 4,
|
||||
RC_CONSOLE_GAMEBOY_ADVANCE = 5,
|
||||
RC_CONSOLE_GAMEBOY_COLOR = 6,
|
||||
RC_CONSOLE_NINTENDO = 7,
|
||||
RC_CONSOLE_PC_ENGINE = 8,
|
||||
RC_CONSOLE_SEGA_CD = 9,
|
||||
RC_CONSOLE_SEGA_32X = 10,
|
||||
RC_CONSOLE_MASTER_SYSTEM = 11,
|
||||
RC_CONSOLE_PLAYSTATION = 12,
|
||||
RC_CONSOLE_ATARI_LYNX = 13,
|
||||
RC_CONSOLE_NEOGEO_POCKET = 14,
|
||||
RC_CONSOLE_GAME_GEAR = 15,
|
||||
RC_CONSOLE_GAMECUBE = 16,
|
||||
RC_CONSOLE_ATARI_JAGUAR = 17,
|
||||
RC_CONSOLE_NINTENDO_DS = 18,
|
||||
RC_CONSOLE_WII = 19,
|
||||
RC_CONSOLE_WII_U = 20,
|
||||
RC_CONSOLE_PLAYSTATION_2 = 21,
|
||||
RC_CONSOLE_XBOX = 22,
|
||||
RC_CONSOLE_MAGNAVOX_ODYSSEY2 = 23,
|
||||
RC_CONSOLE_POKEMON_MINI = 24,
|
||||
RC_CONSOLE_ATARI_2600 = 25,
|
||||
RC_CONSOLE_MS_DOS = 26,
|
||||
RC_CONSOLE_ARCADE = 27,
|
||||
RC_CONSOLE_VIRTUAL_BOY = 28,
|
||||
RC_CONSOLE_MSX = 29,
|
||||
RC_CONSOLE_COMMODORE_64 = 30,
|
||||
RC_CONSOLE_ZX81 = 31,
|
||||
RC_CONSOLE_ORIC = 32,
|
||||
RC_CONSOLE_SG1000 = 33,
|
||||
RC_CONSOLE_VIC20 = 34,
|
||||
RC_CONSOLE_AMIGA = 35,
|
||||
RC_CONSOLE_ATARI_ST = 36,
|
||||
RC_CONSOLE_AMSTRAD_PC = 37,
|
||||
RC_CONSOLE_APPLE_II = 38,
|
||||
RC_CONSOLE_SATURN = 39,
|
||||
RC_CONSOLE_DREAMCAST = 40,
|
||||
RC_CONSOLE_PSP = 41,
|
||||
RC_CONSOLE_CDI = 42,
|
||||
RC_CONSOLE_3DO = 43,
|
||||
RC_CONSOLE_COLECOVISION = 44,
|
||||
RC_CONSOLE_INTELLIVISION = 45,
|
||||
RC_CONSOLE_VECTREX = 46,
|
||||
RC_CONSOLE_PC8800 = 47,
|
||||
RC_CONSOLE_PC9800 = 48,
|
||||
RC_CONSOLE_PCFX = 49,
|
||||
RC_CONSOLE_ATARI_5200 = 50,
|
||||
RC_CONSOLE_ATARI_7800 = 51,
|
||||
RC_CONSOLE_X68K = 52,
|
||||
RC_CONSOLE_WONDERSWAN = 53,
|
||||
RC_CONSOLE_CASSETTEVISION = 54,
|
||||
RC_CONSOLE_SUPER_CASSETTEVISION = 55,
|
||||
RC_CONSOLE_NEO_GEO_CD = 56,
|
||||
RC_CONSOLE_FAIRCHILD_CHANNEL_F = 57,
|
||||
RC_CONSOLE_FM_TOWNS = 58,
|
||||
RC_CONSOLE_ZX_SPECTRUM = 59,
|
||||
RC_CONSOLE_GAME_AND_WATCH = 60,
|
||||
RC_CONSOLE_NOKIA_NGAGE = 61,
|
||||
RC_CONSOLE_NINTENDO_3DS = 62,
|
||||
RC_CONSOLE_SUPERVISION = 63,
|
||||
RC_CONSOLE_SHARPX1 = 64,
|
||||
RC_CONSOLE_TIC80 = 65,
|
||||
RC_CONSOLE_THOMSONTO8 = 66,
|
||||
RC_CONSOLE_PC6000 = 67,
|
||||
RC_CONSOLE_PICO = 68,
|
||||
RC_CONSOLE_MEGADUCK = 69,
|
||||
RC_CONSOLE_ZEEBO = 70,
|
||||
RC_CONSOLE_ARDUBOY = 71,
|
||||
RC_CONSOLE_WASM4 = 72,
|
||||
RC_CONSOLE_ARCADIA_2001 = 73,
|
||||
RC_CONSOLE_INTERTON_VC_4000 = 74,
|
||||
RC_CONSOLE_ELEKTOR_TV_GAMES_COMPUTER = 75,
|
||||
RC_CONSOLE_PC_ENGINE_CD = 76,
|
||||
RC_CONSOLE_ATARI_JAGUAR_CD = 77,
|
||||
RC_CONSOLE_NINTENDO_DSI = 78,
|
||||
RC_CONSOLE_TI83 = 79,
|
||||
RC_CONSOLE_UZEBOX = 80,
|
||||
|
||||
RC_CONSOLE_HUBS = 100,
|
||||
RC_CONSOLE_EVENTS = 101,
|
||||
RC_CONSOLE_STANDALONE = 102
|
||||
};
|
||||
|
||||
RC_EXPORT const char* RC_CCONV rc_console_name(uint32_t console_id);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Memory mapping |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_MEMORY_TYPE_SYSTEM_RAM, /* normal system memory */
|
||||
RC_MEMORY_TYPE_SAVE_RAM, /* memory that persists between sessions */
|
||||
RC_MEMORY_TYPE_VIDEO_RAM, /* memory reserved for graphical processing */
|
||||
RC_MEMORY_TYPE_READONLY, /* memory that maps to read only data */
|
||||
RC_MEMORY_TYPE_HARDWARE_CONTROLLER, /* memory for interacting with system components */
|
||||
RC_MEMORY_TYPE_VIRTUAL_RAM, /* secondary address space that maps to real memory in system RAM */
|
||||
RC_MEMORY_TYPE_UNUSED /* these addresses don't really exist */
|
||||
};
|
||||
|
||||
typedef struct rc_memory_region_t {
|
||||
uint32_t start_address; /* first address of block as queried by RetroAchievements */
|
||||
uint32_t end_address; /* last address of block as queried by RetroAchievements */
|
||||
uint32_t real_address; /* real address for first address of block */
|
||||
uint8_t type; /* RC_MEMORY_TYPE_ for block */
|
||||
const char* description; /* short description of block */
|
||||
}
|
||||
rc_memory_region_t;
|
||||
|
||||
typedef struct rc_memory_regions_t {
|
||||
const rc_memory_region_t* region;
|
||||
uint32_t num_regions;
|
||||
}
|
||||
rc_memory_regions_t;
|
||||
|
||||
RC_EXPORT const rc_memory_regions_t* RC_CCONV rc_console_memory_regions(uint32_t console_id);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_CONSOLES_H */
|
||||
58
3rdparty/rcheevos/include/rc_error.h
vendored
Normal file
58
3rdparty/rcheevos/include/rc_error.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef RC_ERROR_H
|
||||
#define RC_ERROR_H
|
||||
|
||||
#include "rc_export.h"
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/*****************************************************************************\
|
||||
| Return values |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_OK = 0,
|
||||
RC_INVALID_LUA_OPERAND = -1,
|
||||
RC_INVALID_MEMORY_OPERAND = -2,
|
||||
RC_INVALID_CONST_OPERAND = -3,
|
||||
RC_INVALID_FP_OPERAND = -4,
|
||||
RC_INVALID_CONDITION_TYPE = -5,
|
||||
RC_INVALID_OPERATOR = -6,
|
||||
RC_INVALID_REQUIRED_HITS = -7,
|
||||
RC_DUPLICATED_START = -8,
|
||||
RC_DUPLICATED_CANCEL = -9,
|
||||
RC_DUPLICATED_SUBMIT = -10,
|
||||
RC_DUPLICATED_VALUE = -11,
|
||||
RC_DUPLICATED_PROGRESS = -12,
|
||||
RC_MISSING_START = -13,
|
||||
RC_MISSING_CANCEL = -14,
|
||||
RC_MISSING_SUBMIT = -15,
|
||||
RC_MISSING_VALUE = -16,
|
||||
RC_INVALID_LBOARD_FIELD = -17,
|
||||
RC_MISSING_DISPLAY_STRING = -18,
|
||||
RC_OUT_OF_MEMORY = -19,
|
||||
RC_INVALID_VALUE_FLAG = -20,
|
||||
RC_MISSING_VALUE_MEASURED = -21,
|
||||
RC_MULTIPLE_MEASURED = -22,
|
||||
RC_INVALID_MEASURED_TARGET = -23,
|
||||
RC_INVALID_COMPARISON = -24,
|
||||
RC_INVALID_STATE = -25,
|
||||
RC_INVALID_JSON = -26,
|
||||
RC_API_FAILURE = -27,
|
||||
RC_LOGIN_REQUIRED = -28,
|
||||
RC_NO_GAME_LOADED = -29,
|
||||
RC_HARDCORE_DISABLED = -30,
|
||||
RC_ABORTED = -31,
|
||||
RC_NO_RESPONSE = -32,
|
||||
RC_ACCESS_DENIED = -33,
|
||||
RC_INVALID_CREDENTIALS = -34,
|
||||
RC_EXPIRED_TOKEN = -35,
|
||||
RC_INSUFFICIENT_BUFFER = -36,
|
||||
RC_INVALID_VARIABLE_NAME = -37,
|
||||
RC_UNKNOWN_VARIABLE_NAME = -38
|
||||
};
|
||||
|
||||
RC_EXPORT const char* RC_CCONV rc_error_str(int ret);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_ERROR_H */
|
||||
100
3rdparty/rcheevos/include/rc_export.h
vendored
Normal file
100
3rdparty/rcheevos/include/rc_export.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef RC_EXPORT_H
|
||||
#define RC_EXPORT_H
|
||||
|
||||
/* These macros control how callbacks and public functions are defined */
|
||||
|
||||
/* RC_SHARED should be defined when building rcheevos as a shared library (e.g. dll/dylib/so). External code should not define this macro. */
|
||||
/* RC_STATIC should be defined when building rcheevos as a static library. External code should also define this macro. */
|
||||
/* RC_IMPORT should be defined for external code using rcheevos as a shared library. */
|
||||
|
||||
/* For compatibility, if none of these three macros are defined, then the build is assumed to be RC_STATIC */
|
||||
|
||||
#if !defined(RC_SHARED) && !defined(RC_STATIC) && !defined(RC_IMPORT)
|
||||
#define RC_STATIC
|
||||
#endif
|
||||
|
||||
#if (defined(RC_SHARED) && defined(RC_STATIC)) || (defined(RC_SHARED) && defined(RC_IMPORT)) || (defined(RC_STATIC) && defined(RC_IMPORT))
|
||||
#error RC_SHARED, RC_STATIC, and RC_IMPORT are mutually exclusive
|
||||
#endif
|
||||
|
||||
/* RC_BEGIN_C_DECLS and RC_END_C_DECLS should be used for all headers, to enforce C linkage and the C calling convention */
|
||||
/* RC_BEGIN_C_DECLS should be placed after #include's and before header declarations */
|
||||
/* RC_END_C_DECLS should be placed after header declarations */
|
||||
|
||||
/* example usage
|
||||
*
|
||||
* #ifndef RC_HEADER_H
|
||||
* #define RC_HEADER_H
|
||||
*
|
||||
* #include <stdint.h>
|
||||
*
|
||||
* RC_BEGIN_C_DECLS
|
||||
*
|
||||
* uint8_t rc_function(void);
|
||||
*
|
||||
* RC_END_C_DECLS
|
||||
*
|
||||
* #endif
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define RC_BEGIN_C_DECLS extern "C" {
|
||||
#define RC_END_C_DECLS }
|
||||
#else
|
||||
#define RC_BEGIN_C_DECLS
|
||||
#define RC_END_C_DECLS
|
||||
#endif
|
||||
|
||||
/* RC_CCONV should be used for public functions and callbacks, to enforce the cdecl calling convention, if applicable */
|
||||
/* RC_CCONV should be placed after the return type, and between the ( and * for callbacks */
|
||||
|
||||
/* example usage */
|
||||
/* void RC_CCONV rc_function(void) */
|
||||
/* void (RC_CCONV *rc_callback)(void) */
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Windows compilers will ignore __cdecl when not applicable */
|
||||
#define RC_CCONV __cdecl
|
||||
#elif defined(__GNUC__) && defined(__i386__)
|
||||
/* GNU C compilers will warn if cdecl is defined on an unsupported platform */
|
||||
#define RC_CCONV __attribute__((cdecl))
|
||||
#else
|
||||
#define RC_CCONV
|
||||
#endif
|
||||
|
||||
/* RC_EXPORT should be used for public functions */
|
||||
/* RC_EXPORT will provide necessary hints for shared library usage, if applicable */
|
||||
/* RC_EXPORT should be placed before the return type */
|
||||
|
||||
/* example usage */
|
||||
/* RC_EXPORT void rc_function(void) */
|
||||
|
||||
#ifdef RC_SHARED
|
||||
#if defined(_WIN32)
|
||||
#define RC_EXPORT __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define RC_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define RC_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RC_IMPORT
|
||||
#if defined(_WIN32)
|
||||
#define RC_EXPORT __declspec(dllimport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define RC_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define RC_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef RC_STATIC
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define RC_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define RC_EXPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* RC_EXPORT_H */
|
||||
130
3rdparty/rcheevos/include/rc_hash.h
vendored
Normal file
130
3rdparty/rcheevos/include/rc_hash.h
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
#ifndef RC_HASH_H
|
||||
#define RC_HASH_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "rc_consoles.h"
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
/* generates a hash from a block of memory.
|
||||
* returns non-zero on success, or zero on failure.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_hash_generate_from_buffer(char hash[33], uint32_t console_id, const uint8_t* buffer, size_t buffer_size);
|
||||
|
||||
/* generates a hash from a file.
|
||||
* returns non-zero on success, or zero on failure.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_hash_generate_from_file(char hash[33], uint32_t console_id, const char* path);
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
/* data for rc_hash_iterate
|
||||
*/
|
||||
typedef struct rc_hash_iterator
|
||||
{
|
||||
const uint8_t* buffer;
|
||||
size_t buffer_size;
|
||||
uint8_t consoles[12];
|
||||
int index;
|
||||
const char* path;
|
||||
} rc_hash_iterator_t;
|
||||
|
||||
/* initializes a rc_hash_iterator
|
||||
* - path must be provided
|
||||
* - if buffer and buffer_size are provided, path may be a filename (i.e. for something extracted from a zip file)
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_hash_initialize_iterator(struct rc_hash_iterator* iterator, const char* path, const uint8_t* buffer, size_t buffer_size);
|
||||
|
||||
/* releases resources associated to a rc_hash_iterator
|
||||
*/
|
||||
RC_EXPORT void RC_CCONV rc_hash_destroy_iterator(struct rc_hash_iterator* iterator);
|
||||
|
||||
/* generates the next hash for the data in the rc_hash_iterator.
|
||||
* returns non-zero if a hash was generated, or zero if no more hashes can be generated for the data.
|
||||
*/
|
||||
RC_EXPORT int RC_CCONV rc_hash_iterate(char hash[33], struct rc_hash_iterator* iterator);
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
/* specifies a function to call when an error occurs to display the error message */
|
||||
typedef void (RC_CCONV *rc_hash_message_callback)(const char*);
|
||||
RC_EXPORT void RC_CCONV rc_hash_init_error_message_callback(rc_hash_message_callback callback);
|
||||
|
||||
/* specifies a function to call for verbose logging */
|
||||
RC_EXPORT void rc_hash_init_verbose_message_callback(rc_hash_message_callback callback);
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
/* opens a file */
|
||||
typedef void* (RC_CCONV *rc_hash_filereader_open_file_handler)(const char* path_utf8);
|
||||
|
||||
/* moves the file pointer - standard fseek parameters */
|
||||
typedef void (RC_CCONV *rc_hash_filereader_seek_handler)(void* file_handle, int64_t offset, int origin);
|
||||
|
||||
/* locates the file pointer */
|
||||
typedef int64_t (RC_CCONV *rc_hash_filereader_tell_handler)(void* file_handle);
|
||||
|
||||
/* reads the specified number of bytes from the file starting at the read pointer.
|
||||
* returns the number of bytes actually read.
|
||||
*/
|
||||
typedef size_t (RC_CCONV *rc_hash_filereader_read_handler)(void* file_handle, void* buffer, size_t requested_bytes);
|
||||
|
||||
/* closes the file */
|
||||
typedef void (RC_CCONV *rc_hash_filereader_close_file_handler)(void* file_handle);
|
||||
|
||||
struct rc_hash_filereader
|
||||
{
|
||||
rc_hash_filereader_open_file_handler open;
|
||||
rc_hash_filereader_seek_handler seek;
|
||||
rc_hash_filereader_tell_handler tell;
|
||||
rc_hash_filereader_read_handler read;
|
||||
rc_hash_filereader_close_file_handler close;
|
||||
};
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_hash_init_custom_filereader(struct rc_hash_filereader* reader);
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
#define RC_HASH_CDTRACK_FIRST_DATA ((uint32_t)-1) /* the first data track (skip audio tracks) */
|
||||
#define RC_HASH_CDTRACK_LAST ((uint32_t)-2) /* the last data/audio track */
|
||||
#define RC_HASH_CDTRACK_LARGEST ((uint32_t)-3) /* the largest data/audio track */
|
||||
#define RC_HASH_CDTRACK_FIRST_OF_SECOND_SESSION ((uint32_t)-4) /* the first data/audio track of the second session */
|
||||
|
||||
/* opens a track from the specified file. see the RC_HASH_CDTRACK_ defines for special tracks.
|
||||
* returns a handle to be passed to the other functions, or NULL if the track could not be opened.
|
||||
*/
|
||||
typedef void* (RC_CCONV *rc_hash_cdreader_open_track_handler)(const char* path, uint32_t track);
|
||||
|
||||
/* attempts to read the specified number of bytes from the file starting at the specified absolute sector.
|
||||
* returns the number of bytes actually read.
|
||||
*/
|
||||
typedef size_t (RC_CCONV *rc_hash_cdreader_read_sector_handler)(void* track_handle, uint32_t sector, void* buffer, size_t requested_bytes);
|
||||
|
||||
/* closes the track handle */
|
||||
typedef void (RC_CCONV *rc_hash_cdreader_close_track_handler)(void* track_handle);
|
||||
|
||||
/* gets the absolute sector index for the first sector of a track */
|
||||
typedef uint32_t(RC_CCONV *rc_hash_cdreader_first_track_sector_handler)(void* track_handle);
|
||||
|
||||
struct rc_hash_cdreader
|
||||
{
|
||||
rc_hash_cdreader_open_track_handler open_track;
|
||||
rc_hash_cdreader_read_sector_handler read_sector;
|
||||
rc_hash_cdreader_close_track_handler close_track;
|
||||
rc_hash_cdreader_first_track_sector_handler first_track_sector;
|
||||
};
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_hash_get_default_cdreader(struct rc_hash_cdreader* cdreader);
|
||||
RC_EXPORT void RC_CCONV rc_hash_init_default_cdreader(void);
|
||||
RC_EXPORT void RC_CCONV rc_hash_init_custom_cdreader(struct rc_hash_cdreader* reader);
|
||||
|
||||
/* ===================================================== */
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_HASH_H */
|
||||
158
3rdparty/rcheevos/include/rc_runtime.h
vendored
Normal file
158
3rdparty/rcheevos/include/rc_runtime.h
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
#ifndef RC_RUNTIME_H
|
||||
#define RC_RUNTIME_H
|
||||
|
||||
#include "rc_error.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/*****************************************************************************\
|
||||
| Forward Declarations (defined in rc_runtime_types.h) |
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifndef RC_RUNTIME_TYPES_H /* prevents pedantic redefinition error */
|
||||
|
||||
typedef struct lua_State lua_State;
|
||||
|
||||
typedef struct rc_trigger_t rc_trigger_t;
|
||||
typedef struct rc_lboard_t rc_lboard_t;
|
||||
typedef struct rc_richpresence_t rc_richpresence_t;
|
||||
typedef struct rc_memref_t rc_memref_t;
|
||||
typedef struct rc_value_t rc_value_t;
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************\
|
||||
| Callbacks |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Callback used to read num_bytes bytes from memory starting at address. If
|
||||
* num_bytes is greater than 1, the value is read in little-endian from
|
||||
* memory.
|
||||
*/
|
||||
typedef uint32_t(RC_CCONV *rc_runtime_peek_t)(uint32_t address, uint32_t num_bytes, void* ud);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Runtime |
|
||||
\*****************************************************************************/
|
||||
|
||||
typedef struct rc_runtime_trigger_t {
|
||||
uint32_t id;
|
||||
rc_trigger_t* trigger;
|
||||
void* buffer;
|
||||
rc_memref_t* invalid_memref;
|
||||
uint8_t md5[16];
|
||||
int32_t serialized_size;
|
||||
uint8_t owns_memrefs;
|
||||
}
|
||||
rc_runtime_trigger_t;
|
||||
|
||||
typedef struct rc_runtime_lboard_t {
|
||||
uint32_t id;
|
||||
int32_t value;
|
||||
rc_lboard_t* lboard;
|
||||
void* buffer;
|
||||
rc_memref_t* invalid_memref;
|
||||
uint8_t md5[16];
|
||||
uint32_t serialized_size;
|
||||
uint8_t owns_memrefs;
|
||||
}
|
||||
rc_runtime_lboard_t;
|
||||
|
||||
typedef struct rc_runtime_richpresence_t {
|
||||
rc_richpresence_t* richpresence;
|
||||
void* buffer;
|
||||
struct rc_runtime_richpresence_t* previous;
|
||||
uint8_t md5[16];
|
||||
uint8_t owns_memrefs;
|
||||
}
|
||||
rc_runtime_richpresence_t;
|
||||
|
||||
typedef struct rc_runtime_t {
|
||||
rc_runtime_trigger_t* triggers;
|
||||
uint32_t trigger_count;
|
||||
uint32_t trigger_capacity;
|
||||
|
||||
rc_runtime_lboard_t* lboards;
|
||||
uint32_t lboard_count;
|
||||
uint32_t lboard_capacity;
|
||||
|
||||
rc_runtime_richpresence_t* richpresence;
|
||||
|
||||
rc_memref_t* memrefs;
|
||||
rc_memref_t** next_memref;
|
||||
|
||||
rc_value_t* variables;
|
||||
rc_value_t** next_variable;
|
||||
|
||||
uint8_t owns_self;
|
||||
}
|
||||
rc_runtime_t;
|
||||
|
||||
RC_EXPORT rc_runtime_t* RC_CCONV rc_runtime_alloc(void);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_init(rc_runtime_t* runtime);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_destroy(rc_runtime_t* runtime);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_runtime_activate_achievement(rc_runtime_t* runtime, uint32_t id, const char* memaddr, lua_State* L, int funcs_idx);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_deactivate_achievement(rc_runtime_t* runtime, uint32_t id);
|
||||
RC_EXPORT rc_trigger_t* RC_CCONV rc_runtime_get_achievement(const rc_runtime_t* runtime, uint32_t id);
|
||||
RC_EXPORT int RC_CCONV rc_runtime_get_achievement_measured(const rc_runtime_t* runtime, uint32_t id, unsigned* measured_value, unsigned* measured_target);
|
||||
RC_EXPORT int RC_CCONV rc_runtime_format_achievement_measured(const rc_runtime_t* runtime, uint32_t id, char *buffer, size_t buffer_size);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_runtime_activate_lboard(rc_runtime_t* runtime, uint32_t id, const char* memaddr, lua_State* L, int funcs_idx);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_deactivate_lboard(rc_runtime_t* runtime, uint32_t id);
|
||||
RC_EXPORT rc_lboard_t* RC_CCONV rc_runtime_get_lboard(const rc_runtime_t* runtime, uint32_t id);
|
||||
RC_EXPORT int RC_CCONV rc_runtime_format_lboard_value(char* buffer, int size, int32_t value, int format);
|
||||
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_runtime_activate_richpresence(rc_runtime_t* runtime, const char* script, lua_State* L, int funcs_idx);
|
||||
RC_EXPORT int RC_CCONV rc_runtime_get_richpresence(const rc_runtime_t* runtime, char* buffer, size_t buffersize, rc_runtime_peek_t peek, void* peek_ud, lua_State* L);
|
||||
|
||||
enum {
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_ACTIVATED, /* from WAITING, PAUSED, or PRIMED to ACTIVE */
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_PAUSED,
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_RESET,
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_TRIGGERED,
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_PRIMED,
|
||||
RC_RUNTIME_EVENT_LBOARD_STARTED,
|
||||
RC_RUNTIME_EVENT_LBOARD_CANCELED,
|
||||
RC_RUNTIME_EVENT_LBOARD_UPDATED,
|
||||
RC_RUNTIME_EVENT_LBOARD_TRIGGERED,
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_DISABLED,
|
||||
RC_RUNTIME_EVENT_LBOARD_DISABLED,
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_UNPRIMED,
|
||||
RC_RUNTIME_EVENT_ACHIEVEMENT_PROGRESS_UPDATED
|
||||
};
|
||||
|
||||
typedef struct rc_runtime_event_t {
|
||||
uint32_t id;
|
||||
int32_t value;
|
||||
uint8_t type;
|
||||
}
|
||||
rc_runtime_event_t;
|
||||
|
||||
typedef void (RC_CCONV *rc_runtime_event_handler_t)(const rc_runtime_event_t* runtime_event);
|
||||
|
||||
RC_EXPORT void RC_CCONV rc_runtime_do_frame(rc_runtime_t* runtime, rc_runtime_event_handler_t event_handler, rc_runtime_peek_t peek, void* ud, lua_State* L);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_reset(rc_runtime_t* runtime);
|
||||
|
||||
typedef int (RC_CCONV *rc_runtime_validate_address_t)(uint32_t address);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_validate_addresses(rc_runtime_t* runtime, rc_runtime_event_handler_t event_handler, rc_runtime_validate_address_t validate_handler);
|
||||
RC_EXPORT void RC_CCONV rc_runtime_invalidate_address(rc_runtime_t* runtime, uint32_t address);
|
||||
|
||||
RC_EXPORT uint32_t RC_CCONV rc_runtime_progress_size(const rc_runtime_t* runtime, lua_State* L);
|
||||
|
||||
/* [deprecated] use rc_runtime_serialize_progress_sized instead */
|
||||
RC_EXPORT int RC_CCONV rc_runtime_serialize_progress(void* buffer, const rc_runtime_t* runtime, lua_State* L);
|
||||
RC_EXPORT int RC_CCONV rc_runtime_serialize_progress_sized(uint8_t* buffer, uint32_t buffer_size, const rc_runtime_t* runtime, lua_State* L);
|
||||
|
||||
/* [deprecated] use rc_runtime_deserialize_progress_sized instead */
|
||||
RC_EXPORT int RC_CCONV rc_runtime_deserialize_progress(rc_runtime_t* runtime, const uint8_t* serialized, lua_State* L);
|
||||
RC_EXPORT int RC_CCONV rc_runtime_deserialize_progress_sized(rc_runtime_t* runtime, const uint8_t* serialized, uint32_t serialized_size, lua_State* L);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_RUNTIME_H */
|
||||
438
3rdparty/rcheevos/include/rc_runtime_types.h
vendored
Normal file
438
3rdparty/rcheevos/include/rc_runtime_types.h
vendored
Normal file
@@ -0,0 +1,438 @@
|
||||
#ifndef RC_RUNTIME_TYPES_H
|
||||
#define RC_RUNTIME_TYPES_H
|
||||
|
||||
#include "rc_error.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
#ifndef RC_RUNTIME_H /* prevents pedantic redefiniton error */
|
||||
|
||||
typedef struct lua_State lua_State;
|
||||
|
||||
typedef struct rc_trigger_t rc_trigger_t;
|
||||
typedef struct rc_lboard_t rc_lboard_t;
|
||||
typedef struct rc_richpresence_t rc_richpresence_t;
|
||||
typedef struct rc_memref_t rc_memref_t;
|
||||
typedef struct rc_value_t rc_value_t;
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************\
|
||||
| Callbacks |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Callback used to read num_bytes bytes from memory starting at address. If
|
||||
* num_bytes is greater than 1, the value is read in little-endian from
|
||||
* memory.
|
||||
*/
|
||||
typedef uint32_t(RC_CCONV *rc_peek_t)(uint32_t address, uint32_t num_bytes, void* ud);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Memory References |
|
||||
\*****************************************************************************/
|
||||
|
||||
/* Sizes. */
|
||||
enum {
|
||||
RC_MEMSIZE_8_BITS,
|
||||
RC_MEMSIZE_16_BITS,
|
||||
RC_MEMSIZE_24_BITS,
|
||||
RC_MEMSIZE_32_BITS,
|
||||
RC_MEMSIZE_LOW,
|
||||
RC_MEMSIZE_HIGH,
|
||||
RC_MEMSIZE_BIT_0,
|
||||
RC_MEMSIZE_BIT_1,
|
||||
RC_MEMSIZE_BIT_2,
|
||||
RC_MEMSIZE_BIT_3,
|
||||
RC_MEMSIZE_BIT_4,
|
||||
RC_MEMSIZE_BIT_5,
|
||||
RC_MEMSIZE_BIT_6,
|
||||
RC_MEMSIZE_BIT_7,
|
||||
RC_MEMSIZE_BITCOUNT,
|
||||
RC_MEMSIZE_16_BITS_BE,
|
||||
RC_MEMSIZE_24_BITS_BE,
|
||||
RC_MEMSIZE_32_BITS_BE,
|
||||
RC_MEMSIZE_FLOAT,
|
||||
RC_MEMSIZE_MBF32,
|
||||
RC_MEMSIZE_MBF32_LE,
|
||||
RC_MEMSIZE_FLOAT_BE,
|
||||
RC_MEMSIZE_DOUBLE32,
|
||||
RC_MEMSIZE_DOUBLE32_BE,
|
||||
RC_MEMSIZE_VARIABLE
|
||||
};
|
||||
|
||||
typedef struct rc_memref_value_t {
|
||||
/* The current value of this memory reference. */
|
||||
uint32_t value;
|
||||
/* The last differing value of this memory reference. */
|
||||
uint32_t prior;
|
||||
|
||||
/* The size of the value. */
|
||||
uint8_t size;
|
||||
/* True if the value changed this frame. */
|
||||
uint8_t changed;
|
||||
/* The value type of the value (for variables) */
|
||||
uint8_t type;
|
||||
/* True if the reference will be used in indirection.
|
||||
* NOTE: This is actually a property of the rc_memref_t, but we put it here to save space */
|
||||
uint8_t is_indirect;
|
||||
}
|
||||
rc_memref_value_t;
|
||||
|
||||
struct rc_memref_t {
|
||||
/* The current value at the specified memory address. */
|
||||
rc_memref_value_t value;
|
||||
|
||||
/* The memory address of this variable. */
|
||||
uint32_t address;
|
||||
|
||||
/* The next memory reference in the chain. */
|
||||
rc_memref_t* next;
|
||||
};
|
||||
|
||||
/*****************************************************************************\
|
||||
| Operands |
|
||||
\*****************************************************************************/
|
||||
|
||||
/* types */
|
||||
enum {
|
||||
RC_OPERAND_ADDRESS, /* The value of a live address in RAM. */
|
||||
RC_OPERAND_DELTA, /* The value last known at this address. */
|
||||
RC_OPERAND_CONST, /* A 32-bit unsigned integer. */
|
||||
RC_OPERAND_FP, /* A floating point value. */
|
||||
RC_OPERAND_LUA, /* A Lua function that provides the value. */
|
||||
RC_OPERAND_PRIOR, /* The last differing value at this address. */
|
||||
RC_OPERAND_BCD, /* The BCD-decoded value of a live address in RAM. */
|
||||
RC_OPERAND_INVERTED, /* The twos-complement value of a live address in RAM. */
|
||||
RC_OPERAND_RECALL /* The value captured by the last RC_CONDITION_REMEMBER condition */
|
||||
};
|
||||
|
||||
typedef struct rc_operand_t {
|
||||
union {
|
||||
/* A value read from memory. */
|
||||
rc_memref_t* memref;
|
||||
|
||||
/* An integer value. */
|
||||
uint32_t num;
|
||||
|
||||
/* A floating point value. */
|
||||
double dbl;
|
||||
|
||||
/* A reference to the Lua function that provides the value. */
|
||||
int luafunc;
|
||||
} value;
|
||||
|
||||
/* specifies which member of the value union is being used */
|
||||
uint8_t type;
|
||||
|
||||
/* the actual RC_MEMSIZE of the operand - memref.size may differ */
|
||||
uint8_t size;
|
||||
}
|
||||
rc_operand_t;
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_operand_is_memref(const rc_operand_t* operand);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Conditions |
|
||||
\*****************************************************************************/
|
||||
|
||||
/* types */
|
||||
enum {
|
||||
/* NOTE: this enum is ordered to optimize the switch statements in rc_test_condset_internal. the values may change between releases */
|
||||
|
||||
/* non-combining conditions (third switch) */
|
||||
RC_CONDITION_STANDARD, /* this should always be 0 */
|
||||
RC_CONDITION_PAUSE_IF,
|
||||
RC_CONDITION_RESET_IF,
|
||||
RC_CONDITION_MEASURED_IF,
|
||||
RC_CONDITION_TRIGGER,
|
||||
RC_CONDITION_MEASURED, /* measured also appears in the first switch, so place it at the border between them */
|
||||
|
||||
/* modifiers (first switch) */
|
||||
RC_CONDITION_ADD_SOURCE, /* everything from this point on affects the condition after it */
|
||||
RC_CONDITION_SUB_SOURCE,
|
||||
RC_CONDITION_ADD_ADDRESS,
|
||||
RC_CONDITION_REMEMBER,
|
||||
|
||||
/* logic flags (second switch) */
|
||||
RC_CONDITION_ADD_HITS,
|
||||
RC_CONDITION_SUB_HITS,
|
||||
RC_CONDITION_RESET_NEXT_IF,
|
||||
RC_CONDITION_AND_NEXT,
|
||||
RC_CONDITION_OR_NEXT
|
||||
};
|
||||
|
||||
/* operators */
|
||||
enum {
|
||||
RC_OPERATOR_EQ,
|
||||
RC_OPERATOR_LT,
|
||||
RC_OPERATOR_LE,
|
||||
RC_OPERATOR_GT,
|
||||
RC_OPERATOR_GE,
|
||||
RC_OPERATOR_NE,
|
||||
RC_OPERATOR_NONE,
|
||||
RC_OPERATOR_MULT,
|
||||
RC_OPERATOR_DIV,
|
||||
RC_OPERATOR_AND,
|
||||
RC_OPERATOR_XOR,
|
||||
RC_OPERATOR_MOD,
|
||||
RC_OPERATOR_ADD,
|
||||
RC_OPERATOR_SUB
|
||||
};
|
||||
|
||||
typedef struct rc_condition_t rc_condition_t;
|
||||
|
||||
struct rc_condition_t {
|
||||
/* The condition's operands. */
|
||||
rc_operand_t operand1;
|
||||
rc_operand_t operand2;
|
||||
|
||||
/* Required hits to fire this condition. */
|
||||
uint32_t required_hits;
|
||||
/* Number of hits so far. */
|
||||
uint32_t current_hits;
|
||||
|
||||
/* The next condition in the chain. */
|
||||
rc_condition_t* next;
|
||||
|
||||
/* The type of the condition. (RC_CONDITION_*) */
|
||||
uint8_t type;
|
||||
|
||||
/* The comparison operator to use. (RC_OPERATOR_*) */
|
||||
uint8_t oper; /* operator is a reserved word in C++. */
|
||||
|
||||
/* Set if the condition needs to processed as part of the "check if paused" pass. (bool) */
|
||||
uint8_t pause;
|
||||
|
||||
/* Whether or not the condition evaluated true on the last check. (bool) */
|
||||
uint8_t is_true;
|
||||
|
||||
/* Unique identifier of optimized comparator to use. (RC_PROCESSING_COMPARE_*) */
|
||||
uint8_t optimized_comparator;
|
||||
};
|
||||
|
||||
/*****************************************************************************\
|
||||
| Condition sets |
|
||||
\*****************************************************************************/
|
||||
|
||||
typedef struct rc_condset_t rc_condset_t;
|
||||
|
||||
struct rc_condset_t {
|
||||
/* The next condition set in the chain. */
|
||||
rc_condset_t* next;
|
||||
|
||||
/* The list of conditions in this condition set. */
|
||||
rc_condition_t* conditions;
|
||||
|
||||
/* True if any condition in the set is a pause condition. */
|
||||
uint8_t has_pause;
|
||||
|
||||
/* True if the set is currently paused. */
|
||||
uint8_t is_paused;
|
||||
|
||||
/* True if the set has indirect memory references. */
|
||||
uint8_t has_indirect_memrefs;
|
||||
};
|
||||
|
||||
/*****************************************************************************\
|
||||
| Trigger |
|
||||
\*****************************************************************************/
|
||||
|
||||
enum {
|
||||
RC_TRIGGER_STATE_INACTIVE, /* achievement is not being processed */
|
||||
RC_TRIGGER_STATE_WAITING, /* achievement cannot trigger until it has been false for at least one frame */
|
||||
RC_TRIGGER_STATE_ACTIVE, /* achievement is active and may trigger */
|
||||
RC_TRIGGER_STATE_PAUSED, /* achievement is currently paused and will not trigger */
|
||||
RC_TRIGGER_STATE_RESET, /* achievement hit counts were reset */
|
||||
RC_TRIGGER_STATE_TRIGGERED, /* achievement has triggered */
|
||||
RC_TRIGGER_STATE_PRIMED, /* all non-Trigger conditions are true */
|
||||
RC_TRIGGER_STATE_DISABLED /* achievement cannot be processed at this time */
|
||||
};
|
||||
|
||||
struct rc_trigger_t {
|
||||
/* The main condition set. */
|
||||
rc_condset_t* requirement;
|
||||
|
||||
/* The list of sub condition sets in this test. */
|
||||
rc_condset_t* alternative;
|
||||
|
||||
/* The memory references required by the trigger. */
|
||||
rc_memref_t* memrefs;
|
||||
|
||||
/* The current state of the MEASURED condition. */
|
||||
uint32_t measured_value;
|
||||
|
||||
/* The target state of the MEASURED condition */
|
||||
uint32_t measured_target;
|
||||
|
||||
/* The current state of the trigger */
|
||||
uint8_t state;
|
||||
|
||||
/* True if at least one condition has a non-zero hit count */
|
||||
uint8_t has_hits;
|
||||
|
||||
/* True if at least one condition has a non-zero required hit count */
|
||||
uint8_t has_required_hits;
|
||||
|
||||
/* True if the measured value should be displayed as a percentage */
|
||||
uint8_t measured_as_percent;
|
||||
};
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_trigger_size(const char* memaddr);
|
||||
RC_EXPORT rc_trigger_t* RC_CCONV rc_parse_trigger(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx);
|
||||
RC_EXPORT int RC_CCONV rc_evaluate_trigger(rc_trigger_t* trigger, rc_peek_t peek, void* ud, lua_State* L);
|
||||
RC_EXPORT int RC_CCONV rc_test_trigger(rc_trigger_t* trigger, rc_peek_t peek, void* ud, lua_State* L);
|
||||
RC_EXPORT void RC_CCONV rc_reset_trigger(rc_trigger_t* self);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Values |
|
||||
\*****************************************************************************/
|
||||
|
||||
#define RC_VALUE_MAX_NAME_LENGTH 15
|
||||
|
||||
struct rc_value_t {
|
||||
/* The current value of the variable. */
|
||||
rc_memref_value_t value;
|
||||
|
||||
/* The list of conditions to evaluate. */
|
||||
rc_condset_t* conditions;
|
||||
|
||||
/* The memory references required by the variable. */
|
||||
rc_memref_t* memrefs;
|
||||
|
||||
/* The name of the variable. */
|
||||
const char* name;
|
||||
|
||||
/* The next variable in the chain. */
|
||||
rc_value_t* next;
|
||||
};
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_value_size(const char* memaddr);
|
||||
RC_EXPORT rc_value_t* RC_CCONV rc_parse_value(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx);
|
||||
RC_EXPORT int32_t RC_CCONV rc_evaluate_value(rc_value_t* value, rc_peek_t peek, void* ud, lua_State* L);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Leaderboards |
|
||||
\*****************************************************************************/
|
||||
|
||||
/* Return values for rc_evaluate_lboard. */
|
||||
enum {
|
||||
RC_LBOARD_STATE_INACTIVE, /* leaderboard is not being processed */
|
||||
RC_LBOARD_STATE_WAITING, /* leaderboard cannot activate until the start condition has been false for at least one frame */
|
||||
RC_LBOARD_STATE_ACTIVE, /* leaderboard is active and may start */
|
||||
RC_LBOARD_STATE_STARTED, /* leaderboard attempt in progress */
|
||||
RC_LBOARD_STATE_CANCELED, /* leaderboard attempt canceled */
|
||||
RC_LBOARD_STATE_TRIGGERED, /* leaderboard attempt complete, value should be submitted */
|
||||
RC_LBOARD_STATE_DISABLED /* leaderboard cannot be processed at this time */
|
||||
};
|
||||
|
||||
struct rc_lboard_t {
|
||||
rc_trigger_t start;
|
||||
rc_trigger_t submit;
|
||||
rc_trigger_t cancel;
|
||||
rc_value_t value;
|
||||
rc_value_t* progress;
|
||||
rc_memref_t* memrefs;
|
||||
|
||||
uint8_t state;
|
||||
};
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_lboard_size(const char* memaddr);
|
||||
RC_EXPORT rc_lboard_t* RC_CCONV rc_parse_lboard(void* buffer, const char* memaddr, lua_State* L, int funcs_ndx);
|
||||
RC_EXPORT int RC_CCONV rc_evaluate_lboard(rc_lboard_t* lboard, int32_t* value, rc_peek_t peek, void* peek_ud, lua_State* L);
|
||||
RC_EXPORT void RC_CCONV rc_reset_lboard(rc_lboard_t* lboard);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Value formatting |
|
||||
\*****************************************************************************/
|
||||
|
||||
/* Supported formats. */
|
||||
enum {
|
||||
RC_FORMAT_FRAMES,
|
||||
RC_FORMAT_SECONDS,
|
||||
RC_FORMAT_CENTISECS,
|
||||
RC_FORMAT_SCORE,
|
||||
RC_FORMAT_VALUE,
|
||||
RC_FORMAT_MINUTES,
|
||||
RC_FORMAT_SECONDS_AS_MINUTES,
|
||||
RC_FORMAT_FLOAT1,
|
||||
RC_FORMAT_FLOAT2,
|
||||
RC_FORMAT_FLOAT3,
|
||||
RC_FORMAT_FLOAT4,
|
||||
RC_FORMAT_FLOAT5,
|
||||
RC_FORMAT_FLOAT6,
|
||||
RC_FORMAT_FIXED1,
|
||||
RC_FORMAT_FIXED2,
|
||||
RC_FORMAT_FIXED3,
|
||||
RC_FORMAT_TENS,
|
||||
RC_FORMAT_HUNDREDS,
|
||||
RC_FORMAT_THOUSANDS,
|
||||
RC_FORMAT_UNSIGNED_VALUE
|
||||
};
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_parse_format(const char* format_str);
|
||||
RC_EXPORT int RC_CCONV rc_format_value(char* buffer, int size, int32_t value, int format);
|
||||
|
||||
/*****************************************************************************\
|
||||
| Rich Presence |
|
||||
\*****************************************************************************/
|
||||
|
||||
typedef struct rc_richpresence_lookup_item_t rc_richpresence_lookup_item_t;
|
||||
|
||||
struct rc_richpresence_lookup_item_t {
|
||||
uint32_t first;
|
||||
uint32_t last;
|
||||
rc_richpresence_lookup_item_t* left;
|
||||
rc_richpresence_lookup_item_t* right;
|
||||
const char* label;
|
||||
};
|
||||
|
||||
typedef struct rc_richpresence_lookup_t rc_richpresence_lookup_t;
|
||||
|
||||
struct rc_richpresence_lookup_t {
|
||||
rc_richpresence_lookup_item_t* root;
|
||||
rc_richpresence_lookup_t* next;
|
||||
const char* name;
|
||||
const char* default_label;
|
||||
uint8_t format;
|
||||
};
|
||||
|
||||
typedef struct rc_richpresence_display_part_t rc_richpresence_display_part_t;
|
||||
|
||||
struct rc_richpresence_display_part_t {
|
||||
rc_richpresence_display_part_t* next;
|
||||
const char* text;
|
||||
rc_richpresence_lookup_t* lookup;
|
||||
rc_memref_value_t *value;
|
||||
uint8_t display_type;
|
||||
};
|
||||
|
||||
typedef struct rc_richpresence_display_t rc_richpresence_display_t;
|
||||
|
||||
struct rc_richpresence_display_t {
|
||||
rc_trigger_t trigger;
|
||||
rc_richpresence_display_t* next;
|
||||
rc_richpresence_display_part_t* display;
|
||||
};
|
||||
|
||||
struct rc_richpresence_t {
|
||||
rc_richpresence_display_t* first_display;
|
||||
rc_richpresence_lookup_t* first_lookup;
|
||||
rc_memref_t* memrefs;
|
||||
rc_value_t* variables;
|
||||
};
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_richpresence_size(const char* script);
|
||||
RC_EXPORT int RC_CCONV rc_richpresence_size_lines(const char* script, int* lines_read);
|
||||
RC_EXPORT rc_richpresence_t* RC_CCONV rc_parse_richpresence(void* buffer, const char* script, lua_State* L, int funcs_ndx);
|
||||
RC_EXPORT int RC_CCONV rc_evaluate_richpresence(rc_richpresence_t* richpresence, char* buffer, size_t buffersize, rc_peek_t peek, void* peek_ud, lua_State* L);
|
||||
RC_EXPORT void RC_CCONV rc_update_richpresence(rc_richpresence_t* richpresence, rc_peek_t peek, void* peek_ud, lua_State* L);
|
||||
RC_EXPORT int RC_CCONV rc_get_richpresence_display_string(rc_richpresence_t* richpresence, char* buffer, size_t buffersize, rc_peek_t peek, void* peek_ud, lua_State* L);
|
||||
RC_EXPORT void RC_CCONV rc_reset_richpresence(rc_richpresence_t* self);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_RUNTIME_TYPES_H */
|
||||
36
3rdparty/rcheevos/include/rc_url.h
vendored
Normal file
36
3rdparty/rcheevos/include/rc_url.h
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef RC_URL_H
|
||||
#define RC_URL_H
|
||||
|
||||
#include "rc_export.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_award_cheevo(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned cheevo_id, int hardcore, const char* game_hash);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_submit_lboard(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned lboard_id, int value);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_get_lboard_entries(char* buffer, size_t size, unsigned lboard_id, unsigned first_index, unsigned count);
|
||||
RC_EXPORT int RC_CCONV rc_url_get_lboard_entries_near_user(char* buffer, size_t size, unsigned lboard_id, const char* user_name, unsigned count);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_get_gameid(char* buffer, size_t size, const char* hash);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_get_patch(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_get_badge_image(char* buffer, size_t size, const char* badge_name);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_login_with_password(char* buffer, size_t size, const char* user_name, const char* password);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_login_with_token(char* buffer, size_t size, const char* user_name, const char* login_token);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_get_unlock_list(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid, int hardcore);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_post_playing(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid);
|
||||
|
||||
RC_EXPORT int RC_CCONV rc_url_ping(char* url_buffer, size_t url_buffer_size, char* post_buffer, size_t post_buffer_size,
|
||||
const char* user_name, const char* login_token, unsigned gameid, const char* rich_presence);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_URL_H */
|
||||
51
3rdparty/rcheevos/include/rc_util.h
vendored
Normal file
51
3rdparty/rcheevos/include/rc_util.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef RC_UTIL_H
|
||||
#define RC_UTIL_H
|
||||
|
||||
#include "rc_export.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
RC_BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* A block of memory for variable length data (like strings and arrays).
|
||||
*/
|
||||
typedef struct rc_buffer_chunk_t {
|
||||
/* The current location where data is being written */
|
||||
uint8_t* write;
|
||||
/* The first byte past the end of data where writing cannot occur */
|
||||
uint8_t* end;
|
||||
/* The first byte of the data */
|
||||
uint8_t* start;
|
||||
/* The next block in the allocated memory chain */
|
||||
struct rc_buffer_chunk_t* next;
|
||||
}
|
||||
rc_buffer_chunk_t;
|
||||
|
||||
/**
|
||||
* A preallocated block of memory for variable length data (like strings and arrays).
|
||||
*/
|
||||
typedef struct rc_buffer_t {
|
||||
/* The chunk data (will point at the local data member) */
|
||||
struct rc_buffer_chunk_t chunk;
|
||||
/* Small chunk of memory pre-allocated for the chunk */
|
||||
uint8_t data[256];
|
||||
}
|
||||
rc_buffer_t;
|
||||
|
||||
void rc_buffer_init(rc_buffer_t* buffer);
|
||||
void rc_buffer_destroy(rc_buffer_t* buffer);
|
||||
uint8_t* rc_buffer_reserve(rc_buffer_t* buffer, size_t amount);
|
||||
void rc_buffer_consume(rc_buffer_t* buffer, const uint8_t* start, uint8_t* end);
|
||||
void* rc_buffer_alloc(rc_buffer_t* buffer, size_t amount);
|
||||
char* rc_buffer_strcpy(rc_buffer_t* buffer, const char* src);
|
||||
char* rc_buffer_strncpy(rc_buffer_t* buffer, const char* src, size_t len);
|
||||
|
||||
uint32_t rc_djb2(const char* input);
|
||||
|
||||
void rc_format_md5(char checksum[33], const uint8_t digest[16]);
|
||||
|
||||
RC_END_C_DECLS
|
||||
|
||||
#endif /* RC_UTIL_H */
|
||||
8
3rdparty/rcheevos/include/rcheevos.h
vendored
Normal file
8
3rdparty/rcheevos/include/rcheevos.h
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef RCHEEVOS_H
|
||||
#define RCHEEVOS_H
|
||||
|
||||
#include "rc_runtime.h"
|
||||
#include "rc_runtime_types.h"
|
||||
#include "rc_consoles.h"
|
||||
|
||||
#endif /* RCHEEVOS_H */
|
||||
Reference in New Issue
Block a user