Properly enable RetroAchievements hardcore mode

RetroAchievements plans to use the user_agent in unlock requests to determine which software version was used to play the game, and can filter older software versions out. As such, I have been given the go-ahead to remove the hardcoded line that forces hardcore to always be false.
This commit is contained in:
LillyJadeKatrin 2024-02-20 12:59:01 -05:00
parent ccf2435047
commit d66b96b1c0

View file

@ -24,8 +24,6 @@
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoEvents.h"
static constexpr bool hardcore_mode_enabled = false;
static std::unique_ptr<OSD::Icon> DecodeBadgeToOSDIcon(const AchievementManager::Badge& badge);
AchievementManager& AchievementManager::GetInstance()
@ -373,12 +371,13 @@ void AchievementManager::ActivateDeactivateLeaderboards()
{
if (!Config::Get(Config::RA_ENABLED) || !IsLoggedIn())
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++)
{
auto leaderboard = m_game_data.leaderboards[ix];
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);
m_queue.EmplaceItem([this, leaderboard_id] {
@ -798,6 +797,7 @@ AchievementManager::PointSpread AchievementManager::TallyScore() const
PointSpread spread{};
if (!IsGameLoaded())
return spread;
bool hardcore_mode_enabled = Config::Get(Config::RA_HARDCORE_ENABLED);
for (const auto& entry : m_unlock_map)
{
if (entry.second.category != RC_ACHIEVEMENT_CATEGORY_CORE)
@ -1303,6 +1303,7 @@ void AchievementManager::ActivateDeactivateAchievement(AchievementId id, bool en
const UnlockStatus& status = it->second;
u32 index = status.game_data_index;
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
bool activate = m_is_game_loaded;
@ -1357,6 +1358,7 @@ AchievementManager::ResponseType AchievementManager::AwardAchievement(Achievemen
{
std::string username = Config::Get(Config::RA_USERNAME);
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(),
.api_token = api_token.c_str(),
.achievement_id = achievement_id,
@ -1426,7 +1428,7 @@ void AchievementManager::DisplayWelcomeMessage()
{
std::lock_guard lg{m_lock};
PointSpread spread = TallyScore();
if (hardcore_mode_enabled)
if (Config::Get(Config::RA_HARDCORE_ENABLED))
{
OSD::AddMessage(
fmt::format("You have {}/{} achievements worth {}/{} points", spread.hard_unlocks,
@ -1451,6 +1453,7 @@ void AchievementManager::DisplayWelcomeMessage()
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;
auto it = m_unlock_map.find(event_id);
if (it == m_unlock_map.end())