summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLillyJadeKatrin <lilly.kitty.1988@gmail.com>2023-04-05 20:19:58 -0400
committerLillyJadeKatrin <lilly.kitty.1988@gmail.com>2023-04-12 03:08:47 -0400
commitbd75ce6e6db1c3bc06daae951bddf9733c9783ad (patch)
tree0df4428d01549454255e5dd6750bca1f8b322fbc /Source/Core
parent7e8a770b309b61e87ca9cf133d2cec41552e90fc (diff)
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.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/AchievementManager.cpp11
-rw-r--r--Source/Core/Core/AchievementManager.h3
2 files changed, 14 insertions, 0 deletions
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<rc_api_fetch_game_data_request_t, rc_api_fetch_game_data_response_t>(
+ 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<char, HASH_LENGTH> game_hash);
ResponseType StartRASession();
+ ResponseType FetchGameData();
template <typename RcRequest, typename RcResponse>
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<std::function<void()>> m_queue;
}; // class AchievementManager