Added HandleLeaderboardTriggeredEvent to AchievementManager

HandleLeaderboardTriggeredEvent processes a leaderboard event and asynchronizes via the work queue a synchronous call to SubmitLeaderboard.
This commit is contained in:
LillyJadeKatrin 2023-04-15 11:31:43 -04:00
parent 637ca82fc1
commit a48fab0abf
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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 <typename RcRequest, typename RcResponse>
ResponseType Request(RcRequest rc_request, RcResponse* rc_response,