Added GenerateRichPresence to AchievementManager
GenerateRichPresence calls rc_runtime_get_richpresence in rhceevos on the achievement runtime to get the current Rich Presence string, a description of the player's current in-game state based on its memory as fed into a custom-developed script downloaded via FetchGameData. This gets passed into PingRichPresence, but is separated into its own method so it can be used elsewhere locally.
This commit is contained in:
parent
1b880564cb
commit
22ee729055
|
@ -409,6 +409,20 @@ void AchievementManager::ActivateDeactivateAchievement(AchievementId id, bool en
|
||||||
rc_runtime_deactivate_achievement(&m_runtime, id);
|
rc_runtime_deactivate_achievement(&m_runtime, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RichPresence AchievementManager::GenerateRichPresence()
|
||||||
|
{
|
||||||
|
RichPresence rp_buffer;
|
||||||
|
Core::RunAsCPUThread([&] {
|
||||||
|
rc_runtime_get_richpresence(
|
||||||
|
&m_runtime, rp_buffer.data(), RP_SIZE,
|
||||||
|
[](unsigned address, unsigned num_bytes, void* ud) {
|
||||||
|
return static_cast<AchievementManager*>(ud)->MemoryPeeker(address, num_bytes, ud);
|
||||||
|
},
|
||||||
|
this, nullptr);
|
||||||
|
});
|
||||||
|
return rp_buffer;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementManager::ResponseType AchievementManager::AwardAchievement(AchievementId achievement_id)
|
AchievementManager::ResponseType AchievementManager::AwardAchievement(AchievementId achievement_id)
|
||||||
{
|
{
|
||||||
std::string username = Config::Get(Config::RA_USERNAME);
|
std::string username = Config::Get(Config::RA_USERNAME);
|
||||||
|
|
|
@ -72,6 +72,7 @@ private:
|
||||||
ResponseType FetchUnlockData(bool hardcore);
|
ResponseType FetchUnlockData(bool hardcore);
|
||||||
|
|
||||||
void ActivateDeactivateAchievement(AchievementId id, bool enabled, bool unofficial, bool encore);
|
void ActivateDeactivateAchievement(AchievementId id, bool enabled, bool unofficial, bool encore);
|
||||||
|
RichPresence GenerateRichPresence();
|
||||||
|
|
||||||
ResponseType AwardAchievement(AchievementId achievement_id);
|
ResponseType AwardAchievement(AchievementId achievement_id);
|
||||||
ResponseType SubmitLeaderboard(AchievementId leaderboard_id, int value);
|
ResponseType SubmitLeaderboard(AchievementId leaderboard_id, int value);
|
||||||
|
|
Loading…
Reference in New Issue