From a48fab0abfca2700ff345b0f3f8ef1763c1a329f Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Sat, 15 Apr 2023 11:31:43 -0400 Subject: [PATCH] Added HandleLeaderboardTriggeredEvent to AchievementManager HandleLeaderboardTriggeredEvent processes a leaderboard event and asynchronizes via the work queue a synchronous call to SubmitLeaderboard. --- Source/Core/Core/AchievementManager.cpp | 6 ++++++ Source/Core/Core/AchievementManager.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index c974ae2e12..dce2f89dae 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -429,6 +429,12 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_ Config::Get(Config::RA_ENCORE_ENABLED)); } +void AchievementManager::HandleLeaderboardTriggeredEvent(const rc_runtime_event_t* runtime_event) +{ + m_queue.EmplaceItem( + [this, runtime_event] { SubmitLeaderboard(runtime_event->id, runtime_event->value); }); +} + // 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 18be428163..dca350bf90 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -70,6 +70,7 @@ private: ResponseType PingRichPresence(const RichPresence& rich_presence); void HandleAchievementTriggeredEvent(const rc_runtime_event_t* runtime_event); + void HandleLeaderboardTriggeredEvent(const rc_runtime_event_t* runtime_event); template ResponseType Request(RcRequest rc_request, RcResponse* rc_response,