Remove Badges Enabled option from Achievements

Was informed by the RetroAchievements team that this isn't an option in most emulators, and as the next commits will be to enable default icons, there will always be something to display.
This commit is contained in:
LillyJadeKatrin 2024-05-08 07:28:28 -04:00
parent e0e09d1074
commit 75465f00cc
7 changed files with 17 additions and 49 deletions

View File

@ -637,7 +637,7 @@ void AchievementManager::DisplayWelcomeMessage()
m_display_welcome_message = false; m_display_welcome_message = false;
const u32 color = const u32 color =
rc_client_get_hardcore_enabled(m_client) ? OSD::Color::YELLOW : OSD::Color::CYAN; rc_client_get_hardcore_enabled(m_client) ? OSD::Color::YELLOW : OSD::Color::CYAN;
if (Config::Get(Config::RA_BADGES_ENABLED) && !m_game_badge.name.empty()) if (!m_game_badge.name.empty())
{ {
OSD::AddMessage("", OSD::Duration::VERY_LONG, OSD::Color::GREEN, OSD::AddMessage("", OSD::Duration::VERY_LONG, OSD::Color::GREEN,
DecodeBadgeToOSDIcon(m_game_badge.badge)); DecodeBadgeToOSDIcon(m_game_badge.badge));
@ -677,11 +677,9 @@ void AchievementManager::HandleAchievementTriggeredEvent(const rc_client_event_t
(rc_client_get_hardcore_enabled(AchievementManager::GetInstance().m_client)) ? (rc_client_get_hardcore_enabled(AchievementManager::GetInstance().m_client)) ?
OSD::Color::YELLOW : OSD::Color::YELLOW :
OSD::Color::CYAN, OSD::Color::CYAN,
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(AchievementManager::GetInstance()
DecodeBadgeToOSDIcon(AchievementManager::GetInstance() .m_unlocked_badges[client_event->achievement->id]
.m_unlocked_badges[client_event->achievement->id] .badge));
.badge) :
nullptr);
} }
void AchievementManager::HandleLeaderboardStartedEvent(const rc_client_event_t* client_event) void AchievementManager::HandleLeaderboardStartedEvent(const rc_client_event_t* client_event)
@ -738,15 +736,12 @@ void AchievementManager::HandleLeaderboardTrackerHideEvent(const rc_client_event
void AchievementManager::HandleAchievementChallengeIndicatorShowEvent( void AchievementManager::HandleAchievementChallengeIndicatorShowEvent(
const rc_client_event_t* client_event) const rc_client_event_t* client_event)
{ {
if (Config::Get(Config::RA_BADGES_ENABLED)) auto& unlocked_badges = AchievementManager::GetInstance().m_unlocked_badges;
if (const auto unlocked_iter = unlocked_badges.find(client_event->achievement->id);
unlocked_iter != unlocked_badges.end())
{ {
auto& unlocked_badges = AchievementManager::GetInstance().m_unlocked_badges; AchievementManager::GetInstance().m_active_challenges[client_event->achievement->badge_name] =
if (const auto unlocked_iter = unlocked_badges.find(client_event->achievement->id); DecodeBadgeToOSDIcon(unlocked_iter->second.badge);
unlocked_iter != unlocked_badges.end())
{
AchievementManager::GetInstance().m_active_challenges[client_event->achievement->badge_name] =
DecodeBadgeToOSDIcon(unlocked_iter->second.badge);
}
} }
} }
@ -763,11 +758,9 @@ void AchievementManager::HandleAchievementProgressIndicatorShowEvent(
OSD::AddMessage(fmt::format("{} {}", client_event->achievement->title, OSD::AddMessage(fmt::format("{} {}", client_event->achievement->title,
client_event->achievement->measured_progress), client_event->achievement->measured_progress),
OSD::Duration::SHORT, OSD::Color::GREEN, OSD::Duration::SHORT, OSD::Color::GREEN,
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(AchievementManager::GetInstance()
DecodeBadgeToOSDIcon(AchievementManager::GetInstance() .m_unlocked_badges[client_event->achievement->id]
.m_unlocked_badges[client_event->achievement->id] .badge));
.badge) :
nullptr);
} }
void AchievementManager::HandleGameCompletedEvent(const rc_client_event_t* client_event, void AchievementManager::HandleGameCompletedEvent(const rc_client_event_t* client_event,
@ -784,9 +777,7 @@ void AchievementManager::HandleGameCompletedEvent(const rc_client_event_t* clien
OSD::AddMessage(fmt::format("Congratulations! {} has {} {}", user_info->display_name, OSD::AddMessage(fmt::format("Congratulations! {} has {} {}", user_info->display_name,
hardcore ? "mastered" : "completed", game_info->title), hardcore ? "mastered" : "completed", game_info->title),
OSD::Duration::VERY_LONG, hardcore ? OSD::Color::YELLOW : OSD::Color::CYAN, OSD::Duration::VERY_LONG, hardcore ? OSD::Color::YELLOW : OSD::Color::CYAN,
(Config::Get(Config::RA_BADGES_ENABLED)) ? DecodeBadgeToOSDIcon(AchievementManager::GetInstance().m_game_badge.badge));
DecodeBadgeToOSDIcon(AchievementManager::GetInstance().m_game_badge.badge) :
nullptr);
} }
void AchievementManager::HandleResetEvent(const rc_client_event_t* client_event) void AchievementManager::HandleResetEvent(const rc_client_event_t* client_event)
@ -880,7 +871,7 @@ void AchievementManager::FetchBadge(AchievementManager::BadgeStatus* badge, u32
const AchievementManager::BadgeNameFunction function, const AchievementManager::BadgeNameFunction function,
const UpdatedItems callback_data) const UpdatedItems callback_data)
{ {
if (!m_client || !HasAPIToken() || !Config::Get(Config::RA_BADGES_ENABLED)) if (!m_client || !HasAPIToken())
{ {
m_update_callback(callback_data); m_update_callback(callback_data);
if (m_display_welcome_message && badge_type == RC_IMAGE_TYPE_GAME) if (m_display_welcome_message && badge_type == RC_IMAGE_TYPE_GAME)

View File

@ -26,7 +26,6 @@ const Info<bool> RA_DISCORD_PRESENCE_ENABLED{
{System::Achievements, "Achievements", "DiscordPresenceEnabled"}, false}; {System::Achievements, "Achievements", "DiscordPresenceEnabled"}, false};
const Info<bool> RA_PROGRESS_ENABLED{{System::Achievements, "Achievements", "ProgressEnabled"}, const Info<bool> RA_PROGRESS_ENABLED{{System::Achievements, "Achievements", "ProgressEnabled"},
false}; false};
const Info<bool> RA_BADGES_ENABLED{{System::Achievements, "Achievements", "BadgesEnabled"}, false};
} // namespace Config } // namespace Config
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS

View File

@ -20,7 +20,6 @@ extern const Info<bool> RA_ENCORE_ENABLED;
extern const Info<bool> RA_SPECTATOR_ENABLED; extern const Info<bool> RA_SPECTATOR_ENABLED;
extern const Info<bool> RA_DISCORD_PRESENCE_ENABLED; extern const Info<bool> RA_DISCORD_PRESENCE_ENABLED;
extern const Info<bool> RA_PROGRESS_ENABLED; extern const Info<bool> RA_PROGRESS_ENABLED;
extern const Info<bool> RA_BADGES_ENABLED;
} // namespace Config } // namespace Config
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS

View File

@ -61,7 +61,7 @@ void AchievementBox::UpdateData()
color = AchievementManager::GOLD; color = AchievementManager::GOLD;
else if (m_achievement->unlocked & RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE) else if (m_achievement->unlocked & RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE)
color = AchievementManager::BLUE; color = AchievementManager::BLUE;
if (Config::Get(Config::RA_BADGES_ENABLED) && badge.name != "") if (badge.name != "")
{ {
QImage i_badge{}; QImage i_badge{};
if (i_badge.loadFromData(&badge.badge.front(), static_cast<int>(badge.badge.size()))) if (i_badge.loadFromData(&badge.badge.front(), static_cast<int>(badge.badge.size())))

View File

@ -74,7 +74,7 @@ void AchievementHeaderWidget::UpdateData()
m_user_icon->setVisible(false); m_user_icon->setVisible(false);
m_user_icon->clear(); m_user_icon->clear();
m_user_icon->setText({}); m_user_icon->setText({});
if (Config::Get(Config::RA_BADGES_ENABLED) && !player_badge.name.empty()) if (!player_badge.name.empty())
{ {
QImage i_user_icon{}; QImage i_user_icon{};
if (i_user_icon.loadFromData(&player_badge.badge.front(), (int)player_badge.badge.size())) if (i_user_icon.loadFromData(&player_badge.badge.front(), (int)player_badge.badge.size()))
@ -95,7 +95,7 @@ void AchievementHeaderWidget::UpdateData()
rc_client_user_game_summary_t game_summary; rc_client_user_game_summary_t game_summary;
rc_client_get_user_game_summary(instance.GetClient(), &game_summary); rc_client_get_user_game_summary(instance.GetClient(), &game_summary);
if (Config::Get(Config::RA_BADGES_ENABLED) && !game_badge.name.empty()) if (!game_badge.name.empty())
{ {
QImage i_game_icon{}; QImage i_game_icon{};
if (i_game_icon.loadFromData(&game_badge.badge.front(), (int)game_badge.badge.size())) if (i_game_icon.loadFromData(&game_badge.badge.front(), (int)game_badge.badge.size()))

View File

@ -105,11 +105,6 @@ void AchievementSettingsWidget::CreateLayout()
tr("Enable progress notifications on achievements.<br><br>Displays a brief popup message " tr("Enable progress notifications on achievements.<br><br>Displays a brief popup message "
"whenever the player makes progress on an achievement that tracks an accumulated value, " "whenever the player makes progress on an achievement that tracks an accumulated value, "
"such as 60 out of 120 stars.")); "such as 60 out of 120 stars."));
m_common_badges_enabled_input = new ToolTipCheckBox(tr("Enable Achievement Badges"));
m_common_badges_enabled_input->SetDescription(
tr("Enable achievement badges.<br><br>Displays icons for the player, game, and achievements. "
"Simple visual option, but will require a small amount of extra memory and time to "
"download the images."));
m_common_layout->addWidget(m_common_integration_enabled_input); m_common_layout->addWidget(m_common_integration_enabled_input);
m_common_layout->addWidget(m_common_username_label); m_common_layout->addWidget(m_common_username_label);
@ -129,7 +124,6 @@ void AchievementSettingsWidget::CreateLayout()
m_common_layout->addWidget(m_common_discord_presence_enabled_input); m_common_layout->addWidget(m_common_discord_presence_enabled_input);
#endif // USE_DISCORD_PRESENCE #endif // USE_DISCORD_PRESENCE
m_common_layout->addWidget(m_common_progress_enabled_input); m_common_layout->addWidget(m_common_progress_enabled_input);
m_common_layout->addWidget(m_common_badges_enabled_input);
m_common_layout->setAlignment(Qt::AlignTop); m_common_layout->setAlignment(Qt::AlignTop);
setLayout(m_common_layout); setLayout(m_common_layout);
@ -153,8 +147,6 @@ void AchievementSettingsWidget::ConnectWidgets()
&AchievementSettingsWidget::ToggleDiscordPresence); &AchievementSettingsWidget::ToggleDiscordPresence);
connect(m_common_progress_enabled_input, &QCheckBox::toggled, this, connect(m_common_progress_enabled_input, &QCheckBox::toggled, this,
&AchievementSettingsWidget::ToggleProgress); &AchievementSettingsWidget::ToggleProgress);
connect(m_common_badges_enabled_input, &QCheckBox::toggled, this,
&AchievementSettingsWidget::ToggleBadges);
} }
void AchievementSettingsWidget::OnControllerInterfaceConfigure() void AchievementSettingsWidget::OnControllerInterfaceConfigure()
@ -214,9 +206,6 @@ void AchievementSettingsWidget::LoadSettings()
SignalBlocking(m_common_progress_enabled_input) SignalBlocking(m_common_progress_enabled_input)
->setChecked(Config::Get(Config::RA_PROGRESS_ENABLED)); ->setChecked(Config::Get(Config::RA_PROGRESS_ENABLED));
SignalBlocking(m_common_progress_enabled_input)->setEnabled(enabled); SignalBlocking(m_common_progress_enabled_input)->setEnabled(enabled);
SignalBlocking(m_common_badges_enabled_input)->setChecked(Config::Get(Config::RA_BADGES_ENABLED));
SignalBlocking(m_common_badges_enabled_input)->setEnabled(enabled);
} }
void AchievementSettingsWidget::SaveSettings() void AchievementSettingsWidget::SaveSettings()
@ -235,7 +224,6 @@ void AchievementSettingsWidget::SaveSettings()
m_common_discord_presence_enabled_input->isChecked()); m_common_discord_presence_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_PROGRESS_ENABLED, Config::SetBaseOrCurrent(Config::RA_PROGRESS_ENABLED,
m_common_progress_enabled_input->isChecked()); m_common_progress_enabled_input->isChecked());
Config::SetBaseOrCurrent(Config::RA_BADGES_ENABLED, m_common_badges_enabled_input->isChecked());
Config::Save(); Config::Save();
} }
@ -308,11 +296,4 @@ void AchievementSettingsWidget::ToggleProgress()
SaveSettings(); SaveSettings();
} }
void AchievementSettingsWidget::ToggleBadges()
{
SaveSettings();
AchievementManager::GetInstance().FetchPlayerBadge();
AchievementManager::GetInstance().FetchGameBadges();
}
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS

View File

@ -38,7 +38,6 @@ private:
void ToggleSpectator(); void ToggleSpectator();
void ToggleDiscordPresence(); void ToggleDiscordPresence();
void ToggleProgress(); void ToggleProgress();
void ToggleBadges();
QGroupBox* m_common_box; QGroupBox* m_common_box;
QVBoxLayout* m_common_layout; QVBoxLayout* m_common_layout;
@ -56,7 +55,6 @@ private:
ToolTipCheckBox* m_common_spectator_enabled_input; ToolTipCheckBox* m_common_spectator_enabled_input;
ToolTipCheckBox* m_common_discord_presence_enabled_input; ToolTipCheckBox* m_common_discord_presence_enabled_input;
ToolTipCheckBox* m_common_progress_enabled_input; ToolTipCheckBox* m_common_progress_enabled_input;
ToolTipCheckBox* m_common_badges_enabled_input;
}; };
#endif // USE_RETRO_ACHIEVEMENTS #endif // USE_RETRO_ACHIEVEMENTS