dep/rcheevos: Remove files deleted upstream

pull/3566/head
Stenzek 1 month ago
parent 6126209a25
commit ee9f32185e
No known key found for this signature in database

@ -1,3 +1,61 @@
# v12.0.0
* rc_client changes
* add RC_CLIENT_EVENT_SUBSET_COMPLETED event
* add 'avatar_url' to rc_client_user_t
* add 'badge_url' to rc_client_game_t
* add 'badge_url' and 'badge_locked_url' to rc_client_achievement_t
* add rc_client_set_hash_callbacks
* add rc_client_set_allow_background_memory_reads
* renamed rc_client_begin_change_media to rc_client_begin_identify_and_change_media
* renamed rc_client_begin_change_media_from_hash to rc_client_begin_change_media
* use slim read/write locks for rc_mutex on Windows Vista+
* use critical sections for rc_mutex on older versions of Windows
* add translation layer in rc_client_external for cross-version support
* rhash changes
* rc_hash_init_verbose_message_callback and rc_hash_init_error_message_callback have been deprecated.
- set values in iterator.callbacks instead.
* rc_hash_init_custom_filereader and rc_hash_init_custom_cdreader have been deprecated.
- set values in iterator.callbacks instead.
* rc_hash_generate_from_file and rc_hash_generate_from_buffer have been deprecated.
- use rc_hash_initialize_iterator and rc_hash_generate instead.
* hash.c has been split into several smaller files which can be conditionally excluded from the build.
- hash_disc.c can be excluded by defining RC_HASH_NO_DISC
- hash_encrypted.c can be excluded by defining RC_HASH_NO_ENCRYPTED
- hash_rom.c can be excluded by defining RC_HASH_NO_ROM
- hash_zip.c can be excluded by defining RC_HASH_NO_ZIP
* add hash method for RC_CONSOLE_WII
* add hash method for Arduboy FX games (RC_CONSOLE_ARDUBOY)
* fix hash for PCE homebrew games that aren't multiples of 128KB
* rapi changes
* add _hosted variations of rc_api_init functions for interacting with custom hosts
- rc_api_set_host and rc_api_set_image_host have been deprecated
* add rc_api_fetch_game_sets
* add rc_api_fetch_followed_users
* add rc_api_fetch_hash_library
* add rc_api_fetch_all_user_progress
* add 'avatar_url' to login response, achievement_info response, and leaderboard_info responses
* add 'badge_url' to game_data response
* rurl has been removed (deprecated in v10.0.0)
* trigger parsing/processing code has been largely modified to improve processing performance
* AddAddress/AddSource chains can now be shared across triggers to avoid recalculating them multiple times
* triggers are preprocessed to allocate conditions as array instead of linked list.
- array is sorted such that similar conditions (pause/reset/hittarget/etc) can be processed together
without having to scan the linked list multiple times
- the linked list still exists for backwards compatibility and to maintain the original ordering
* each condition type has its own handler, eliminating many switches and branches when processing triggers
* memrefs are now allocated in arrays (eliminating the linked list pointer from each to reduce memory footprint)
* commas are now inserted into all numeric formats except SCORE. a new format type UNFORMATTED (@Unformatted) has
been added to display a number without commas.
- To forcibly exclude commas in a backwards-compatible way, use the @Unformatted macro and define Unformatted as
a VALUE formatter. Legacy clients will use the VALUE formatted and new clients will use the @Unformatted macro.
* add RC_CONSOLE_FAMICOM_DISK_SYSTEM (split off of RC_CONSOLE_NINTENDO)
* update RC_CONSOLE_SNES memory map to support SA-1 I-RAM and BW-RAM
* update RC_CONSOLE_SEGACD memory map to supprot WORD RAM
* update RC_CONSOLE_N64 memory map to place RDRAM at $80000000 and expansion pak RAM at $80400000
* remove HAVE_LUA define and support (implementation was never finished)
* report error when RP contains address starting with `0x0x`.
* add .natvis files to improve debugging in Visual Studio
# v11.6.0
* backdate retried unlocks in rc_client
* add memory map and hash method for RC_CONSOLE_ZX_SPECTRUM

