mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-27 08:15:33 +01:00
Merge pull request #12212 from LillyJadeKatrin/retroachievements-bugfix
Added error checking and logging to AchievementManager::GetAchievemen…
This commit is contained in:
commit
d55d878b17
@ -688,12 +688,25 @@ AchievementManager::GetUnlockStatus(AchievementId achievement_id) const
|
|||||||
return m_unlock_map.at(achievement_id);
|
return m_unlock_map.at(achievement_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AchievementManager::GetAchievementProgress(AchievementId achievement_id, u32* value,
|
AchievementManager::ResponseType
|
||||||
u32* target)
|
AchievementManager::GetAchievementProgress(AchievementId achievement_id, u32* value, u32* target)
|
||||||
{
|
{
|
||||||
if (!IsGameLoaded())
|
if (!IsGameLoaded())
|
||||||
return;
|
{
|
||||||
rc_runtime_get_achievement_measured(&m_runtime, achievement_id, value, target);
|
ERROR_LOG_FMT(
|
||||||
|
ACHIEVEMENTS,
|
||||||
|
"Attempted to request measured data for achievement ID {} when no game is running.",
|
||||||
|
achievement_id);
|
||||||
|
return ResponseType::INVALID_REQUEST;
|
||||||
|
}
|
||||||
|
int result = rc_runtime_get_achievement_measured(&m_runtime, achievement_id, value, target);
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to get measured data for achievement ID {}.",
|
||||||
|
achievement_id);
|
||||||
|
return ResponseType::MALFORMED_OBJECT;
|
||||||
|
}
|
||||||
|
return ResponseType::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
AchievementManager::RichPresence AchievementManager::GetRichPresence()
|
AchievementManager::RichPresence AchievementManager::GetRichPresence()
|
||||||
|
@ -111,7 +111,8 @@ public:
|
|||||||
rc_api_fetch_game_data_response_t* GetGameData();
|
rc_api_fetch_game_data_response_t* GetGameData();
|
||||||
const BadgeStatus& GetGameBadge() const;
|
const BadgeStatus& GetGameBadge() const;
|
||||||
const UnlockStatus& GetUnlockStatus(AchievementId achievement_id) const;
|
const UnlockStatus& GetUnlockStatus(AchievementId achievement_id) const;
|
||||||
void GetAchievementProgress(AchievementId achievement_id, u32* value, u32* target);
|
AchievementManager::ResponseType GetAchievementProgress(AchievementId achievement_id, u32* value,
|
||||||
|
u32* target);
|
||||||
RichPresence GetRichPresence();
|
RichPresence GetRichPresence();
|
||||||
|
|
||||||
void CloseGame();
|
void CloseGame();
|
||||||
|
@ -105,8 +105,9 @@ AchievementProgressWidget::CreateAchievementBox(const rc_api_achievement_definit
|
|||||||
a_progress_bar->setSizePolicy(sp_retain);
|
a_progress_bar->setSizePolicy(sp_retain);
|
||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
unsigned int target = 0;
|
unsigned int target = 0;
|
||||||
AchievementManager::GetInstance()->GetAchievementProgress(achievement->id, &value, &target);
|
if (AchievementManager::GetInstance()->GetAchievementProgress(achievement->id, &value, &target) ==
|
||||||
if (target > 0)
|
AchievementManager::ResponseType::SUCCESS &&
|
||||||
|
target > 0)
|
||||||
{
|
{
|
||||||
a_progress_bar->setRange(0, target);
|
a_progress_bar->setRange(0, target);
|
||||||
a_progress_bar->setValue(value);
|
a_progress_bar->setValue(value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user