From 8d515d407c8b51c8887e2766fb2494aad3f91a1e Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Tue, 30 Jan 2024 03:45:17 +0100 Subject: [PATCH] Migrate SConfig::m_is_mios to System. --- Source/Core/Core/BootManager.cpp | 4 ++-- Source/Core/Core/ConfigManager.cpp | 4 ++-- Source/Core/Core/ConfigManager.h | 6 +++--- Source/Core/Core/HLE/HLE.cpp | 3 +-- Source/Core/Core/IOS/MIOS.cpp | 2 +- Source/Core/Core/State.cpp | 5 +++-- Source/Core/Core/System.h | 4 ++++ 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index 72f525027f..3440561445 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -60,13 +60,13 @@ bool BootCore(std::unique_ptr boot, const WindowSystemInfo& wsi) if (!boot) return false; + auto& system = Core::System::GetInstance(); SConfig& StartUp = SConfig::GetInstance(); - if (!StartUp.SetPathsAndGameMetadata(*boot)) + if (!StartUp.SetPathsAndGameMetadata(system, *boot)) return false; // Movie settings - auto& system = Core::System::GetInstance(); auto& movie = system.GetMovie(); if (movie.IsPlayingInput() && movie.IsConfigSaved()) { diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index bfd723224d..ad69edae6d 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -335,9 +335,9 @@ private: DiscIO::Region* region; }; -bool SConfig::SetPathsAndGameMetadata(const BootParameters& boot) +bool SConfig::SetPathsAndGameMetadata(Core::System& system, const BootParameters& boot) { - m_is_mios = false; + system.SetIsMIOS(false); m_disc_booted_from_game_list = false; if (!std::visit(SetGameMetadata(this, &m_region), boot.parameters)) return false; diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index 4c0eac3fe5..9add9fd7bd 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -22,7 +22,8 @@ class IniFile; namespace Core { class CPUThreadGuard; -} +class System; +} // namespace Core namespace DiscIO { @@ -52,7 +53,6 @@ struct SConfig bool bCopyWiiSaveNetplay = true; bool bWii = false; - bool m_is_mios = false; DiscIO::Region m_region; @@ -80,7 +80,7 @@ struct SConfig void LoadDefaults(); static std::string MakeGameID(std::string_view file_name); - bool SetPathsAndGameMetadata(const BootParameters& boot); + bool SetPathsAndGameMetadata(Core::System& system, const BootParameters& boot); DiscIO::Language GetCurrentLanguage(bool wii) const; DiscIO::Language GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const; std::string GetGameTDBImageRegionCode(bool wii, DiscIO::Region region) const; diff --git a/Source/Core/Core/HLE/HLE.cpp b/Source/Core/Core/HLE/HLE.cpp index 5d7de6eccf..a8bc7c9901 100644 --- a/Source/Core/Core/HLE/HLE.cpp +++ b/Source/Core/Core/HLE/HLE.cpp @@ -11,7 +11,6 @@ #include "Common/Config/Config.h" #include "Core/Config/MainSettings.h" -#include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/GeckoCode.h" #include "Core/HLE/HLE_Misc.h" @@ -85,7 +84,7 @@ void PatchFixedFunctions(Core::System& system) // that get patched by MIOS. See https://bugs.dolphin-emu.org/issues/11952 for more info. // Not applying the Gecko HLE patches means that Gecko codes will not work under MIOS, // but this is better than the alternative of having specific games crash. - if (SConfig::GetInstance().m_is_mios) + if (system.IsMIOS()) return; // HLE jump to loader (homebrew). Disabled when Gecko is active as it interferes with the code diff --git a/Source/Core/Core/IOS/MIOS.cpp b/Source/Core/Core/IOS/MIOS.cpp index 1f317e3145..5bdfadbb14 100644 --- a/Source/Core/Core/IOS/MIOS.cpp +++ b/Source/Core/Core/IOS/MIOS.cpp @@ -101,7 +101,7 @@ bool Load(Core::System& system) memory.Write_U32(0x00000000, ADDRESS_INIT_SEMAPHORE); NOTICE_LOG_FMT(IOS, "IPL ready."); - SConfig::GetInstance().m_is_mios = true; + system.SetIsMIOS(true); system.GetDVDInterface().UpdateRunningGameMetadata(); SConfig::OnNewTitleLoad(guard); return true; diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index f804b319a5..653ff7eecf 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -139,7 +139,9 @@ void EnableCompression(bool compression) static void DoState(PointerWrap& p) { - bool is_wii = SConfig::GetInstance().bWii || SConfig::GetInstance().m_is_mios; + auto& system = Core::System::GetInstance(); + + bool is_wii = SConfig::GetInstance().bWii || system.IsMIOS(); const bool is_wii_currently = is_wii; p.Do(is_wii); if (is_wii != is_wii_currently) @@ -152,7 +154,6 @@ static void DoState(PointerWrap& p) } // Check to make sure the emulated memory sizes are the same as the savestate - auto& system = Core::System::GetInstance(); auto& memory = system.GetMemory(); u32 state_mem1_size = memory.GetRamSizeReal(); u32 state_mem2_size = memory.GetExRamSizeReal(); diff --git a/Source/Core/Core/System.h b/Source/Core/Core/System.h index 742c63bc23..d16a8b2ac9 100644 --- a/Source/Core/Core/System.h +++ b/Source/Core/Core/System.h @@ -135,6 +135,9 @@ public: bool IsDualCoreMode() const { return m_separate_cpu_and_gpu_threads; } bool IsMMUMode() const { return m_mmu_enabled; } bool IsPauseOnPanicMode() const { return m_pause_on_panic_enabled; } + bool IsMIOS() const { return m_is_mios; } + + void SetIsMIOS(bool is_mios) { m_is_mios = is_mios; } SoundStream* GetSoundStream() const; void SetSoundStream(std::unique_ptr sound_stream); @@ -188,5 +191,6 @@ private: bool m_separate_cpu_and_gpu_threads = false; bool m_mmu_enabled = false; bool m_pause_on_panic_enabled = false; + bool m_is_mios = false; }; } // namespace Core