From 75465f00ccf8694bbae37fccb106a7aaf233e3ac Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Wed, 8 May 2024 07:28:28 -0400 Subject: [PATCH] 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. --- Source/Core/Core/AchievementManager.cpp | 37 +++++++------------ .../Core/Core/Config/AchievementSettings.cpp | 1 - Source/Core/Core/Config/AchievementSettings.h | 1 - .../DolphinQt/Achievements/AchievementBox.cpp | 2 +- .../Achievements/AchievementHeaderWidget.cpp | 4 +- .../AchievementSettingsWidget.cpp | 19 ---------- .../Achievements/AchievementSettingsWidget.h | 2 - 7 files changed, 17 insertions(+), 49 deletions(-) diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index b1b63726b3..f9ae5fadb5 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -637,7 +637,7 @@ void AchievementManager::DisplayWelcomeMessage() m_display_welcome_message = false; const u32 color = 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, 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)) ? OSD::Color::YELLOW : OSD::Color::CYAN, - (Config::Get(Config::RA_BADGES_ENABLED)) ? - DecodeBadgeToOSDIcon(AchievementManager::GetInstance() - .m_unlocked_badges[client_event->achievement->id] - .badge) : - nullptr); + DecodeBadgeToOSDIcon(AchievementManager::GetInstance() + .m_unlocked_badges[client_event->achievement->id] + .badge)); } void AchievementManager::HandleLeaderboardStartedEvent(const rc_client_event_t* client_event) @@ -738,15 +736,12 @@ void AchievementManager::HandleLeaderboardTrackerHideEvent(const rc_client_event void AchievementManager::HandleAchievementChallengeIndicatorShowEvent( 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; - if (const auto unlocked_iter = unlocked_badges.find(client_event->achievement->id); - unlocked_iter != unlocked_badges.end()) - { - AchievementManager::GetInstance().m_active_challenges[client_event->achievement->badge_name] = - DecodeBadgeToOSDIcon(unlocked_iter->second.badge); - } + 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, client_event->achievement->measured_progress), OSD::Duration::SHORT, OSD::Color::GREEN, - (Config::Get(Config::RA_BADGES_ENABLED)) ? - DecodeBadgeToOSDIcon(AchievementManager::GetInstance() - .m_unlocked_badges[client_event->achievement->id] - .badge) : - nullptr); + DecodeBadgeToOSDIcon(AchievementManager::GetInstance() + .m_unlocked_badges[client_event->achievement->id] + .badge)); } 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, hardcore ? "mastered" : "completed", game_info->title), OSD::Duration::VERY_LONG, hardcore ? OSD::Color::YELLOW : OSD::Color::CYAN, - (Config::Get(Config::RA_BADGES_ENABLED)) ? - DecodeBadgeToOSDIcon(AchievementManager::GetInstance().m_game_badge.badge) : - nullptr); + DecodeBadgeToOSDIcon(AchievementManager::GetInstance().m_game_badge.badge)); } 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 UpdatedItems callback_data) { - if (!m_client || !HasAPIToken() || !Config::Get(Config::RA_BADGES_ENABLED)) + if (!m_client || !HasAPIToken()) { m_update_callback(callback_data); if (m_display_welcome_message && badge_type == RC_IMAGE_TYPE_GAME) diff --git a/Source/Core/Core/Config/AchievementSettings.cpp b/Source/Core/Core/Config/AchievementSettings.cpp index 1e20729bdd..63945777cb 100644 --- a/Source/Core/Core/Config/AchievementSettings.cpp +++ b/Source/Core/Core/Config/AchievementSettings.cpp @@ -26,7 +26,6 @@ const Info RA_DISCORD_PRESENCE_ENABLED{ {System::Achievements, "Achievements", "DiscordPresenceEnabled"}, false}; const Info RA_PROGRESS_ENABLED{{System::Achievements, "Achievements", "ProgressEnabled"}, false}; -const Info RA_BADGES_ENABLED{{System::Achievements, "Achievements", "BadgesEnabled"}, false}; } // namespace Config #endif // USE_RETRO_ACHIEVEMENTS diff --git a/Source/Core/Core/Config/AchievementSettings.h b/Source/Core/Core/Config/AchievementSettings.h index ae2ecbc8b6..f1552ec59c 100644 --- a/Source/Core/Core/Config/AchievementSettings.h +++ b/Source/Core/Core/Config/AchievementSettings.h @@ -20,7 +20,6 @@ extern const Info RA_ENCORE_ENABLED; extern const Info RA_SPECTATOR_ENABLED; extern const Info RA_DISCORD_PRESENCE_ENABLED; extern const Info RA_PROGRESS_ENABLED; -extern const Info RA_BADGES_ENABLED; } // namespace Config #endif // USE_RETRO_ACHIEVEMENTS diff --git a/Source/Core/DolphinQt/Achievements/AchievementBox.cpp b/Source/Core/DolphinQt/Achievements/AchievementBox.cpp index 534b965d78..f563f9cfc9 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementBox.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementBox.cpp @@ -61,7 +61,7 @@ void AchievementBox::UpdateData() color = AchievementManager::GOLD; else if (m_achievement->unlocked & RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE) color = AchievementManager::BLUE; - if (Config::Get(Config::RA_BADGES_ENABLED) && badge.name != "") + if (badge.name != "") { QImage i_badge{}; if (i_badge.loadFromData(&badge.badge.front(), static_cast(badge.badge.size()))) diff --git a/Source/Core/DolphinQt/Achievements/AchievementHeaderWidget.cpp b/Source/Core/DolphinQt/Achievements/AchievementHeaderWidget.cpp index c148714171..e2fc6addbc 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementHeaderWidget.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementHeaderWidget.cpp @@ -74,7 +74,7 @@ void AchievementHeaderWidget::UpdateData() m_user_icon->setVisible(false); m_user_icon->clear(); m_user_icon->setText({}); - if (Config::Get(Config::RA_BADGES_ENABLED) && !player_badge.name.empty()) + if (!player_badge.name.empty()) { QImage i_user_icon{}; 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_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{}; if (i_game_icon.loadFromData(&game_badge.badge.front(), (int)game_badge.badge.size())) diff --git a/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp b/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp index 62f6a1e0cb..5b8a07d24f 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp @@ -105,11 +105,6 @@ void AchievementSettingsWidget::CreateLayout() tr("Enable progress notifications on achievements.

Displays a brief popup message " "whenever the player makes progress on an achievement that tracks an accumulated value, " "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.

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_username_label); @@ -129,7 +124,6 @@ void AchievementSettingsWidget::CreateLayout() m_common_layout->addWidget(m_common_discord_presence_enabled_input); #endif // USE_DISCORD_PRESENCE m_common_layout->addWidget(m_common_progress_enabled_input); - m_common_layout->addWidget(m_common_badges_enabled_input); m_common_layout->setAlignment(Qt::AlignTop); setLayout(m_common_layout); @@ -153,8 +147,6 @@ void AchievementSettingsWidget::ConnectWidgets() &AchievementSettingsWidget::ToggleDiscordPresence); connect(m_common_progress_enabled_input, &QCheckBox::toggled, this, &AchievementSettingsWidget::ToggleProgress); - connect(m_common_badges_enabled_input, &QCheckBox::toggled, this, - &AchievementSettingsWidget::ToggleBadges); } void AchievementSettingsWidget::OnControllerInterfaceConfigure() @@ -214,9 +206,6 @@ void AchievementSettingsWidget::LoadSettings() SignalBlocking(m_common_progress_enabled_input) ->setChecked(Config::Get(Config::RA_PROGRESS_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() @@ -235,7 +224,6 @@ void AchievementSettingsWidget::SaveSettings() m_common_discord_presence_enabled_input->isChecked()); Config::SetBaseOrCurrent(Config::RA_PROGRESS_ENABLED, m_common_progress_enabled_input->isChecked()); - Config::SetBaseOrCurrent(Config::RA_BADGES_ENABLED, m_common_badges_enabled_input->isChecked()); Config::Save(); } @@ -308,11 +296,4 @@ void AchievementSettingsWidget::ToggleProgress() SaveSettings(); } -void AchievementSettingsWidget::ToggleBadges() -{ - SaveSettings(); - AchievementManager::GetInstance().FetchPlayerBadge(); - AchievementManager::GetInstance().FetchGameBadges(); -} - #endif // USE_RETRO_ACHIEVEMENTS diff --git a/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.h b/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.h index b8e848c2d1..8d4aa03c2a 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.h +++ b/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.h @@ -38,7 +38,6 @@ private: void ToggleSpectator(); void ToggleDiscordPresence(); void ToggleProgress(); - void ToggleBadges(); QGroupBox* m_common_box; QVBoxLayout* m_common_layout; @@ -56,7 +55,6 @@ private: ToolTipCheckBox* m_common_spectator_enabled_input; ToolTipCheckBox* m_common_discord_presence_enabled_input; ToolTipCheckBox* m_common_progress_enabled_input; - ToolTipCheckBox* m_common_badges_enabled_input; }; #endif // USE_RETRO_ACHIEVEMENTS