From bd75ce6e6db1c3bc06daae951bddf9733c9783ad Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Wed, 5 Apr 2023 20:19:58 -0400 Subject: [PATCH] Added FetchGameData to AchievementManager FetchGameData is the big one - this retrieves the logic for all the achievements, leaderboards, and rich presence, and all the relevant metadata for the game. --- Source/Core/Core/AchievementManager.cpp | 11 +++++++++++ Source/Core/Core/AchievementManager.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index 6239563167..ff93120d7c 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -106,6 +106,17 @@ AchievementManager::ResponseType AchievementManager::StartRASession() return r_type; } +AchievementManager::ResponseType AchievementManager::FetchGameData() +{ + std::string username = Config::Get(Config::RA_USERNAME); + std::string api_token = Config::Get(Config::RA_API_TOKEN); + rc_api_fetch_game_data_request_t fetch_data_request = { + .username = username.c_str(), .api_token = api_token.c_str(), .game_id = m_game_id}; + return Request( + fetch_data_request, &m_game_data, rc_api_init_fetch_game_data_request, + rc_api_process_fetch_game_data_response); +} + // Every RetroAchievements API call, with only a partial exception for fetch_image, follows // the same design pattern (here, X is the name of the call): // Create a specific rc_api_X_request_t struct and populate with the necessary values diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index c16c140670..7e39990fd3 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -44,6 +44,7 @@ private: ResponseType VerifyCredentials(const std::string& password); ResponseType ResolveHash(std::array game_hash); ResponseType StartRASession(); + ResponseType FetchGameData(); template ResponseType Request(RcRequest rc_request, RcResponse* rc_response, @@ -57,6 +58,8 @@ private: + rc_api_fetch_game_data_response_t m_game_data{}; + Common::WorkQueueThread> m_queue; }; // class AchievementManager