@ -11,7 +11,6 @@ add_library(rcheevos
include/rc_hash.h
include/rc_runtime.h
include/rc_runtime_types.h
include/rc_url.h
include/rc_util.h
src/rapi/rc_api_common.c
src/rapi/rc_api_common.h
@ -41,7 +40,6 @@ add_library(rcheevos
src/rc_version.h
src/rhash/md5.c
src/rhash/md5.h
src/rurl/url.c
)
target_include_directories(rcheevos PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")

@ -6,6 +6,8 @@ Keep in mind that **rcheevos** does *not* provide HTTP network connections. Clie
Not all structures defined by **rcheevos** can be created via the public API, but are exposed to allow interactions beyond just creation, destruction, and testing, such as the ones required by UI code that helps to create them.
**NOTE**: development occurs on the _develop_ branch, which is set as the default branch in GitHub so newly opened PRs will request to be merged into the _develop_ branch. When integrating **rcheevos** into your project, we recommend using the _master_ branch, which corresponds to the last official release, and minimizes the risk of encountering a bug that has been introduced since the last official release.
## API
An understanding about how achievements are developed may be useful, you can read more about it [here](https://docs.retroachievements.org/developer-docs/).
@ -27,9 +29,7 @@ Platforms supported by RetroAchievements are enumerated in `rc_consoles.h`. Note
## Runtime support
Provides a set of functions for managing an active game - initializing and processing achievements, leaderboards, and rich presence. When important things occur, events are raised for the caller via a callback.
The `rc_client_t` functions wrap a `rc_runtime_t` and manage the API calls and other common functionality (like managing the user information, identifying/loading a game, and building the active/inactive achievements list for the UI). Please see [the wiki](https://github.com/RetroAchievements/rcheevos/wiki/rc_client-integration) for details on using the `rc_client_t` functions.
A set of functions for managing an active game is provided by the library. If you are considering adding achievement support to your emulator, you should look at the `rc_client_t` functions which will prepare the API calls and other implement other common functionality (like managing the user information, identifying/loading a game, and building the active/inactive achievements list for the UI). It has several callback functions which allow the client to implement dependent functionality (UI and HTTP calls). Please see [the wiki](https://github.com/RetroAchievements/rcheevos/wiki/rc_client-integration) for details on using the `rc_client_t` functions.
## Server Communication
@ -37,11 +37,9 @@ The `rc_client_t` functions wrap a `rc_runtime_t` and manage the API calls and o
**rapi** does *not* make HTTP requests.
NOTE: **rapi** is a replacement for **rurl**. **rurl** has been deprecated.
NOTE: `rc_client` is the preferred way to have a client interact with the server.
These are in `rc_api_user.h`, `rc_api_runtime.h` and `rc_api_common.h`.
**rapi** headers are `rc_api_user.h`, `rc_api_runtime.h` and `rc_api_common.h`.
The basic process of making an **rapi** call is to initialize a params object, call a function to convert it to a URL, send that to the server, then pass the response to a function to convert it into a response object, and handle the response values.
@ -63,3 +61,7 @@ These are in `rc_hash.h`.
int rc_hash_iterate(char hash[33], rc_hash_iterator_t* iterator);
void rc_hash_destroy_iterator(rc_hash_iterator_t* iterator);
```
### Custom file handling
**rhash** (and by extension **rc_client**) support custom handlers for opening/reading files. This allows the client to redirect file reads to support custom file formats (like ZIP or CHD).

@ -1,36 +0,0 @@
#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 */

@ -30,7 +30,6 @@
<ClCompile Include="src\rc_compat.c" />
<ClCompile Include="src\rc_util.c" />
<ClCompile Include="src\rhash\md5.c" />
<ClCompile Include="src\rurl\url.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\rcheevos.h" />
@ -45,7 +44,6 @@
<ClInclude Include="include\rc_hash.h" />
<ClInclude Include="include\rc_runtime.h" />
<ClInclude Include="include\rc_runtime_types.h" />
<ClInclude Include="include\rc_url.h" />
<ClInclude Include="include\rc_util.h" />
<ClInclude Include="src\rapi\rc_api_common.h" />
<ClInclude Include="src\rcheevos\rc_internal.h" />

@ -4,9 +4,6 @@
<Filter Include="rcheevos">
<UniqueIdentifier>{0d8ef204-a486-4873-a41d-743ca6cbe840}</UniqueIdentifier>
</Filter>
<Filter Include="rurl">
<UniqueIdentifier>{3aa9379e-4fd1-4772-b18c-b899631a4161}</UniqueIdentifier>
</Filter>
<Filter Include="rhash">
<UniqueIdentifier>{c95da822-5bca-4274-b57e-d2092e76e8f1}</UniqueIdentifier>
</Filter>
@ -18,9 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\rurl\url.c">
<Filter>rurl</Filter>
</ClCompile>
<ClCompile Include="src\rhash\md5.c">
<Filter>rhash</Filter>
</ClCompile>
@ -100,9 +94,6 @@
<ClInclude Include="include\rc_runtime_types.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="include\rc_url.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="include\rcheevos.h">
<Filter>include</Filter>
</ClInclude>

@ -1,402 +0,0 @@
#include "rc_url.h"
#include "../rc_compat.h"
#include "../rhash/md5.h"
#include <stdio.h>
#include <string.h>
#if RCHEEVOS_URL_SSL
#define RCHEEVOS_URL_PROTOCOL "https"
#else
#define RCHEEVOS_URL_PROTOCOL "http"
#endif
static int rc_url_encode(char* encoded, size_t len, const char* str) {
for (;;) {
switch (*str) {
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
case '-': case '_': case '.': case '~':
if (len < 2)
return -1;
*encoded++ = *str++;
--len;
break;
case ' ':
if (len < 2)
return -1;
*encoded++ = '+';
++str;
--len;
break;
default:
if (len < 4)
return -1;
snprintf(encoded, len, "%%%02x", (unsigned char)*str);
encoded += 3;
++str;
len -= 3;
break;
case '\0':
*encoded = 0;
return 0;
}
}
}
int 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) {
char urle_user_name[64];
char urle_login_token[64];
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) {
return -1;
}
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=awardachievement&u=%s&t=%s&a=%u&h=%d",
urle_user_name,
urle_login_token,
cheevo_id,
hardcore ? 1 : 0
);
if (game_hash && strlen(game_hash) == 32 && (size - (size_t)written) >= 35) {
written += snprintf(buffer + written, size - (size_t)written, "&m=%s", game_hash);
}
return (size_t)written >= size ? -1 : 0;
}
int rc_url_submit_lboard(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned lboard_id, int value) {
char urle_user_name[64];
char urle_login_token[64];
char signature[64];
unsigned char hash[16];
md5_state_t state;
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) {
return -1;
}
/* Evaluate the signature. */
snprintf(signature, sizeof(signature), "%u%s%d", lboard_id, user_name, value);
md5_init(&state);
md5_append(&state, (unsigned char*)signature, (int)strlen(signature));
md5_finish(&state, hash);
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=submitlbentry&u=%s&t=%s&i=%u&s=%d&v=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
urle_user_name,
urle_login_token,
lboard_id,
value,
hash[ 0], hash[ 1], hash[ 2], hash[ 3], hash[ 4], hash[ 5], hash[ 6], hash[ 7],
hash[ 8], hash[ 9], hash[10], hash[11],hash[12], hash[13], hash[14], hash[15]
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_get_gameid(char* buffer, size_t size, const char* hash) {
int written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=gameid&m=%s",
hash
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_get_patch(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid) {
char urle_user_name[64];
char urle_login_token[64];
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) {
return -1;
}
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=patch&u=%s&t=%s&g=%u",
urle_user_name,
urle_login_token,
gameid
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_get_badge_image(char* buffer, size_t size, const char* badge_name) {
int written = snprintf(
buffer,
size,
"http://i.retroachievements.org/Badge/%s",
badge_name
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_login_with_password(char* buffer, size_t size, const char* user_name, const char* password) {
char urle_user_name[64];
char urle_password[256];
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_password, sizeof(urle_password), password) != 0) {
return -1;
}
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=login&u=%s&p=%s",
urle_user_name,
urle_password
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_login_with_token(char* buffer, size_t size, const char* user_name, const char* login_token) {
char urle_user_name[64];
char urle_login_token[64];
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) {
return -1;
}
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=login&u=%s&t=%s",
urle_user_name,
urle_login_token
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_get_unlock_list(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid, int hardcore) {
char urle_user_name[64];
char urle_login_token[64];
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) {
return -1;
}
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=unlocks&u=%s&t=%s&g=%u&h=%d",
urle_user_name,
urle_login_token,
gameid,
hardcore ? 1 : 0
);
return (size_t)written >= size ? -1 : 0;
}
int rc_url_post_playing(char* buffer, size_t size, const char* user_name, const char* login_token, unsigned gameid) {
char urle_user_name[64];
char urle_login_token[64];
int written;
if (rc_url_encode(urle_user_name, sizeof(urle_user_name), user_name) != 0) {
return -1;
}
if (rc_url_encode(urle_login_token, sizeof(urle_login_token), login_token) != 0) {
return -1;
}
written = snprintf(
buffer,
size,
RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php?r=postactivity&u=%s&t=%s&a=3&m=%u",
urle_user_name,
urle_login_token,
gameid
);
return (size_t)written >= size ? -1 : 0;
}
static int rc_url_append_param_equals(char* buffer, size_t buffer_size, size_t buffer_offset, const char* param)
{
int written = 0;
size_t param_len;
if (buffer_offset >= buffer_size)
return -1;
if (buffer_offset) {
buffer += buffer_offset;
buffer_size -= buffer_offset;
if (buffer[-1] != '?') {
*buffer++ = '&';
buffer_size--;
written = 1;
}
}
param_len = strlen(param);
if (param_len + 1 >= buffer_size)
return -1;
memcpy(buffer, param, param_len);
buffer[param_len] = '=';
written += (int)param_len + 1;
return written + (int)buffer_offset;
}
static int rc_url_append_unum(char* buffer, size_t buffer_size, size_t* buffer_offset, const char* param, unsigned value)
{
int written = rc_url_append_param_equals(buffer, buffer_size, *buffer_offset, param);
if (written > 0) {
char num[16];
int chars = snprintf(num, sizeof(num), "%u", value);
if (chars + written < (int)buffer_size) {
memcpy(&buffer[written], num, chars + 1);
*buffer_offset = written + chars;
return 0;
}
}
return -1;
}
static int rc_url_append_str(char* buffer, size_t buffer_size, size_t* buffer_offset, const char* param, const char* value)
{
int written = rc_url_append_param_equals(buffer, buffer_size, *buffer_offset, param);
if (written > 0) {
buffer += written;
buffer_size -= written;
if (rc_url_encode(buffer, buffer_size, value) == 0) {
written += (int)strlen(buffer);
*buffer_offset = written;
return 0;
}
}
return -1;
}
static int rc_url_build_dorequest(char* url_buffer, size_t url_buffer_size, size_t* buffer_offset,
const char* api, const char* user_name)
{
const char* base_url = RCHEEVOS_URL_PROTOCOL"://retroachievements.org/dorequest.php";
size_t written = strlen(base_url);
int failure = 0;
if (url_buffer_size < written + 1)
return -1;
memcpy(url_buffer, base_url, written);
url_buffer[written++] = '?';
failure |= rc_url_append_str(url_buffer, url_buffer_size, &written, "r", api);
if (user_name)
failure |= rc_url_append_str(url_buffer, url_buffer_size, &written, "u", user_name);
*buffer_offset += written;
return failure;
}
int 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)
{
size_t written = 0;
int failure = rc_url_build_dorequest(url_buffer, url_buffer_size, &written, "ping", user_name);
failure |= rc_url_append_unum(url_buffer, url_buffer_size, &written, "g", gameid);
written = 0;
failure |= rc_url_append_str(post_buffer, post_buffer_size, &written, "t", login_token);
if (rich_presence && *rich_presence)
failure |= rc_url_append_str(post_buffer, post_buffer_size, &written, "m", rich_presence);
if (failure) {
if (url_buffer_size)
url_buffer[0] = '\0';
if (post_buffer_size)
post_buffer[0] = '\0';
}
return failure;
}
int rc_url_get_lboard_entries(char* buffer, size_t size, unsigned lboard_id, unsigned first_index, unsigned count)
{
size_t written = 0;
int failure = rc_url_build_dorequest(buffer, size, &written, "lbinfo", NULL);
failure |= rc_url_append_unum(buffer, size, &written, "i", lboard_id);
if (first_index > 1)
failure |= rc_url_append_unum(buffer, size, &written, "o", first_index - 1);
failure |= rc_url_append_unum(buffer, size, &written, "c", count);
return failure;
}
int rc_url_get_lboard_entries_near_user(char* buffer, size_t size, unsigned lboard_id, const char* user_name, unsigned count)
{
size_t written = 0;
int failure = rc_url_build_dorequest(buffer, size, &written, "lbinfo", NULL);
failure |= rc_url_append_unum(buffer, size, &written, "i", lboard_id);
failure |= rc_url_append_str(buffer, size, &written, "u", user_name);
failure |= rc_url_append_unum(buffer, size, &written, "c", count);
return failure;
}
#undef RCHEEVOS_URL_PROTOCOL
Loading…
Cancel
Save