Merge pull request #12592 from LillyJadeKatrin/retroachievements-enable-hardcore
Properly enable RetroAchievements hardcore mode
This commit is contained in:
commit
93c95ee1a3
|
@ -24,8 +24,6 @@
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
#include "VideoCommon/VideoEvents.h"
|
#include "VideoCommon/VideoEvents.h"
|
||||||
|
|
||||||
static constexpr bool hardcore_mode_enabled = false;
|
|
||||||
|
|
||||||
static std::unique_ptr<OSD::Icon> DecodeBadgeToOSDIcon(const AchievementManager::Badge& badge);
|
static std::unique_ptr<OSD::Icon> DecodeBadgeToOSDIcon(const AchievementManager::Badge& badge);
|
||||||
|
|
||||||
AchievementManager& AchievementManager::GetInstance()
|
AchievementManager& AchievementManager::GetInstance()
|
||||||
|
@ -373,12 +371,13 @@ void AchievementManager::ActivateDeactivateLeaderboards()
|
||||||
{
|
{
|
||||||
if (!Config::Get(Config::RA_ENABLED) || !IsLoggedIn())
|
if (!Config::Get(Config::RA_ENABLED) || !IsLoggedIn())
|
||||||
return;
|
return;
|
||||||
bool leaderboards_enabled = Config::Get(Config::RA_LEADERBOARDS_ENABLED);
|
bool leaderboards_enabled =
|
||||||
|
Config::Get(Config::RA_LEADERBOARDS_ENABLED) && Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||||
for (u32 ix = 0; ix < m_game_data.num_leaderboards; ix++)
|
for (u32 ix = 0; ix < m_game_data.num_leaderboards; ix++)
|
||||||
{
|
{
|
||||||
auto leaderboard = m_game_data.leaderboards[ix];
|
auto leaderboard = m_game_data.leaderboards[ix];
|
||||||
u32 leaderboard_id = leaderboard.id;
|
u32 leaderboard_id = leaderboard.id;
|
||||||
if (m_is_game_loaded && leaderboards_enabled && hardcore_mode_enabled)
|
if (m_is_game_loaded && leaderboards_enabled)
|
||||||
{
|
{
|
||||||
rc_runtime_activate_lboard(&m_runtime, leaderboard_id, leaderboard.definition, nullptr, 0);
|
rc_runtime_activate_lboard(&m_runtime, leaderboard_id, leaderboard.definition, nullptr, 0);
|
||||||
m_queue.EmplaceItem([this, leaderboard_id] {
|
m_queue.EmplaceItem([this, leaderboard_id] {
|
||||||
|
@ -798,6 +797,7 @@ AchievementManager::PointSpread AchievementManager::TallyScore() const
|
||||||
PointSpread spread{};
|
PointSpread spread{};
|
||||||
if (!IsGameLoaded())
|
if (!IsGameLoaded())
|
||||||
return spread;
|
return spread;
|
||||||
|
bool hardcore_mode_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||||
for (const auto& entry : m_unlock_map)
|
for (const auto& entry : m_unlock_map)
|
||||||
{
|
{
|
||||||
if (entry.second.category != RC_ACHIEVEMENT_CATEGORY_CORE)
|
if (entry.second.category != RC_ACHIEVEMENT_CATEGORY_CORE)
|
||||||
|
@ -1304,6 +1304,7 @@ void AchievementManager::ActivateDeactivateAchievement(AchievementId id, bool en
|
||||||
const UnlockStatus& status = it->second;
|
const UnlockStatus& status = it->second;
|
||||||
u32 index = status.game_data_index;
|
u32 index = status.game_data_index;
|
||||||
bool active = (rc_runtime_get_achievement(&m_runtime, id) != nullptr);
|
bool active = (rc_runtime_get_achievement(&m_runtime, id) != nullptr);
|
||||||
|
bool hardcore_mode_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||||
|
|
||||||
// Deactivate achievements if game is not loaded
|
// Deactivate achievements if game is not loaded
|
||||||
bool activate = m_is_game_loaded;
|
bool activate = m_is_game_loaded;
|
||||||
|
@ -1358,6 +1359,7 @@ AchievementManager::ResponseType AchievementManager::AwardAchievement(Achievemen
|
||||||
{
|
{
|
||||||
std::string username = Config::Get(Config::RA_USERNAME);
|
std::string username = Config::Get(Config::RA_USERNAME);
|
||||||
std::string api_token = Config::Get(Config::RA_API_TOKEN);
|
std::string api_token = Config::Get(Config::RA_API_TOKEN);
|
||||||
|
bool hardcore_mode_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||||
rc_api_award_achievement_request_t award_request = {.username = username.c_str(),
|
rc_api_award_achievement_request_t award_request = {.username = username.c_str(),
|
||||||
.api_token = api_token.c_str(),
|
.api_token = api_token.c_str(),
|
||||||
.achievement_id = achievement_id,
|
.achievement_id = achievement_id,
|
||||||
|
@ -1427,7 +1429,7 @@ void AchievementManager::DisplayWelcomeMessage()
|
||||||
{
|
{
|
||||||
std::lock_guard lg{m_lock};
|
std::lock_guard lg{m_lock};
|
||||||
PointSpread spread = TallyScore();
|
PointSpread spread = TallyScore();
|
||||||
if (hardcore_mode_enabled)
|
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||||
{
|
{
|
||||||
OSD::AddMessage(
|
OSD::AddMessage(
|
||||||
fmt::format("You have {}/{} achievements worth {}/{} points", spread.hard_unlocks,
|
fmt::format("You have {}/{} achievements worth {}/{} points", spread.hard_unlocks,
|
||||||
|
@ -1452,6 +1454,7 @@ void AchievementManager::DisplayWelcomeMessage()
|
||||||
|
|
||||||
void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_t* runtime_event)
|
void AchievementManager::HandleAchievementTriggeredEvent(const rc_runtime_event_t* runtime_event)
|
||||||
{
|
{
|
||||||
|
bool hardcore_mode_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
|
||||||
const auto event_id = runtime_event->id;
|
const auto event_id = runtime_event->id;
|
||||||
auto it = m_unlock_map.find(event_id);
|
auto it = m_unlock_map.find(event_id);
|
||||||
if (it == m_unlock_map.end())
|
if (it == m_unlock_map.end())
|
||||||
|
|
Loading…
Reference in New Issue