Add toggles for Speedrun timer + Achievement badges visibility

Added some new visibility toggles so players can choose what to show (or hide) during their RetroAchievements runs:

Toggle for the Speedrun Leaderboards timer

Toggle for Achievement Challenge badges
This commit is contained in:
fizzlepicklepop 2025-10-07 22:45:04 -04:00
parent 03ef9b4995
commit 7ed61c50a1
6 changed files with 68 additions and 5 deletions

View File

@ -679,6 +679,9 @@ AchievementManager::GetActiveChallenges() const
std::vector<std::string> AchievementManager::GetActiveLeaderboards() const
{
if (!Config::Get(Config::RA_LEADERBOARD_TRACKER_ENABLED))
return {};
std::vector<std::string> display_values;
for (u32 ix = 0; ix < MAX_DISPLAYED_LBOARDS && ix < m_active_leaderboards.size(); ix++)
{

View File

@ -22,6 +22,10 @@ const Info<bool> RA_UNOFFICIAL_ENABLED{{System::Achievements, "Achievements", "U
const Info<bool> RA_ENCORE_ENABLED{{System::Achievements, "Achievements", "EncoreEnabled"}, false};
const Info<bool> RA_SPECTATOR_ENABLED{{System::Achievements, "Achievements", "SpectatorEnabled"},
false};
const Info<bool> RA_LEADERBOARD_TRACKER_ENABLED{
{System::Achievements, "Achievements", "LeaderboardTrackerEnabled"}, true};
const Info<bool> RA_CHALLENGE_INDICATORS_ENABLED{
{System::Achievements, "Achievements", "ChallengeIndicatorsEnabled"}, true};
const Info<bool> RA_DISCORD_PRESENCE_ENABLED{
{System::Achievements, "Achievements", "DiscordPresenceEnabled"}, false};
const Info<bool> RA_PROGRESS_ENABLED{{System::Achievements, "Achievements", "ProgressEnabled"},

View File

@ -18,6 +18,8 @@ extern const Info<bool> RA_HARDCORE_ENABLED;
extern const Info<bool> RA_UNOFFICIAL_ENABLED;
extern const Info<bool> RA_ENCORE_ENABLED;
extern const Info<bool> RA_SPECTATOR_ENABLED;
extern const Info<bool> RA_LEADERBOARD_TRACKER_ENABLED;
extern const Info<bool> RA_CHALLENGE_INDICATORS_ENABLED;
extern const Info<bool> RA_DISCORD_PRESENCE_ENABLED;
extern const Info<bool> RA_PROGRESS_ENABLED;
} // namespace Config

View File

@ -109,6 +109,16 @@ void AchievementSettingsWidget::CreateLayout()
"submitted to the server.<br><br>If this is on at game launch, it will not be turned off "
"until game close, because a RetroAchievements session will not be created.<br><br>If "
"this is off at game launch, it can be toggled freely while the game is running."));
m_common_leaderboard_tracker_enabled_input = new ToolTipCheckBox(tr("Show Leaderboard Tracker"));
m_common_leaderboard_tracker_enabled_input->SetDescription(
tr("Show the on-screen RetroAchievements leaderboard tracker.<br><br>This appears in the "
"bottom-right corner while competing in a leaderboard."));
m_common_challenge_indicators_enabled_input =
new ToolTipCheckBox(tr("Show Challenge Indicators"));
m_common_challenge_indicators_enabled_input->SetDescription(
tr("Show the on-screen RetroAchievements challenge indicators.<br><br>These appear as "
"achievement badges in the bottom-right corner while tracking progress within a "
"challenge."));
m_common_discord_presence_enabled_input = new ToolTipCheckBox(tr("Enable Discord Presence"));
m_common_discord_presence_enabled_input->SetDescription(
tr("Use RetroAchievements rich presence in your Discord status.<br><br>Show Current Game on "
@ -138,6 +148,8 @@ void AchievementSettingsWidget::CreateLayout()
#ifdef USE_DISCORD_PRESENCE
m_common_layout->addWidget(m_common_discord_presence_enabled_input);
#endif // USE_DISCORD_PRESENCE
m_common_layout->addWidget(m_common_leaderboard_tracker_enabled_input);
m_common_layout->addWidget(m_common_challenge_indicators_enabled_input);
m_common_layout->addWidget(m_common_progress_enabled_input);
m_common_layout->setAlignment(Qt::AlignTop);
@ -158,6 +170,10 @@ void AchievementSettingsWidget::ConnectWidgets()
&AchievementSettingsWidget::ToggleEncore);
connect(m_common_spectator_enabled_input, &QCheckBox::toggled, this,
&AchievementSettingsWidget::ToggleSpectator);
connect(m_common_leaderboard_tracker_enabled_input, &QCheckBox::toggled, this,
&AchievementSettingsWidget::ToggleLeaderboardTracker);
connect(m_common_challenge_indicators_enabled_input, &QCheckBox::toggled, this,
&AchievementSettingsWidget::ToggleChallengeIndicators);
connect(m_common_discord_presence_enabled_input, &QCheckBox::toggled, this,
&AchievementSettingsWidget::ToggleDiscordPresence);
connect(m_common_progress_enabled_input, &QCheckBox::toggled, this,
@ -217,6 +233,14 @@ void AchievementSettingsWidget::LoadSettings()
->setChecked(Config::Get(Config::RA_SPECTATOR_ENABLED));
SignalBlocking(m_common_spectator_enabled_input)->setEnabled(enabled);
SignalBlocking(m_common_leaderboard_tracker_enabled_input)
->setChecked(Config::Get(Config::RA_LEADERBOARD_TRACKER_ENABLED));
SignalBlocking(m_common_leaderboard_tracker_enabled_input)->setEnabled(enabled);
SignalBlocking(m_common_challenge_indicators_enabled_input)
->setChecked(Config::Get(Config::RA_CHALLENGE_INDICATORS_ENABLED));
SignalBlocking(m_common_challenge_indicators_enabled_input)->setEnabled(enabled);
SignalBlocking(m_common_discord_presence_enabled_input)
->setChecked(Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED));
SignalBlocking(m_common_discord_presence_enabled_input)
@ -239,6 +263,10 @@ void AchievementSettingsWidget::SaveSettings()
Config::SetBaseOrCurrent(Config::RA_ENCORE_ENABLED, m_common_encore_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_SPECTATOR_ENABLED,
m_common_spectator_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_LEADERBOARD_TRACKER_ENABLED,
m_common_leaderboard_tracker_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_CHALLENGE_INDICATORS_ENABLED,
m_common_challenge_indicators_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_DISCORD_PRESENCE_ENABLED,
m_common_discord_presence_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_PROGRESS_ENABLED,
@ -310,6 +338,16 @@ void AchievementSettingsWidget::ToggleSpectator()
AchievementManager::GetInstance().SetSpectatorMode();
}
void AchievementSettingsWidget::ToggleLeaderboardTracker()
{
SaveSettings();
}
void AchievementSettingsWidget::ToggleChallengeIndicators()
{
SaveSettings();
}
void AchievementSettingsWidget::ToggleDiscordPresence()
{
SaveSettings();

View File

@ -36,6 +36,8 @@ private:
void ToggleUnofficial();
void ToggleEncore();
void ToggleSpectator();
void ToggleLeaderboardTracker();
void ToggleChallengeIndicators();
void ToggleDiscordPresence();
void ToggleProgress();
@ -53,6 +55,8 @@ private:
ToolTipCheckBox* m_common_unofficial_enabled_input;
ToolTipCheckBox* m_common_encore_enabled_input;
ToolTipCheckBox* m_common_spectator_enabled_input;
ToolTipCheckBox* m_common_leaderboard_tracker_enabled_input;
ToolTipCheckBox* m_common_challenge_indicators_enabled_input;
ToolTipCheckBox* m_common_discord_presence_enabled_input;
ToolTipCheckBox* m_common_progress_enabled_input;
};

View File

@ -9,6 +9,7 @@
#include "Core/AchievementManager.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/NetplaySettings.h"
#include "Core/Movie.h"
@ -324,10 +325,21 @@ void OnScreenUI::DrawChallengesAndLeaderboards()
#ifdef USE_RETRO_ACHIEVEMENTS
auto& instance = AchievementManager::GetInstance();
std::lock_guard lg{instance.GetLock()};
if (instance.AreChallengesUpdated())
const bool challenge_indicators_enabled = Config::Get(Config::RA_CHALLENGE_INDICATORS_ENABLED);
const bool challenges_updated = instance.AreChallengesUpdated();
const auto& challenges = instance.GetActiveChallenges();
if (!challenge_indicators_enabled)
{
instance.ResetChallengesUpdated();
const auto& challenges = instance.GetActiveChallenges();
if (challenges_updated)
instance.ResetChallengesUpdated();
if (!m_challenge_texture_map.empty())
m_challenge_texture_map.clear();
}
else if (challenges_updated || m_challenge_texture_map.size() != challenges.size())
{
if (challenges_updated)
instance.ResetChallengesUpdated();
m_challenge_texture_map.clear();
for (const auto& name : challenges)
{
@ -343,7 +355,7 @@ void OnScreenUI::DrawChallengesAndLeaderboards()
}
float leaderboard_y = ImGui::GetIO().DisplaySize.y;
if (!m_challenge_texture_map.empty())
if (challenge_indicators_enabled && !m_challenge_texture_map.empty())
{
float scale = ImGui::GetIO().DisplaySize.y / 1024.0;
ImGui::SetNextWindowSize(ImVec2(0, 0));
@ -367,7 +379,7 @@ void OnScreenUI::DrawChallengesAndLeaderboards()
}
const auto& leaderboard_progress = instance.GetActiveLeaderboards();
if (!leaderboard_progress.empty())
if (Config::Get(Config::RA_LEADERBOARD_TRACKER_ENABLED) && !leaderboard_progress.empty())
{
ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x, leaderboard_y), 0,
ImVec2(1.0, 1.0));