From 22aa88109f5a5964e1b66d31221647cafab7f0f5 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 4 Jun 2024 16:20:20 +0200 Subject: [PATCH] Use a stub AchivementManager when USE_RETRO_ACHIEVEMENTS isn't defined This lets us reduce the number of USE_RETRO_ACHIEVEMENTS ifdefs in the code base, reducing visual clutter. In particular, needing an ifdef for each call to IsHardcodeModeActive was annoying to me. This also reduces the risk that someone writes code that accidentally fails to compile with USE_RETRO_ACHIEVEMENTS disabled. We could cut down on ifdefs even further by making HardcodeWarningWidget always exist, but that would result in non-trivial code ending up in the binary even with USE_RETRO_ACHIEVEMENTS disabled, so I'm leaving it out of this PR. It's not a lot of code though, so I might end up revisiting it at some point. --- Source/Core/Core/AchievementManager.h | 33 +++++++++++++++++++ Source/Core/Core/Boot/Boot.cpp | 2 -- Source/Core/Core/BootManager.cpp | 2 -- Source/Core/Core/CheatSearch.cpp | 6 ---- Source/Core/Core/CheatSearch.h | 2 -- Source/Core/Core/Config/MainSettings.cpp | 8 ----- Source/Core/Core/ConfigManager.cpp | 7 ++-- Source/Core/Core/Core.cpp | 6 ---- Source/Core/Core/CoreTiming.cpp | 2 -- .../Core/Core/Debugger/PPCDebugInterface.cpp | 3 +- Source/Core/Core/FreeLookConfig.cpp | 4 --- Source/Core/Core/HW/DVD/DVDInterface.cpp | 2 -- Source/Core/Core/IOS/ES/ES.cpp | 2 -- Source/Core/Core/Movie.cpp | 2 -- Source/Core/Core/PatchEngine.cpp | 6 ++-- Source/Core/Core/State.cpp | 4 --- Source/Core/DiscIO/RiivolutionPatcher.cpp | 2 -- Source/Core/DolphinQt/HotkeyScheduler.cpp | 5 +-- Source/Core/DolphinQt/MenuBar.cpp | 9 ----- Source/Core/DolphinQt/Settings.cpp | 2 -- .../Core/DolphinQt/Settings/GeneralPane.cpp | 6 +--- .../Core/DolphinQt/Settings/InterfacePane.cpp | 4 --- Source/Core/VideoCommon/OnScreenUI.cpp | 6 ++-- Source/Core/VideoCommon/OnScreenUI.h | 2 -- 24 files changed, 42 insertions(+), 85 deletions(-) diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index 3fdb5b2591..f538832ade 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -5,19 +5,25 @@ #ifdef USE_RETRO_ACHIEVEMENTS #include +#include #include #include #include +#include #include +#include #include +#include #include #include +#include #include #include #include #include +#include "Common/CommonTypes.h" #include "Common/Event.h" #include "Common/HttpRequest.h" #include "Common/WorkQueueThread.h" @@ -206,4 +212,31 @@ private: std::recursive_mutex m_filereader_lock; }; // class AchievementManager +#else // USE_RETRO_ACHIEVEMENTS + +#include + +namespace DiscIO +{ +class Volume; +} + +class AchievementManager +{ +public: + static AchievementManager& GetInstance() + { + static AchievementManager s_instance; + return s_instance; + } + + constexpr bool IsHardcoreModeActive() { return false; } + + constexpr void LoadGame(const std::string&, const DiscIO::Volume*) {} + + constexpr void DoFrame() {} + + constexpr void CloseGame() {} +}; + #endif // USE_RETRO_ACHIEVEMENTS diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index d57f4e74bb..7e866604ed 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -575,9 +575,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard, SetupGCMemory(system, guard); } -#ifdef USE_RETRO_ACHIEVEMENTS AchievementManager::GetInstance().LoadGame(executable.path, nullptr); -#endif // USE_RETRO_ACHIEVEMENTS if (!executable.reader->LoadIntoMemory(system)) { diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 6f7681fd30..81192b4821 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -166,9 +166,7 @@ bool BootCore(Core::System& system, std::unique_ptr boot, } } -#ifdef USE_RETRO_ACHIEVEMENTS AchievementManager::GetInstance().CloseGame(); -#endif // USE_RETRO_ACHIEVEMENTS const bool load_ipl = !system.IsWii() && !Config::Get(Config::MAIN_SKIP_IPL) && std::holds_alternative(boot->parameters); diff --git a/Source/Core/Core/CheatSearch.cpp b/Source/Core/Core/CheatSearch.cpp index 1af09e0ee3..a3bd123e0c 100644 --- a/Source/Core/Core/CheatSearch.cpp +++ b/Source/Core/Core/CheatSearch.cpp @@ -207,10 +207,8 @@ Cheats::NewSearch(const Core::CPUThreadGuard& guard, PowerPC::RequestedAddressSpace address_space, bool aligned, const std::function& validator) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return Cheats::SearchErrorCode::DisabledInHardcoreMode; -#endif // USE_RETRO_ACHIEVEMENTS auto& system = guard.GetSystem(); std::vector> results; const Core::State core_state = Core::GetState(system); @@ -262,10 +260,8 @@ Cheats::NextSearch(const Core::CPUThreadGuard& guard, PowerPC::RequestedAddressSpace address_space, const std::function& validator) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return Cheats::SearchErrorCode::DisabledInHardcoreMode; -#endif // USE_RETRO_ACHIEVEMENTS auto& system = guard.GetSystem(); std::vector> results; const Core::State core_state = Core::GetState(system); @@ -429,10 +425,8 @@ MakeCompareFunctionForLastValue(Cheats::CompareType op) template Cheats::SearchErrorCode Cheats::CheatSearchSession::RunSearch(const Core::CPUThreadGuard& guard) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return Cheats::SearchErrorCode::DisabledInHardcoreMode; -#endif // USE_RETRO_ACHIEVEMENTS Common::Result>> result = Cheats::SearchErrorCode::InvalidParameters; if (m_filter_type == FilterType::CompareAgainstSpecificValue) diff --git a/Source/Core/Core/CheatSearch.h b/Source/Core/Core/CheatSearch.h index 4a3d54a897..d5c990186f 100644 --- a/Source/Core/Core/CheatSearch.h +++ b/Source/Core/Core/CheatSearch.h @@ -100,10 +100,8 @@ enum class SearchErrorCode // currently off in the emulated game. VirtualAddressesCurrentlyNotAccessible, -#ifdef USE_RETRO_ACHIEVEMENTS // Cheats and memory reading are disabled in RetroAchievements hardcore mode. DisabledInHardcoreMode, -#endif // USE_RETRO_ACHIEVEMENTS }; // Returns the corresponding DataType enum for the value currently held by the given SearchValue. diff --git a/Source/Core/Core/Config/MainSettings.cpp b/Source/Core/Core/Config/MainSettings.cpp index 3e5864586c..a45c014262 100644 --- a/Source/Core/Core/Config/MainSettings.cpp +++ b/Source/Core/Core/Config/MainSettings.cpp @@ -749,22 +749,14 @@ bool IsDefaultGCIFolderPathConfigured(ExpansionInterface::Slot slot) bool AreCheatsEnabled() { -#ifdef USE_RETRO_ACHIEVEMENTS return Config::Get(::Config::MAIN_ENABLE_CHEATS) && !AchievementManager::GetInstance().IsHardcoreModeActive(); -#else // USE_RETRO_ACHIEVEMENTS - return Config::Get(::Config::MAIN_ENABLE_CHEATS); -#endif // USE_RETRO_ACHIEVEMENTS } bool IsDebuggingEnabled() { -#ifdef USE_RETRO_ACHIEVEMENTS return Config::Get(::Config::MAIN_ENABLE_DEBUGGING) && !AchievementManager::GetInstance().IsHardcoreModeActive(); -#else // USE_RETRO_ACHIEVEMENTS - return Config::Get(::Config::MAIN_ENABLE_DEBUGGING); -#endif // USE_RETRO_ACHIEVEMENTS } } // namespace Config diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index c27f135e0e..e3c1ec1d15 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -169,11 +169,6 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri if (!was_changed) return; -#ifdef USE_RETRO_ACHIEVEMENTS - if (game_id != "00000000") - AchievementManager::GetInstance().CloseGame(); -#endif // USE_RETRO_ACHIEVEMENTS - if (game_id == "00000000") { m_title_name.clear(); @@ -181,6 +176,8 @@ void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::stri return; } + AchievementManager::GetInstance().CloseGame(); + const Core::TitleDatabase title_database; auto& system = Core::System::GetInstance(); const DiscIO::Language language = GetLanguageAdjustedForRegion(system.IsWii(), region); diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 5c60b3b02f..f28a41f836 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -287,9 +287,7 @@ void Stop(Core::System& system) // - Hammertime! return; } -#ifdef USE_RETRO_ACHIEVEMENTS AchievementManager::GetInstance().CloseGame(); -#endif // USE_RETRO_ACHIEVEMENTS s_is_stopping = true; @@ -908,9 +906,7 @@ void Callback_NewField(Core::System& system) } } -#ifdef USE_RETRO_ACHIEVEMENTS AchievementManager::GetInstance().DoFrame(); -#endif // USE_RETRO_ACHIEVEMENTS } void UpdateTitle(Core::System& system) @@ -1048,13 +1044,11 @@ void HostDispatchJobs(Core::System& system) // NOTE: Host Thread void DoFrameStep(Core::System& system) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) { OSD::AddMessage("Frame stepping is disabled in RetroAchievements hardcore mode"); return; } -#endif // USE_RETRO_ACHIEVEMENTS if (GetState(system) == State::Paused) { // if already paused, frame advance for 1 frame diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 627f14cbce..b304ff2fa6 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -138,7 +138,6 @@ void CoreTimingManager::RefreshConfig() m_max_variance = std::chrono::duration_cast
(DT_ms(Config::Get(Config::MAIN_TIMING_VARIANCE))); -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive() && Config::Get(Config::MAIN_EMULATION_SPEED) < 1.0f && Config::Get(Config::MAIN_EMULATION_SPEED) > 0.0f) @@ -147,7 +146,6 @@ void CoreTimingManager::RefreshConfig() m_emulation_speed = 1.0f; OSD::AddMessage("Minimum speed is 100% in Hardcore Mode"); } -#endif // USE_RETRO_ACHIEVEMENTS m_emulation_speed = Config::Get(Config::MAIN_EMULATION_SPEED); } diff --git a/Source/Core/Core/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Debugger/PPCDebugInterface.cpp index 20ff94c537..a003e98156 100644 --- a/Source/Core/Core/Debugger/PPCDebugInterface.cpp +++ b/Source/Core/Core/Debugger/PPCDebugInterface.cpp @@ -30,10 +30,9 @@ void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, Common::Debug::MemoryPatch& patch, bool store_existing_value) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return; -#endif // USE_RETRO_ACHIEVEMENTS + if (patch.value.empty()) return; diff --git a/Source/Core/Core/FreeLookConfig.cpp b/Source/Core/Core/FreeLookConfig.cpp index c1a2f16473..a74b492f7d 100644 --- a/Source/Core/Core/FreeLookConfig.cpp +++ b/Source/Core/Core/FreeLookConfig.cpp @@ -46,11 +46,7 @@ void Config::Refresh() } camera_config.control_type = ::Config::Get(::Config::FL1_CONTROL_TYPE); -#ifdef USE_RETRO_ACHIEVEMENTS enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED) && !AchievementManager::GetInstance().IsHardcoreModeActive(); -#else // USE_RETRO_ACHIEVEMENTS - enabled = ::Config::Get(::Config::FREE_LOOK_ENABLED); -#endif // USE_RETRO_ACHIEVEMENTS } } // namespace FreeLook diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp index fefa5f2d2d..79081bee47 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp @@ -398,9 +398,7 @@ void DVDInterface::SetDisc(std::unique_ptr disc, m_auto_disc_change_index = 0; } -#ifdef USE_RETRO_ACHIEVEMENTS AchievementManager::GetInstance().LoadGame("", disc.get()); -#endif // USE_RETRO_ACHIEVEMENTS // Assume that inserting a disc requires having an empty disc before if (had_disc != has_disc) diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index 8eb35f3db9..6bd894dd27 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -478,11 +478,9 @@ bool ESDevice::LaunchPPCTitle(u64 title_id) if (!Core::IsRunningAndStarted()) return BootstrapPPC(); -#ifdef USE_RETRO_ACHIEVEMENTS INFO_LOG_FMT(ACHIEVEMENTS, "WAD and NAND formats not currently supported by Achievement Manager."); AchievementManager::GetInstance().CloseGame(); -#endif // USE_RETRO_ACHIEVEMENTS core_timing.RemoveEvent(s_bootstrap_ppc_for_launch_event); core_timing.ScheduleEvent(ticks, s_bootstrap_ppc_for_launch_event); diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 3d05b7b6af..47ad3c8c97 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -941,10 +941,8 @@ bool MovieManager::PlayInput(const std::string& movie_path, ReadHeader(); -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return false; -#endif // USE_RETRO_ACHIEVEMENTS m_total_frames = m_temp_header.frameCount; m_total_lag_count = m_temp_header.lagCount; diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index bbc9847b3e..8aac8f1397 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -233,10 +233,9 @@ void LoadPatches() static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector& patches) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return; -#endif // USE_RETRO_ACHIEVEMENTS + for (const Patch& patch : patches) { if (patch.enabled) @@ -278,10 +277,9 @@ static void ApplyPatches(const Core::CPUThreadGuard& guard, const std::vector memory_patch_indices) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return; -#endif // USE_RETRO_ACHIEVEMENTS + std::lock_guard lock(s_on_frame_memory_mutex); for (std::size_t index : memory_patch_indices) { diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 56b9035cb6..adc1cbd57a 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -212,13 +212,11 @@ void LoadFromBuffer(Core::System& system, std::vector& buffer) return; } -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) { OSD::AddMessage("Loading savestates is disabled in RetroAchievements hardcore mode"); return; } -#endif // USE_RETRO_ACHIEVEMENTS Core::RunOnCPUThread( system, @@ -865,13 +863,11 @@ void LoadAs(Core::System& system, const std::string& filename) return; } -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) { OSD::AddMessage("Loading savestates is disabled in RetroAchievements hardcore mode"); return; } -#endif // USE_RETRO_ACHIEVEMENTS std::unique_lock lk(s_load_or_save_in_progress_mutex, std::try_to_lock); if (!lk) diff --git a/Source/Core/DiscIO/RiivolutionPatcher.cpp b/Source/Core/DiscIO/RiivolutionPatcher.cpp index 7dc245d27b..8c54968c35 100644 --- a/Source/Core/DiscIO/RiivolutionPatcher.cpp +++ b/Source/Core/DiscIO/RiivolutionPatcher.cpp @@ -524,10 +524,8 @@ static bool MemoryMatchesAt(const Core::CPUThreadGuard& guard, u32 offset, static void ApplyMemoryPatch(const Core::CPUThreadGuard& guard, u32 offset, std::span value, std::span original) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) return; -#endif // USE_RETRO_ACHIEVEMENTS if (value.empty()) return; diff --git a/Source/Core/DolphinQt/HotkeyScheduler.cpp b/Source/Core/DolphinQt/HotkeyScheduler.cpp index c02303ed5c..10f7540ca7 100644 --- a/Source/Core/DolphinQt/HotkeyScheduler.cpp +++ b/Source/Core/DolphinQt/HotkeyScheduler.cpp @@ -589,15 +589,12 @@ void HotkeyScheduler::Run() { const bool new_value = !Config::Get(Config::FREE_LOOK_ENABLED); Config::SetCurrent(Config::FREE_LOOK_ENABLED, new_value); -#ifdef USE_RETRO_ACHIEVEMENTS + const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive(); if (hardcore) OSD::AddMessage("Free Look is Disabled in Hardcore Mode"); else OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled")); -#else // USE_RETRO_ACHIEVEMENTS - OSD::AddMessage(fmt::format("Free Look: {}", new_value ? "Enabled" : "Disabled")); -#endif // USE_RETRO_ACHIEVEMENTS } // Savestates diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index fc94065624..75b279db67 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -127,14 +127,9 @@ void MenuBar::OnEmulationStateChanged(Core::State state) m_screenshot_action->setEnabled(running); m_state_save_menu->setEnabled(running); -#ifdef USE_RETRO_ACHIEVEMENTS const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive(); m_state_load_menu->setEnabled(running && !hardcore); m_frame_advance_action->setEnabled(running && !hardcore); -#else // USE_RETRO_ACHIEVEMENTS - m_state_load_menu->setEnabled(running); - m_frame_advance_action->setEnabled(running); -#endif // USE_RETRO_ACHIEVEMENTS // Movie m_recording_read_only->setEnabled(running); @@ -144,11 +139,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state) m_recording_export->setEnabled(false); } m_recording_play->setEnabled(m_game_selected && !running); -#ifdef USE_RETRO_ACHIEVEMENTS m_recording_play->setEnabled(m_game_selected && !running && !hardcore); -#else // USE_RETRO_ACHIEVEMENTS - m_recording_play->setEnabled(m_game_selected && !running); -#endif // USE_RETRO_ACHIEVEMENTS m_recording_start->setEnabled((m_game_selected || running) && !Core::System::GetInstance().GetMovie().IsPlayingInput()); diff --git a/Source/Core/DolphinQt/Settings.cpp b/Source/Core/DolphinQt/Settings.cpp index 0ffdadb119..9cc1a1a5ab 100644 --- a/Source/Core/DolphinQt/Settings.cpp +++ b/Source/Core/DolphinQt/Settings.cpp @@ -550,10 +550,8 @@ void Settings::SetCheatsEnabled(bool enabled) void Settings::SetDebugModeEnabled(bool enabled) { -#ifdef USE_RETRO_ACHIEVEMENTS if (AchievementManager::GetInstance().IsHardcoreModeActive()) enabled = false; -#endif // USE_RETRO_ACHIEVEMENTS if (IsDebugModeEnabled() != enabled) { Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled); diff --git a/Source/Core/DolphinQt/Settings/GeneralPane.cpp b/Source/Core/DolphinQt/Settings/GeneralPane.cpp index 114a5846a8..a2eda20e9d 100644 --- a/Source/Core/DolphinQt/Settings/GeneralPane.cpp +++ b/Source/Core/DolphinQt/Settings/GeneralPane.cpp @@ -84,14 +84,10 @@ void GeneralPane::CreateLayout() void GeneralPane::OnEmulationStateChanged(Core::State state) { const bool running = state != Core::State::Uninitialized; + const bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive(); m_checkbox_dualcore->setEnabled(!running); -#ifdef USE_RETRO_ACHIEVEMENTS - bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive(); m_checkbox_cheats->setEnabled(!running && !hardcore); -#else // USE_RETRO_ACHIEVEMENTS - m_checkbox_cheats->setEnabled(!running); -#endif // USE_RETRO_ACHIEVEMENTS m_checkbox_override_region_settings->setEnabled(!running); #ifdef USE_DISCORD_PRESENCE m_checkbox_discord_presence->setEnabled(!running); diff --git a/Source/Core/DolphinQt/Settings/InterfacePane.cpp b/Source/Core/DolphinQt/Settings/InterfacePane.cpp index 9d19a1e2c0..c375214bd3 100644 --- a/Source/Core/DolphinQt/Settings/InterfacePane.cpp +++ b/Source/Core/DolphinQt/Settings/InterfacePane.cpp @@ -268,7 +268,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox() static constexpr char TR_DISABLED_IN_HARDCORE_DESCRIPTION[] = QT_TR_NOOP("Disabled in Hardcore Mode."); -#ifdef USE_RETRO_ACHIEVEMENTS bool hardcore = AchievementManager::GetInstance().IsHardcoreModeActive(); SignalBlocking(m_checkbox_show_debugging_ui)->setEnabled(!hardcore); if (hardcore) @@ -281,9 +280,6 @@ void InterfacePane::UpdateShowDebuggingCheckbox() { m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION)); } -#else - m_checkbox_show_debugging_ui->SetDescription(tr(TR_SHOW_DEBUGGING_UI_DESCRIPTION)); -#endif // USE_RETRO_ACHIEVEMENTS } void InterfacePane::LoadUserStyle() diff --git a/Source/Core/VideoCommon/OnScreenUI.cpp b/Source/Core/VideoCommon/OnScreenUI.cpp index 1231851c9a..423cb5cb19 100644 --- a/Source/Core/VideoCommon/OnScreenUI.cpp +++ b/Source/Core/VideoCommon/OnScreenUI.cpp @@ -331,9 +331,9 @@ void OnScreenUI::DrawDebugText() ImGui::TextUnformatted(profile_output.c_str()); } -#ifdef USE_RETRO_ACHIEVEMENTS void OnScreenUI::DrawChallengesAndLeaderboards() { +#ifdef USE_RETRO_ACHIEVEMENTS std::lock_guard lg{AchievementManager::GetInstance().GetLock()}; const auto& challenge_icons = AchievementManager::GetInstance().GetChallengeIcons(); const auto& leaderboard_progress = AchievementManager::GetInstance().GetActiveLeaderboards(); @@ -396,8 +396,8 @@ void OnScreenUI::DrawChallengesAndLeaderboards() } ImGui::End(); } -} #endif // USE_RETRO_ACHIEVEMENTS +} void OnScreenUI::Finalize() { @@ -406,9 +406,7 @@ void OnScreenUI::Finalize() g_perf_metrics.DrawImGuiStats(m_backbuffer_scale); DrawDebugText(); OSD::DrawMessages(); -#ifdef USE_RETRO_ACHIEVEMENTS DrawChallengesAndLeaderboards(); -#endif // USE_RETRO_ACHIEVEMENTS ImGui::Render(); } diff --git a/Source/Core/VideoCommon/OnScreenUI.h b/Source/Core/VideoCommon/OnScreenUI.h index 1acef96901..76fdcee19a 100644 --- a/Source/Core/VideoCommon/OnScreenUI.h +++ b/Source/Core/VideoCommon/OnScreenUI.h @@ -61,9 +61,7 @@ public: private: void DrawDebugText(); -#ifdef USE_RETRO_ACHIEVEMENTS void DrawChallengesAndLeaderboards(); -#endif // USE_RETRO_ACHIEVEMENTS // ImGui resources. std::unique_ptr m_imgui_vertex_format;