From 05018fb40deef3001110e3ea58e7ace9a1ca258d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 17 Jun 2026 16:20:53 +0200 Subject: [PATCH] RetroAchievement images: Workaround for lack of https on Linux Fixes #21843 --- Core/RetroAchievements.cpp | 12 ++++++++---- UI/RetroAchievementScreens.cpp | 17 +++++++++++------ UI/SystemInfoScreen.cpp | 1 + 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Core/RetroAchievements.cpp b/Core/RetroAchievements.cpp index d0f6701183..0b9f1125ba 100644 --- a/Core/RetroAchievements.cpp +++ b/Core/RetroAchievements.cpp @@ -35,6 +35,7 @@ #include "Common/Log.h" #include "Common/File/Path.h" #include "Common/Net/HTTPRequest.h" +#include "Common/Net/HTTPClient.h" #include "Common/System/OSD.h" #include "Common/System/System.h" #include "Common/System/NativeApp.h" @@ -290,8 +291,9 @@ static void server_call_callback(const rc_api_request_t *request, { // If post data is provided, we need to make a POST request, otherwise, a GET request will suffice. auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); + std::string url = http::RemoveHttpsIfNeeded(request->url); if (request->post_data) { - std::shared_ptr download = g_DownloadManager.AsyncPostWithCallback(std::string(request->url), std::string(request->post_data), "application/x-www-form-urlencoded", http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed, + std::shared_ptr download = g_DownloadManager.AsyncPostWithCallback(url, std::string(request->post_data), "application/x-www-form-urlencoded", http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed, [callback, callback_data](http::Request &download) { std::string buffer; download.buffer().TakeAll(&buffer); @@ -302,7 +304,7 @@ static void server_call_callback(const rc_api_request_t *request, callback(&response, callback_data); }, ac->T("Contacting RetroAchievements server...")); } else { - std::shared_ptr download = g_DownloadManager.StartDownload(std::string(request->url), Path(), http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed, nullptr, + std::shared_ptr download = g_DownloadManager.StartDownload(url, Path(), http::RequestFlags::ProgressBar | http::RequestFlags::ProgressBarDelayed, nullptr, ac->T("Contacting RetroAchievements server..."), [callback, callback_data](http::Request &download) { std::string buffer; @@ -918,6 +920,7 @@ bool HasAchievementsOrLeaderboards() { } void DownloadImageIfMissing(std::string_view url) { + // On Linux for example, we currently have no way of doing a HTTPS request. if (g_iconCache.MarkPending(url)) { INFO_LOG(Log::Achievements, "Downloading image: %.*s", STR_VIEW(url)); g_DownloadManager.StartDownload(url, Path(), http::RequestFlags::Default, nullptr, "", [](http::Request &download) { @@ -985,7 +988,8 @@ void identify_and_load_callback(int result, const char *error_message, rc_client // Successful! Show a message that we're active. const rc_client_game_t *gameInfo = rc_client_get_game_info(client); - DownloadImageIfMissing(gameInfo->badge_url); + std::string imageUrl = http::RemoveHttpsIfNeeded(gameInfo->badge_url); + DownloadImageIfMissing(imageUrl); GameRegion region = DetectGameRegionFromID(g_paramSFO.GetDiscID()); auto ga = GetI18NCategory(I18NCat::GAME); @@ -997,7 +1001,7 @@ void identify_and_load_callback(int result, const char *error_message, rc_client title += ")"; } // TODO: Detect current subset. - g_OSD.Show(OSDType::MESSAGE_INFO, title, GetGameAchievementSummary(0), gameInfo->badge_url, 5.0f); + g_OSD.Show(OSDType::MESSAGE_INFO, title, GetGameAchievementSummary(0), imageUrl, 5.0f); break; } case RC_NO_GAME_LOADED: diff --git a/UI/RetroAchievementScreens.cpp b/UI/RetroAchievementScreens.cpp index 81e408f5b4..69e9ae4e73 100644 --- a/UI/RetroAchievementScreens.cpp +++ b/UI/RetroAchievementScreens.cpp @@ -9,6 +9,7 @@ #include "Common/UI/PopupScreens.h" #include "Common/UI/Notice.h" #include "Common/StringUtils.h" +#include "Common/Net/HTTPClient.h" #include "Core/Config.h" #include "Core/RetroAchievements.h" @@ -619,8 +620,9 @@ void RenderAchievement(UIContext &dc, const rc_client_achievement_t *achievement // Download and display the image. const char *url = iconState == RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED ? achievement->badge_url : achievement->badge_locked_url; - Achievements::DownloadImageIfMissing(url); - if (g_iconCache.BindIconTexture(&dc, url)) { + std::string imageUrl = http::RemoveHttpsIfNeeded(url); + Achievements::DownloadImageIfMissing(imageUrl); + if (g_iconCache.BindIconTexture(&dc, imageUrl)) { dc.Draw()->DrawTexRect(Bounds(bounds.x + padding, bounds.y + padding, iconSpace, iconSpace), 0.0f, 0.0f, 1.0f, 1.0f, whiteAlpha(alpha)); } dc.SetFontStyle(*GetTextStyle(dc, UI::TextSize::Normal)); @@ -668,8 +670,10 @@ static void RenderGameAchievementSummary(UIContext &dc, const Bounds &bounds, fl dc.SetFontStyle(dc.GetTheme().uiFont); dc.Flush(); - Achievements::DownloadImageIfMissing(gameInfo->badge_url); - if (g_iconCache.BindIconTexture(&dc, gameInfo->badge_url)) { + std::string imageUrl = http::RemoveHttpsIfNeeded(gameInfo->badge_url); + + Achievements::DownloadImageIfMissing(imageUrl); + if (g_iconCache.BindIconTexture(&dc, imageUrl)) { dc.Draw()->DrawTexRect(Bounds(bounds.x, bounds.y + (bounds.h - iconSpace) * 0.5f, iconSpace, iconSpace), 0.0f, 0.0f, 1.0f, 1.0f, whiteAlpha(alpha)); } @@ -765,8 +769,9 @@ static void RenderLeaderboardEntry(UIContext &dc, const rc_client_leaderboard_en // Come up with a unique name for the icon entry. char userImageUrl[512]; if (RC_OK == rc_client_leaderboard_entry_get_user_image_url(entry, userImageUrl, sizeof(userImageUrl))) { - Achievements::DownloadImageIfMissing(userImageUrl); - if (g_iconCache.BindIconTexture(&dc, userImageUrl)) { + std::string imageUrl = http::RemoveHttpsIfNeeded(userImageUrl); + Achievements::DownloadImageIfMissing(imageUrl); + if (g_iconCache.BindIconTexture(&dc, imageUrl)) { dc.Draw()->DrawTexRect(Bounds(bounds.x + iconLeft, bounds.y + 4.0f, 64.0f, 64.0f), 0.0f, 0.0f, 1.0f, 1.0f, whiteAlpha(alpha)); } } diff --git a/UI/SystemInfoScreen.cpp b/UI/SystemInfoScreen.cpp index b31cabf19b..3aeae7ed98 100644 --- a/UI/SystemInfoScreen.cpp +++ b/UI/SystemInfoScreen.cpp @@ -219,6 +219,7 @@ void SystemInfoScreen::CreateDeviceInfoTab(UI::LinearLayout *deviceSpecs) { build = si->T("Debug"); #endif osInformation->Add(new InfoItem(si->T("PPSSPP build"), build)); + osInformation->Add(new InfoItem(si->T("HTTPS supported"), System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS) ? di->T("Yes") : di->T("No"))); CollapsibleSection *displayInfo = deviceSpecs->Add(new CollapsibleSection(si->T("Display Information"))); #if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(UWP)