Skip to content

Commit

Permalink
change http to https for SSL image host provided by DLL if SLL not su…
Browse files Browse the repository at this point in the history
…pported
  • Loading branch information
Jamiras committed Feb 11, 2024
1 parent cf722a5 commit 5b30026
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cheevos/cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -3184,6 +3184,24 @@ static void rcheevos_load_raintegration_callback(int result,
{
struct retro_game_info* info = (struct retro_game_info*)userdata;

#ifndef HAVE_SSL
/* raintegration will provide its own host information. if it provides an SSL host
* and we can't make SSL calls, change it to a non-SSL request and cross our fingers */
char url[256] = "";
if (rc_client_achievement_get_image_url(NULL, RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED, url, sizeof(url)) == RC_OK &&
strncmp(url, "https://", 8) == 0)
{
char* ptr = &url[7], ch;
url[4] = ':';
url[5] = '/';
url[6] = '/';
while ((ch = ptr[1]) != '/')
*ptr++ = ch;
*ptr = '\0';
rc_api_set_image_host(url);
}
#endif

rc_client_raintegration_set_event_handler(client, rcheevos_raintegration_event_handler);

rcheevos_load(info);
Expand Down
3 changes: 3 additions & 0 deletions deps/rcheevos/src/rapi/rc_api_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,9 @@ static void rc_api_update_host(char** host, const char* hostname) {
}

void rc_api_set_host(const char* hostname) {
if (hostname && strcmp(hostname, RETROACHIEVEMENTS_HOST) == 0)
hostname = NULL;

rc_api_update_host(&g_host, hostname);

if (!hostname) {
Expand Down

0 comments on commit 5b30026

Please sign in to comment.