diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 562bfa163..a689129af 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -141,7 +141,7 @@ public: const auto& log_dir = GetUserPath(PathType::LogDir); std::filesystem::create_directory(log_dir); Filter filter; - filter.ParseFilterString(EmulatorSettings::GetInstance()->GetLogFilter()); + filter.ParseFilterString(EmulatorSettings.GetLogFilter()); const auto& log_file_path = log_file.empty() ? LOG_FILE : log_file; instance = std::unique_ptr( new Impl(log_dir / log_file_path, filter), Deleter); @@ -186,7 +186,7 @@ public: void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num, const char* function, const char* format, const fmt::format_args& args) { if (!filter.CheckMessage(log_class, log_level) || - !EmulatorSettings::GetInstance()->IsLogEnabled()) { + !EmulatorSettings.IsLogEnabled()) { return; } @@ -214,7 +214,7 @@ public: using std::chrono::microseconds; using std::chrono::steady_clock; - if (EmulatorSettings::GetInstance()->IsIdenticalLogGrouped()) { + if (EmulatorSettings.IsIdenticalLogGrouped()) { std::unique_lock entry_loc(_mutex); if (_last_entry.message == message) { @@ -227,7 +227,7 @@ public: } if (_last_entry.counter >= 1) { - if (EmulatorSettings::GetInstance()->GetLogType() == "async") { + if (EmulatorSettings.GetLogType() == "async") { message_queue.EmplaceWait(_last_entry); } else { ForEachBackend([this](auto& backend) { backend.Write(this->_last_entry); }); @@ -259,7 +259,7 @@ public: .counter = 1, }; - if (EmulatorSettings::GetInstance()->GetLogType() == "async") { + if (EmulatorSettings.GetLogType() == "async") { message_queue.EmplaceWait(entry); } else { ForEachBackend([&entry](auto& backend) { backend.Write(entry); }); @@ -297,14 +297,14 @@ private: } void StopBackendThread() { - if (EmulatorSettings::GetInstance()->IsIdenticalLogGrouped()) { + if (EmulatorSettings.IsIdenticalLogGrouped()) { // log last message if (_last_entry.counter >= 2) { _last_entry.message += " x" + std::to_string(_last_entry.counter); } if (_last_entry.counter >= 1) { - if (EmulatorSettings::GetInstance()->GetLogType() == "async") { + if (EmulatorSettings.GetLogType() == "async") { message_queue.EmplaceWait(_last_entry); } else { ForEachBackend([this](auto& backend) { backend.Write(this->_last_entry); }); diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index 5dedc12d2..980a238a6 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -187,7 +187,7 @@ struct AddressSpace::Impl { user_size = supported_user_max - USER_MIN - 1; // Increase BackingSize to account for config options. - BackingSize += EmulatorSettings::GetInstance()->GetExtraDmemInMBytes() * 1_MB; + BackingSize += EmulatorSettings.GetExtraDmemInMBytes() * 1_MB; // Allocate backing file that represents the total physical memory. backing_handle = CreateFileMapping2(INVALID_HANDLE_VALUE, nullptr, FILE_MAP_ALL_ACCESS, @@ -606,7 +606,7 @@ enum PosixPageProtection { struct AddressSpace::Impl { Impl() { - BackingSize += EmulatorSettings::GetInstance()->GetExtraDmemInMBytes() * 1_MB; + BackingSize += EmulatorSettings.GetExtraDmemInMBytes() * 1_MB; // Allocate virtual address placeholder for our address space. system_managed_size = SystemManagedSize; system_reserved_size = SystemReservedSize; diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index abb74ecae..10e5f911c 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -110,11 +110,11 @@ void L::DrawMenuBar() { EndDisabled(); if (Button("Save")) { - EmulatorSettings::GetInstance()->SetFsrEnabled(fsr.enable); - EmulatorSettings::GetInstance()->SetRcasEnabled(fsr.use_rcas); - EmulatorSettings::GetInstance()->SetRcasAttenuation( + EmulatorSettings.SetFsrEnabled(fsr.enable); + EmulatorSettings.SetRcasEnabled(fsr.use_rcas); + EmulatorSettings.SetRcasAttenuation( static_cast(fsr.rcas_attenuation * 1000)); - EmulatorSettings::GetInstance()->Save(); + EmulatorSettings.Save(); CloseCurrentPopup(); } @@ -311,7 +311,7 @@ static void LoadSettings(const char* line) { void L::SetupSettings() { frame_graph.is_open = true; - show_simple_fps = EmulatorSettings::GetInstance()->IsShowFpsCounter(); + show_simple_fps = EmulatorSettings.IsShowFpsCounter(); using SettingLoader = void (*)(const char*); @@ -472,7 +472,7 @@ void L::Draw() { if (ImGui::Begin("Volume Window", &show_volume, ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDocking)) { - Text("Volume: %d", EmulatorSettings::GetInstance()->GetVolumeSlider()); + Text("Volume: %d", EmulatorSettings.GetVolumeSlider()); } End(); } diff --git a/src/core/devtools/widget/frame_graph.cpp b/src/core/devtools/widget/frame_graph.cpp index 07f2fbdb4..20f30e107 100644 --- a/src/core/devtools/widget/frame_graph.cpp +++ b/src/core/devtools/widget/frame_graph.cpp @@ -29,7 +29,7 @@ void FrameGraph::DrawFrameGraph() { return; } - float target_dt = 1.0f / (float)EmulatorSettings::GetInstance()->GetVblankFrequency(); + float target_dt = 1.0f / (float)EmulatorSettings.GetVblankFrequency(); float cur_pos_x = pos.x + full_width; pos.y += FRAME_GRAPH_PADDING_Y; const float final_pos_y = pos.y + FRAME_GRAPH_HEIGHT; diff --git a/src/core/devtools/widget/module_list.h b/src/core/devtools/widget/module_list.h index b321e4ba8..25a05a335 100644 --- a/src/core/devtools/widget/module_list.h +++ b/src/core/devtools/widget/module_list.h @@ -23,7 +23,7 @@ public: bool open = false; static bool IsSystemModule(const std::filesystem::path& path) { - const auto sys_modules_path = EmulatorSettings::GetInstance()->GetSysModulesDir(); + const auto sys_modules_path = EmulatorSettings.GetSysModulesDir(); const auto abs_path = std::filesystem::absolute(path).lexically_normal(); const auto abs_sys_path = std::filesystem::absolute(sys_modules_path).lexically_normal(); diff --git a/src/core/devtools/widget/shader_list.cpp b/src/core/devtools/widget/shader_list.cpp index 98d3740b4..04e942e75 100644 --- a/src/core/devtools/widget/shader_list.cpp +++ b/src/core/devtools/widget/shader_list.cpp @@ -244,7 +244,7 @@ void ShaderList::Draw() { return; } - if (!EmulatorSettings::GetInstance()->IsShaderCollect()) { + if (!EmulatorSettings.IsShaderCollect()) { DrawCenteredText("Enable 'shader_dump' in config to see shaders"); End(); return; diff --git a/src/core/emulator_settings.cpp b/src/core/emulator_settings.cpp index fe845f18b..44ad17935 100644 --- a/src/core/emulator_settings.cpp +++ b/src/core/emulator_settings.cpp @@ -16,8 +16,8 @@ using json = nlohmann::json; // ── Singleton storage ───────────────────────────────────────────────── -std::shared_ptr EmulatorSettings::s_instance = nullptr; -std::mutex EmulatorSettings::s_mutex; +std::shared_ptr EmulatorSettingsImpl::s_instance = nullptr; +std::mutex EmulatorSettingsImpl::s_mutex; // ── nlohmann helpers for std::filesystem::path ─────────────────────── namespace nlohmann { @@ -34,7 +34,7 @@ struct adl_serializer { // ── Helpers ─────────────────────────────────────────────────────────── -void EmulatorSettings::PrintChangedSummary(const std::vector& changed) { +void EmulatorSettingsImpl::PrintChangedSummary(const std::vector& changed) { if (changed.empty()) { LOG_DEBUG(EmuSettings, "No game-specific overrides applied"); return; @@ -45,20 +45,20 @@ void EmulatorSettings::PrintChangedSummary(const std::vector& chang } // ── Singleton ──────────────────────────────────────────────────────── -EmulatorSettings::EmulatorSettings() = default; +EmulatorSettingsImpl::EmulatorSettingsImpl() = default; -EmulatorSettings::~EmulatorSettings() { +EmulatorSettingsImpl::~EmulatorSettingsImpl() { Save(); } -std::shared_ptr EmulatorSettings::GetInstance() { +std::shared_ptr EmulatorSettingsImpl::GetInstance() { std::lock_guard lock(s_mutex); if (!s_instance) - s_instance = std::make_shared(); + s_instance = std::make_shared(); return s_instance; } -void EmulatorSettings::SetInstance(std::shared_ptr instance) { +void EmulatorSettingsImpl::SetInstance(std::shared_ptr instance) { std::lock_guard lock(s_mutex); s_instance = std::move(instance); } @@ -66,7 +66,7 @@ void EmulatorSettings::SetInstance(std::shared_ptr instance) { // -------------------- // General helpers // -------------------- -bool EmulatorSettings::AddGameInstallDir(const std::filesystem::path& dir, bool enabled) { +bool EmulatorSettingsImpl::AddGameInstallDir(const std::filesystem::path& dir, bool enabled) { for (const auto& d : m_general.install_dirs.value) if (d.path == dir) return false; @@ -74,7 +74,7 @@ bool EmulatorSettings::AddGameInstallDir(const std::filesystem::path& dir, bool return true; } -std::vector EmulatorSettings::GetGameInstallDirs() const { +std::vector EmulatorSettingsImpl::GetGameInstallDirs() const { std::vector out; for (const auto& d : m_general.install_dirs.value) if (d.enabled) @@ -82,15 +82,15 @@ std::vector EmulatorSettings::GetGameInstallDirs() const return out; } -const std::vector& EmulatorSettings::GetAllGameInstallDirs() const { +const std::vector& EmulatorSettingsImpl::GetAllGameInstallDirs() const { return m_general.install_dirs.value; } -void EmulatorSettings::SetAllGameInstallDirs(const std::vector& dirs) { +void EmulatorSettingsImpl::SetAllGameInstallDirs(const std::vector& dirs) { m_general.install_dirs.value = dirs; } -void EmulatorSettings::RemoveGameInstallDir(const std::filesystem::path& dir) { +void EmulatorSettingsImpl::RemoveGameInstallDir(const std::filesystem::path& dir) { auto iterator = std::find_if(m_general.install_dirs.value.begin(), m_general.install_dirs.value.end(), [&dir](const GameInstallDir& install_dir) { return install_dir.path == dir; }); @@ -99,7 +99,7 @@ void EmulatorSettings::RemoveGameInstallDir(const std::filesystem::path& dir) { } } -void EmulatorSettings::SetGameInstallDirEnabled(const std::filesystem::path& dir, bool enabled) { +void EmulatorSettingsImpl::SetGameInstallDirEnabled(const std::filesystem::path& dir, bool enabled) { auto iterator = std::find_if(m_general.install_dirs.value.begin(), m_general.install_dirs.value.end(), [&dir](const GameInstallDir& install_dir) { return install_dir.path == dir; }); @@ -108,14 +108,14 @@ void EmulatorSettings::SetGameInstallDirEnabled(const std::filesystem::path& dir } } -void EmulatorSettings::SetGameInstallDirs(const std::vector& dirs_config) { +void EmulatorSettingsImpl::SetGameInstallDirs(const std::vector& dirs_config) { m_general.install_dirs.value.clear(); for (const auto& dir : dirs_config) { m_general.install_dirs.value.push_back({dir, true}); } } -const std::vector EmulatorSettings::GetGameInstallDirsEnabled() { +const std::vector EmulatorSettingsImpl::GetGameInstallDirsEnabled() { std::vector enabled_dirs; for (const auto& dir : m_general.install_dirs.value) { enabled_dirs.push_back(dir.enabled); @@ -123,41 +123,41 @@ const std::vector EmulatorSettings::GetGameInstallDirsEnabled() { return enabled_dirs; } -std::filesystem::path EmulatorSettings::GetHomeDir() { +std::filesystem::path EmulatorSettingsImpl::GetHomeDir() { if (m_general.home_dir.value.empty()) { return Common::FS::GetUserPath(Common::FS::PathType::HomeDir); } return m_general.home_dir.value; } -void EmulatorSettings::SetHomeDir(const std::filesystem::path& dir) { +void EmulatorSettingsImpl::SetHomeDir(const std::filesystem::path& dir) { m_general.home_dir.value = dir; } -std::filesystem::path EmulatorSettings::GetSysModulesDir() { +std::filesystem::path EmulatorSettingsImpl::GetSysModulesDir() { if (m_general.sys_modules_dir.value.empty()) { return Common::FS::GetUserPath(Common::FS::PathType::SysModuleDir); } return m_general.sys_modules_dir.value; } -void EmulatorSettings::SetSysModulesDir(const std::filesystem::path& dir) { +void EmulatorSettingsImpl::SetSysModulesDir(const std::filesystem::path& dir) { m_general.sys_modules_dir.value = dir; } -std::filesystem::path EmulatorSettings::GetFontsDir() { +std::filesystem::path EmulatorSettingsImpl::GetFontsDir() { if (m_general.font_dir.value.empty()) { return Common::FS::GetUserPath(Common::FS::PathType::FontsDir); } return m_general.font_dir.value; } -void EmulatorSettings::SetFontsDir(const std::filesystem::path& dir) { +void EmulatorSettingsImpl::SetFontsDir(const std::filesystem::path& dir) { m_general.font_dir.value = dir; } // ── Game-specific override management ──────────────────────────────── -void EmulatorSettings::ClearGameSpecificOverrides() { +void EmulatorSettingsImpl::ClearGameSpecificOverrides() { ClearGroupOverrides(m_general); ClearGroupOverrides(m_debug); ClearGroupOverrides(m_input); @@ -167,7 +167,7 @@ void EmulatorSettings::ClearGameSpecificOverrides() { LOG_DEBUG(EmuSettings, "All game-specific overrides cleared"); } -void EmulatorSettings::ResetGameSpecificValue(const std::string& key) { +void EmulatorSettingsImpl::ResetGameSpecificValue(const std::string& key) { // Walk every overrideable group until we find the matching key. auto tryGroup = [&key](auto& group) { for (auto& item : group.GetOverrideableFields()) { @@ -193,7 +193,7 @@ void EmulatorSettings::ResetGameSpecificValue(const std::string& key) { LOG_WARNING(EmuSettings, "ResetGameSpecificValue: key '{}' not found", key); } -bool EmulatorSettings::Save(const std::string& serial) { +bool EmulatorSettingsImpl::Save(const std::string& serial) { try { if (!serial.empty()) { const auto cfgDir = Common::FS::GetUserPath(Common::FS::PathType::CustomConfigs); @@ -264,7 +264,7 @@ bool EmulatorSettings::Save(const std::string& serial) { // ── Load ────────────────────────────────────────────────────────────── -bool EmulatorSettings::Load(const std::string& serial) { +bool EmulatorSettingsImpl::Load(const std::string& serial) { try { if (serial.empty()) { // ── Global config ────────────────────────────────────────── @@ -382,7 +382,7 @@ bool EmulatorSettings::Load(const std::string& serial) { } } -void EmulatorSettings::SetDefaultValues() { +void EmulatorSettingsImpl::SetDefaultValues() { m_general = GeneralSettings{}; m_debug = DebugSettings{}; m_input = InputSettings{}; @@ -391,7 +391,7 @@ void EmulatorSettings::SetDefaultValues() { m_vulkan = VulkanSettings{}; } -std::vector EmulatorSettings::GetAllOverrideableKeys() const { +std::vector EmulatorSettingsImpl::GetAllOverrideableKeys() const { std::vector keys; auto addGroup = [&keys](const auto& fields) { for (const auto& item : fields) diff --git a/src/core/emulator_settings.h b/src/core/emulator_settings.h index e472c8c3e..31e826d51 100644 --- a/src/core/emulator_settings.h +++ b/src/core/emulator_settings.h @@ -15,6 +15,8 @@ #include "common/types.h" #include "core/user_manager.h" +#define EmulatorSettings (*EmulatorSettingsImpl::GetInstance()) + enum HideCursorState : int { Never, Idle, @@ -393,13 +395,13 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Users, default_user_id, user) // ------------------------------- // Main manager // ------------------------------- -class EmulatorSettings { +class EmulatorSettingsImpl { public: - EmulatorSettings(); - ~EmulatorSettings(); + EmulatorSettingsImpl(); + ~EmulatorSettingsImpl(); - static std::shared_ptr GetInstance(); - static void SetInstance(std::shared_ptr instance); + static std::shared_ptr GetInstance(); + static void SetInstance(std::shared_ptr instance); bool Save(const std::string& serial = ""); bool Load(const std::string& serial = ""); @@ -454,7 +456,7 @@ private: UserManager m_userManager; ConfigMode m_configMode{ConfigMode::Default}; - static std::shared_ptr s_instance; + static std::shared_ptr s_instance; static std::mutex s_mutex; /// Apply overrideable fields from groupJson into group.game_specific_value. diff --git a/src/core/ipc/ipc.cpp b/src/core/ipc/ipc.cpp index 35e406820..489c34646 100644 --- a/src/core/ipc/ipc.cpp +++ b/src/core/ipc/ipc.cpp @@ -153,7 +153,7 @@ void IPC::InputLoop() { } else if (cmd == "ADJUST_VOLUME") { int value = static_cast(next_u64()); bool is_game_specific = next_u64() != 0; - EmulatorSettings::GetInstance()->SetVolumeSlider(value); + EmulatorSettings.SetVolumeSlider(value); Libraries::AudioOut::AdjustVol(); } else if (cmd == "SET_FSR") { bool use_fsr = next_u64() != 0; diff --git a/src/core/libraries/app_content/app_content.cpp b/src/core/libraries/app_content/app_content.cpp index 2912e8d91..bf2b72b07 100644 --- a/src/core/libraries/app_content/app_content.cpp +++ b/src/core/libraries/app_content/app_content.cpp @@ -57,7 +57,7 @@ int PS4_SYSV_ABI sceAppContentAddcontMount(u32 service_label, OrbisAppContentMountPoint* mount_point) { LOG_INFO(Lib_AppContent, "called"); - const auto& addon_path = EmulatorSettings::GetInstance()->GetAddonInstallDir() / title_id; + const auto& addon_path = EmulatorSettings.GetAddonInstallDir() / title_id; auto* mnt = Common::Singleton::Instance(); // Determine which loaded additional content this entitlement label is for. @@ -282,7 +282,7 @@ int PS4_SYSV_ABI sceAppContentInitialize(const OrbisAppContentInitParam* initPar LOG_ERROR(Lib_AppContent, "(DUMMY) called"); auto* param_sfo = Common::Singleton::Instance(); - const auto addons_dir = EmulatorSettings::GetInstance()->GetAddonInstallDir(); + const auto addons_dir = EmulatorSettings.GetAddonInstallDir(); if (const auto value = param_sfo->GetString("TITLE_ID"); value.has_value()) { title_id = *value; } else { diff --git a/src/core/libraries/audio/sdl_audio_in.cpp b/src/core/libraries/audio/sdl_audio_in.cpp index 9eea55373..25cd56878 100644 --- a/src/core/libraries/audio/sdl_audio_in.cpp +++ b/src/core/libraries/audio/sdl_audio_in.cpp @@ -21,7 +21,7 @@ public: fmt.channels = static_cast(port.channels_num); fmt.freq = static_cast(port.freq); - std::string micDevStr = EmulatorSettings::GetInstance()->GetMicDevice(); + std::string micDevStr = EmulatorSettings.GetMicDevice(); uint32_t devId = 0; if (micDevStr == "None") { nullDevice = true; diff --git a/src/core/libraries/audio/sdl_audio_out.cpp b/src/core/libraries/audio/sdl_audio_out.cpp index 5b6e02d13..83b24d812 100644 --- a/src/core/libraries/audio/sdl_audio_out.cpp +++ b/src/core/libraries/audio/sdl_audio_out.cpp @@ -111,7 +111,7 @@ public: } const float slider_gain = - EmulatorSettings::GetInstance()->GetVolumeSlider() * 0.01f; // Faster than /100.0f + EmulatorSettings.GetVolumeSlider() * 0.01f; // Faster than /100.0f const float total_gain = max_channel_gain * slider_gain; const float current = current_gain.load(std::memory_order_acquire); @@ -157,7 +157,7 @@ private: } // Initialize current gain - current_gain.store(EmulatorSettings::GetInstance()->GetVolumeSlider() * 0.01f, + current_gain.store(EmulatorSettings.GetVolumeSlider() * 0.01f, std::memory_order_relaxed); if (!SelectConverter()) { @@ -203,7 +203,7 @@ private: last_volume_check_time = current_time; - const float config_volume = EmulatorSettings::GetInstance()->GetVolumeSlider() * 0.01f; + const float config_volume = EmulatorSettings.GetVolumeSlider() * 0.01f; const float stored_gain = current_gain.load(std::memory_order_acquire); // Only update if the difference is significant @@ -370,11 +370,11 @@ private: switch (type) { case OrbisAudioOutPort::Main: case OrbisAudioOutPort::Bgm: - return EmulatorSettings::GetInstance()->GetMainOutputDevice(); + return EmulatorSettings.GetMainOutputDevice(); case OrbisAudioOutPort::PadSpk: - return EmulatorSettings::GetInstance()->GetPadSpkOutputDevice(); + return EmulatorSettings.GetPadSpkOutputDevice(); default: - return EmulatorSettings::GetInstance()->GetMainOutputDevice(); + return EmulatorSettings.GetMainOutputDevice(); } } diff --git a/src/core/libraries/gnmdriver/gnmdriver.cpp b/src/core/libraries/gnmdriver/gnmdriver.cpp index f24ddff58..1bb034dd0 100644 --- a/src/core/libraries/gnmdriver/gnmdriver.cpp +++ b/src/core/libraries/gnmdriver/gnmdriver.cpp @@ -2874,7 +2874,7 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) { sdk_version = 0; } - if (EmulatorSettings::GetInstance()->IsCopyGpuBuffers()) { + if (EmulatorSettings.IsCopyGpuBuffers()) { liverpool->ReserveCopyBufferSpace(); } diff --git a/src/core/libraries/kernel/process.cpp b/src/core/libraries/kernel/process.cpp index 52f1f1e08..2af5aa1bf 100644 --- a/src/core/libraries/kernel/process.cpp +++ b/src/core/libraries/kernel/process.cpp @@ -17,19 +17,19 @@ s32 PS4_SYSV_ABI sceKernelIsInSandbox() { } s32 PS4_SYSV_ABI sceKernelIsNeoMode() { - return EmulatorSettings::GetInstance()->IsNeo() && + return EmulatorSettings.IsNeo() && Common::ElfInfo::Instance().GetPSFAttributes().support_neo_mode; } s32 PS4_SYSV_ABI sceKernelHasNeoMode() { - return EmulatorSettings::GetInstance()->IsNeo(); + return EmulatorSettings.IsNeo(); } s32 PS4_SYSV_ABI sceKernelGetMainSocId() { // These hardcoded values are based on hardware observations. // Different models of PS4/PS4 Pro likely return slightly different values. LOG_DEBUG(Lib_Kernel, "called"); - if (EmulatorSettings::GetInstance()->IsNeo()) { + if (EmulatorSettings.IsNeo()) { return 0x740f30; } return 0x710f10; diff --git a/src/core/libraries/network/net.cpp b/src/core/libraries/network/net.cpp index ef0f48108..6bf4764c4 100644 --- a/src/core/libraries/network/net.cpp +++ b/src/core/libraries/network/net.cpp @@ -1447,7 +1447,7 @@ int PS4_SYSV_ABI sceNetResolverStartNtoa(OrbisNetId resolverid, const char* host return ORBIS_NET_ERROR_EBADF; } - if (!EmulatorSettings::GetInstance()->IsConnectedToNetwork()) { + if (!EmulatorSettings.IsConnectedToNetwork()) { *sceNetErrnoLoc() = ORBIS_NET_RESOLVER_ENODNS; file->resolver->resolution_error = ORBIS_NET_ERROR_RESOLVER_ENODNS; return ORBIS_NET_ERROR_RESOLVER_ENODNS; diff --git a/src/core/libraries/network/net_ctl_obj.cpp b/src/core/libraries/network/net_ctl_obj.cpp index c6a9ee756..4f412c399 100644 --- a/src/core/libraries/network/net_ctl_obj.cpp +++ b/src/core/libraries/network/net_ctl_obj.cpp @@ -46,7 +46,7 @@ s32 NetCtlInternal::RegisterNpToolkitCallback(OrbisNetCtlCallbackForNpToolkit fu void NetCtlInternal::CheckCallback() { std::scoped_lock lock{m_mutex}; - const auto event = EmulatorSettings::GetInstance()->IsConnectedToNetwork() + const auto event = EmulatorSettings.IsConnectedToNetwork() ? ORBIS_NET_CTL_EVENT_TYPE_IPOBTAINED : ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED; for (const auto [func, arg] : callbacks) { @@ -58,7 +58,7 @@ void NetCtlInternal::CheckCallback() { void NetCtlInternal::CheckNpToolkitCallback() { std::scoped_lock lock{m_mutex}; - const auto event = EmulatorSettings::GetInstance()->IsConnectedToNetwork() + const auto event = EmulatorSettings.IsConnectedToNetwork() ? ORBIS_NET_CTL_EVENT_TYPE_IPOBTAINED : ORBIS_NET_CTL_EVENT_TYPE_DISCONNECTED; for (const auto [func, arg] : nptool_callbacks) { diff --git a/src/core/libraries/network/net_resolver.cpp b/src/core/libraries/network/net_resolver.cpp index 0056739c6..a66f1519b 100644 --- a/src/core/libraries/network/net_resolver.cpp +++ b/src/core/libraries/network/net_resolver.cpp @@ -27,7 +27,7 @@ int Resolver::ResolveAsync(const char* hostname, OrbisNetInAddr* addr, int timeo } void Resolver::Resolve() { - if (!EmulatorSettings::GetInstance()->IsConnectedToNetwork()) { + if (!EmulatorSettings.IsConnectedToNetwork()) { resolution_error = ORBIS_NET_ERROR_RESOLVER_ENODNS; return; } diff --git a/src/core/libraries/network/netctl.cpp b/src/core/libraries/network/netctl.cpp index d2a4abe19..af7c071ab 100644 --- a/src/core/libraries/network/netctl.cpp +++ b/src/core/libraries/network/netctl.cpp @@ -162,7 +162,7 @@ int PS4_SYSV_ABI sceNetCtlGetIfStat() { int PS4_SYSV_ABI sceNetCtlGetInfo(int code, OrbisNetCtlInfo* info) { LOG_DEBUG(Lib_NetCtl, "code = {}", code); - if (!EmulatorSettings::GetInstance()->IsConnectedToNetwork()) { + if (!EmulatorSettings.IsConnectedToNetwork()) { return ORBIS_NET_CTL_ERROR_NOT_CONNECTED; } @@ -180,7 +180,7 @@ int PS4_SYSV_ABI sceNetCtlGetInfo(int code, OrbisNetCtlInfo* info) { info->mtu = 1500; // default value break; case ORBIS_NET_CTL_INFO_LINK: - info->link = EmulatorSettings::GetInstance()->IsConnectedToNetwork() + info->link = EmulatorSettings.IsConnectedToNetwork() ? ORBIS_NET_CTL_LINK_CONNECTED : ORBIS_NET_CTL_LINK_DISCONNECTED; break; @@ -319,7 +319,7 @@ int PS4_SYSV_ABI sceNetCtlGetScanInfoForSsidScanIpcInt() { } int PS4_SYSV_ABI sceNetCtlGetState(int* state) { - const auto connected = EmulatorSettings::GetInstance()->IsConnectedToNetwork(); + const auto connected = EmulatorSettings.IsConnectedToNetwork(); LOG_DEBUG(Lib_NetCtl, "connected = {}", connected); const auto current_state = connected ? ORBIS_NET_CTL_STATE_IPOBTAINED : ORBIS_NET_CTL_STATE_DISCONNECTED; diff --git a/src/core/libraries/np/np_auth.cpp b/src/core/libraries/np/np_auth.cpp index 8f7edd798..e9892b355 100644 --- a/src/core/libraries/np/np_auth.cpp +++ b/src/core/libraries/np/np_auth.cpp @@ -363,7 +363,7 @@ s32 PS4_SYSV_ABI sceNpAuthDeleteRequest(s32 req_id) { } void RegisterLib(Core::Loader::SymbolsResolver* sym) { - g_signed_in = EmulatorSettings::GetInstance()->IsPSNSignedIn(); + g_signed_in = EmulatorSettings.IsPSNSignedIn(); LIB_FUNCTION("6bwFkosYRQg", "libSceNpAuth", 1, "libSceNpAuth", sceNpAuthCreateRequest); LIB_FUNCTION("N+mr7GjTvr8", "libSceNpAuth", 1, "libSceNpAuth", sceNpAuthCreateAsyncRequest); diff --git a/src/core/libraries/np/np_manager.cpp b/src/core/libraries/np/np_manager.cpp index 0af5e5092..2998f07dc 100644 --- a/src/core/libraries/np/np_manager.cpp +++ b/src/core/libraries/np/np_manager.cpp @@ -632,7 +632,7 @@ s32 PS4_SYSV_ABI sceNpGetNpId(Libraries::UserService::OrbisUserServiceUserId use } memset(np_id, 0, sizeof(OrbisNpId)); strncpy(np_id->handle.data, - EmulatorSettings::GetInstance()->GetUserManager().GetDefaultUser().user_name.c_str(), + UserManagement.GetDefaultUser().user_name.c_str(), sizeof(np_id->handle.data)); return ORBIS_OK; } @@ -648,7 +648,7 @@ s32 PS4_SYSV_ABI sceNpGetOnlineId(Libraries::UserService::OrbisUserServiceUserId } memset(online_id, 0, sizeof(OrbisNpOnlineId)); strncpy(online_id->data, - EmulatorSettings::GetInstance()->GetUserManager().GetDefaultUser().user_name.c_str(), + UserManagement.GetDefaultUser().user_name.c_str(), sizeof(online_id->data)); return ORBIS_OK; } @@ -788,7 +788,7 @@ void DeregisterNpCallback(std::string key) { } void RegisterLib(Core::Loader::SymbolsResolver* sym) { - g_signed_in = EmulatorSettings::GetInstance()->IsPSNSignedIn(); + g_signed_in = EmulatorSettings.IsPSNSignedIn(); LIB_FUNCTION("GpLQDNKICac", "libSceNpManager", 1, "libSceNpManager", sceNpCreateRequest); LIB_FUNCTION("eiqMCt9UshI", "libSceNpManager", 1, "libSceNpManager", sceNpCreateAsyncRequest); diff --git a/src/core/libraries/np/np_matching2.cpp b/src/core/libraries/np/np_matching2.cpp index 3843d1b51..8fa8068dd 100644 --- a/src/core/libraries/np/np_matching2.cpp +++ b/src/core/libraries/np/np_matching2.cpp @@ -376,8 +376,8 @@ int PS4_SYSV_ABI sceNpMatching2ContextStart(OrbisNpMatching2ContextId ctxId, u64 } std::scoped_lock lk{g_events_mutex}; - if (EmulatorSettings::GetInstance()->IsConnectedToNetwork() && - EmulatorSettings::GetInstance()->IsPSNSignedIn()) { + if (EmulatorSettings.IsConnectedToNetwork() && + EmulatorSettings.IsPSNSignedIn()) { g_ctx_events.emplace_back(ctxId, ORBIS_NP_MATCHING2_CONTEXT_EVENT_STARTED, ORBIS_NP_MATCHING2_EVENT_CAUSE_CONTEXT_ACTION, 0); } else { diff --git a/src/core/libraries/np/np_web_api2.cpp b/src/core/libraries/np/np_web_api2.cpp index ba3681c62..0b292f6cc 100644 --- a/src/core/libraries/np/np_web_api2.cpp +++ b/src/core/libraries/np/np_web_api2.cpp @@ -207,7 +207,7 @@ s32 PS4_SYSV_ABI sceNpWebApi2SendMultipartRequest() { } s32 PS4_SYSV_ABI sceNpWebApi2SendRequest() { - if (!EmulatorSettings::GetInstance()->IsPSNSignedIn()) { + if (!EmulatorSettings.IsPSNSignedIn()) { LOG_INFO(Lib_NpWebApi2, "called, returning PSN signed out."); return ORBIS_NP_WEBAPI2_ERROR_NOT_SIGNED_IN; } diff --git a/src/core/libraries/np/np_web_api_internal.cpp b/src/core/libraries/np/np_web_api_internal.cpp index 1d213a3bf..66a09b493 100644 --- a/src/core/libraries/np/np_web_api_internal.cpp +++ b/src/core/libraries/np/np_web_api_internal.cpp @@ -606,7 +606,7 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s unlockContext(context); // Stubbing sceNpManagerIntGetSigninState call with a config check. - if (!EmulatorSettings::GetInstance()->IsPSNSignedIn()) { + if (!EmulatorSettings.IsPSNSignedIn()) { releaseRequest(request); releaseUserContext(user_context); releaseContext(context); @@ -1025,7 +1025,7 @@ s32 createServicePushEventFilterInternal( auto& handle = context->handles[handleId]; handle->userCount++; - if (pNpServiceName != nullptr && !EmulatorSettings::GetInstance()->IsPSNSignedIn()) { + if (pNpServiceName != nullptr && !EmulatorSettings.IsPSNSignedIn()) { // Seems sceNpManagerIntGetUserList fails? LOG_DEBUG(Lib_NpWebApi, "Cannot create service push event while PSN is disabled"); handle->userCount--; @@ -1202,7 +1202,7 @@ s32 createExtendedPushEventFilterInternal( auto& handle = context->handles[handleId]; handle->userCount++; - if (pNpServiceName != nullptr && !EmulatorSettings::GetInstance()->IsPSNSignedIn()) { + if (pNpServiceName != nullptr && !EmulatorSettings.IsPSNSignedIn()) { // Seems sceNpManagerIntGetUserList fails? LOG_DEBUG(Lib_NpWebApi, "Cannot create extended push event while PSN is disabled"); handle->userCount--; diff --git a/src/core/libraries/np/trophy_ui.cpp b/src/core/libraries/np/trophy_ui.cpp index 3ccf29587..2ffaf615f 100644 --- a/src/core/libraries/np/trophy_ui.cpp +++ b/src/core/libraries/np/trophy_ui.cpp @@ -31,9 +31,9 @@ TrophyUI::TrophyUI(const std::filesystem::path& trophyIconPath, const std::strin const std::string_view& rarity) : trophy_name(trophyName), trophy_type(rarity) { - side = EmulatorSettings::GetInstance()->GetTrophyNotificationSide(); + side = EmulatorSettings.GetTrophyNotificationSide(); - trophy_timer = EmulatorSettings::GetInstance()->GetTrophyNotificationDuration(); + trophy_timer = EmulatorSettings.GetTrophyNotificationDuration(); if (std::filesystem::exists(trophyIconPath)) { trophy_icon = RefCountedTexture::DecodePngFile(trophyIconPath); @@ -94,7 +94,7 @@ TrophyUI::TrophyUI(const std::filesystem::path& trophyIconPath, const std::strin } MIX_SetMasterGain( - mixer, static_cast(EmulatorSettings::GetInstance()->GetVolumeSlider() / 100.f)); + mixer, static_cast(EmulatorSettings.GetVolumeSlider() / 100.f)); auto musicPathMp3 = CustomTrophy_Dir / "trophy.mp3"; auto musicPathWav = CustomTrophy_Dir / "trophy.wav"; @@ -280,7 +280,7 @@ void AddTrophyToQueue(const std::filesystem::path& trophyIconPath, const std::st const std::string_view& rarity) { std::lock_guard lock(queueMtx); - if (EmulatorSettings::GetInstance()->IsTrophyPopupDisabled()) { + if (EmulatorSettings.IsTrophyPopupDisabled()) { return; } else if (current_trophy_ui.has_value()) { current_trophy_ui.reset(); diff --git a/src/core/libraries/pad/pad.cpp b/src/core/libraries/pad/pad.cpp index 762cb6c7b..bb94d97a4 100644 --- a/src/core/libraries/pad/pad.cpp +++ b/src/core/libraries/pad/pad.cpp @@ -31,9 +31,9 @@ int PS4_SYSV_ABI scePadDeviceClassGetExtendedInformation( s32 handle, OrbisPadDeviceClassExtendedInformation* pExtInfo) { LOG_ERROR(Lib_Pad, "(STUBBED) called"); std::memset(pExtInfo, 0, sizeof(OrbisPadDeviceClassExtendedInformation)); - if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) { + if (EmulatorSettings.IsUsingSpecialPad()) { pExtInfo->deviceClass = - (OrbisPadDeviceClass)EmulatorSettings::GetInstance()->GetSpecialPadClass(); + (OrbisPadDeviceClass)EmulatorSettings.GetSpecialPadClass(); } return ORBIS_OK; } @@ -109,10 +109,10 @@ int PS4_SYSV_ABI scePadGetControllerInformation(s32 handle, OrbisPadControllerIn return ORBIS_OK; } pInfo->connected = true; - if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) { + if (EmulatorSettings.IsUsingSpecialPad()) { pInfo->connectionType = ORBIS_PAD_PORT_TYPE_SPECIAL; pInfo->deviceClass = - (OrbisPadDeviceClass)EmulatorSettings::GetInstance()->GetSpecialPadClass(); + (OrbisPadDeviceClass)EmulatorSettings.GetSpecialPadClass(); } return ORBIS_OK; } @@ -260,7 +260,7 @@ int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userI if (userId == -1) { return ORBIS_PAD_ERROR_DEVICE_NO_HANDLE; } - if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) { + if (EmulatorSettings.IsUsingSpecialPad()) { if (type != ORBIS_PAD_PORT_TYPE_SPECIAL) return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED; } else { @@ -277,7 +277,7 @@ int PS4_SYSV_ABI scePadOpen(Libraries::UserService::OrbisUserServiceUserId userI int PS4_SYSV_ABI scePadOpenExt(Libraries::UserService::OrbisUserServiceUserId userId, s32 type, s32 index, const OrbisPadOpenExtParam* pParam) { LOG_ERROR(Lib_Pad, "(STUBBED) called"); - if (EmulatorSettings::GetInstance()->IsUsingSpecialPad()) { + if (EmulatorSettings.IsUsingSpecialPad()) { if (type != ORBIS_PAD_PORT_TYPE_SPECIAL) return ORBIS_PAD_ERROR_DEVICE_NOT_CONNECTED; } else { diff --git a/src/core/libraries/save_data/save_instance.cpp b/src/core/libraries/save_data/save_instance.cpp index beb62a40e..6aa179cf9 100644 --- a/src/core/libraries/save_data/save_instance.cpp +++ b/src/core/libraries/save_data/save_instance.cpp @@ -48,13 +48,13 @@ namespace Libraries::SaveData { fs::path SaveInstance::MakeTitleSavePath(Libraries::UserService::OrbisUserServiceUserId user_id, std::string_view game_serial) { - return EmulatorSettings::GetInstance()->GetHomeDir() / std::to_string(user_id) / "savedata" / + return EmulatorSettings.GetHomeDir() / std::to_string(user_id) / "savedata" / game_serial; } fs::path SaveInstance::MakeDirSavePath(OrbisUserServiceUserId user_id, std::string_view game_serial, std::string_view dir_name) { - return EmulatorSettings::GetInstance()->GetHomeDir() / std::to_string(user_id) / "savedata" / + return EmulatorSettings.GetHomeDir() / std::to_string(user_id) / "savedata" / game_serial / dir_name; } @@ -73,7 +73,7 @@ fs::path SaveInstance::GetParamSFOPath(const fs::path& dir_path) { void SaveInstance::SetupDefaultParamSFO(PSF& param_sfo, std::string dir_name, std::string game_serial) { - int locale = EmulatorSettings::GetInstance()->GetConsoleLanguage(); + int locale = EmulatorSettings.GetConsoleLanguage(); if (!default_title.contains(locale)) { locale = 1; // default to en_US if not found } diff --git a/src/core/libraries/save_data/savedata.cpp b/src/core/libraries/save_data/savedata.cpp index 4aadef478..2714b3b58 100644 --- a/src/core/libraries/save_data/savedata.cpp +++ b/src/core/libraries/save_data/savedata.cpp @@ -439,7 +439,7 @@ static Error saveDataMount(const OrbisSaveDataMount2* mount_info, LOG_INFO(Lib_SaveData, "called with invalid block size"); } - const auto root_save = EmulatorSettings::GetInstance()->GetHomeDir() / + const auto root_save = EmulatorSettings.GetHomeDir() / std::to_string(mount_info->userId) / "savedata"; fs::create_directories(root_save); const auto available = fs::space(root_save).available; diff --git a/src/core/libraries/system/systemservice.cpp b/src/core/libraries/system/systemservice.cpp index 3964e576c..b9d0e5494 100644 --- a/src/core/libraries/system/systemservice.cpp +++ b/src/core/libraries/system/systemservice.cpp @@ -18,7 +18,7 @@ std::queue g_event_queue; std::mutex g_event_queue_mutex; bool IsSplashVisible() { - return EmulatorSettings::GetInstance()->IsShowSplash() && g_splash_status; + return EmulatorSettings.IsShowSplash() && g_splash_status; } int PS4_SYSV_ABI sceAppMessagingClearEventFlag() { @@ -1918,7 +1918,7 @@ s32 PS4_SYSV_ABI sceSystemServiceParamGetInt(OrbisSystemServiceParamId param_id, } switch (param_id) { case OrbisSystemServiceParamId::Lang: - *value = EmulatorSettings::GetInstance()->GetConsoleLanguage(); + *value = EmulatorSettings.GetConsoleLanguage(); break; case OrbisSystemServiceParamId::DateFormat: *value = u32(OrbisSystemParamDateFormat::FmtDDMMYYYY); diff --git a/src/core/libraries/system/userservice.cpp b/src/core/libraries/system/userservice.cpp index 8b0ba7bf9..5c36b472f 100644 --- a/src/core/libraries/system/userservice.cpp +++ b/src/core/libraries/system/userservice.cpp @@ -509,7 +509,7 @@ s32 PS4_SYSV_ABI sceUserServiceGetInitialUser(int* user_id) { LOG_ERROR(Lib_UserService, "user_id is null"); return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT; } - *user_id = EmulatorSettings::GetInstance()->GetUserManager().GetDefaultUser().user_id; + *user_id = UserManagement.GetDefaultUser().user_id; return ORBIS_OK; } @@ -589,7 +589,7 @@ s32 PS4_SYSV_ABI sceUserServiceGetLoginUserIdList(OrbisUserServiceLoginUserIdLis userIdList->user_id[i] = ORBIS_USER_SERVICE_USER_ID_INVALID; } - auto& user_manager = EmulatorSettings::GetInstance()->GetUserManager(); + auto& user_manager = UserManagement; std::vector all_users = user_manager.GetValidUsers(); @@ -1084,7 +1084,7 @@ s32 PS4_SYSV_ABI sceUserServiceGetUserColor(int user_id, OrbisUserServiceUserCol LOG_ERROR(Lib_UserService, "color is null"); return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT; } - *color = (OrbisUserServiceUserColor)EmulatorSettings::GetInstance() + *color = (OrbisUserServiceUserColor)EmulatorSettingsImpl::GetInstance() ->GetUserManager() .GetUserByID(user_id) ->user_color; @@ -1113,7 +1113,7 @@ s32 PS4_SYSV_ABI sceUserServiceGetUserName(int user_id, char* user_name, std::si return ORBIS_USER_SERVICE_ERROR_INVALID_ARGUMENT; } std::string name = "shadPS4"; - auto const* u = EmulatorSettings::GetInstance()->GetUserManager().GetUserByID(user_id); + auto const* u = UserManagement.GetUserByID(user_id); if (u != nullptr) { name = u->user_name; } else { diff --git a/src/core/libraries/usbd/usbd.cpp b/src/core/libraries/usbd/usbd.cpp index 5a9503c02..27a9d8293 100644 --- a/src/core/libraries/usbd/usbd.cpp +++ b/src/core/libraries/usbd/usbd.cpp @@ -457,7 +457,7 @@ int PS4_SYSV_ABI Func_D56B43060720B1E0() { } void RegisterLib(Core::Loader::SymbolsResolver* sym) { - switch (EmulatorSettings::GetInstance()->GetUsbDeviceBackend()) { + switch (EmulatorSettings.GetUsbDeviceBackend()) { case UsbBackendType::SkylandersPortal: usb_backend = std::make_shared(); break; diff --git a/src/core/libraries/videoout/driver.cpp b/src/core/libraries/videoout/driver.cpp index e1eb4a266..ae6c85ffa 100644 --- a/src/core/libraries/videoout/driver.cpp +++ b/src/core/libraries/videoout/driver.cpp @@ -269,7 +269,7 @@ void VideoOutDriver::SubmitFlipInternal(VideoOutPort* port, s32 index, s64 flip_ void VideoOutDriver::PresentThread(std::stop_token token) { const std::chrono::nanoseconds vblank_period( - 1000000000 / EmulatorSettings::GetInstance()->GetVblankFrequency()); + 1000000000 / EmulatorSettings.GetVblankFrequency()); Common::SetCurrentThreadName("shadPS4:PresentThread"); Common::SetCurrentThreadRealtime(vblank_period); diff --git a/src/core/libraries/videoout/video_out.cpp b/src/core/libraries/videoout/video_out.cpp index 506a28916..01ea36efd 100644 --- a/src/core/libraries/videoout/video_out.cpp +++ b/src/core/libraries/videoout/video_out.cpp @@ -456,8 +456,8 @@ s32 PS4_SYSV_ABI sceVideoOutSetWindowModeMargins(s32 handle, s32 top, s32 bottom void RegisterLib(Core::Loader::SymbolsResolver* sym) { driver = std::make_unique( - EmulatorSettings::GetInstance()->GetInternalScreenWidth(), - EmulatorSettings::GetInstance()->GetInternalScreenHeight()); + EmulatorSettings.GetInternalScreenWidth(), + EmulatorSettings.GetInternalScreenHeight()); LIB_FUNCTION("SbU3dwp80lQ", "libSceVideoOut", 1, "libSceVideoOut", sceVideoOutGetFlipStatus); LIB_FUNCTION("U46NwOiJpys", "libSceVideoOut", 1, "libSceVideoOut", sceVideoOutSubmitFlip); diff --git a/src/core/linker.cpp b/src/core/linker.cpp index 9640d3cb6..ac5133d16 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -56,7 +56,7 @@ Linker::Linker() : memory{Memory::Instance()} {} Linker::~Linker() = default; void Linker::Execute(const std::vector& args) { - if (EmulatorSettings::GetInstance()->IsDebugDump()) { + if (EmulatorSettings.IsDebugDump()) { DebugDump(); } diff --git a/src/core/memory.cpp b/src/core/memory.cpp index ca91d2341..596fe2ca8 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -37,10 +37,10 @@ void MemoryManager::SetupMemoryRegions(u64 flexible_size, bool use_extended_mem1 bool use_extended_mem2) { const bool is_neo = ::Libraries::Kernel::sceKernelIsNeoMode(); auto total_size = is_neo ? ORBIS_KERNEL_TOTAL_MEM_PRO : ORBIS_KERNEL_TOTAL_MEM; - if (EmulatorSettings::GetInstance()->IsDevKit()) { + if (EmulatorSettings.IsDevKit()) { total_size = is_neo ? ORBIS_KERNEL_TOTAL_MEM_DEV_PRO : ORBIS_KERNEL_TOTAL_MEM_DEV; } - s32 extra_dmem = EmulatorSettings::GetInstance()->GetExtraDmemInMBytes(); + s32 extra_dmem = EmulatorSettings.GetExtraDmemInMBytes(); if (extra_dmem != 0) { LOG_WARNING(Kernel_Vmm, "extraDmemInMbytes is {} MB! Old Direct Size: {:#x} -> New Direct Size: {:#x}", diff --git a/src/core/module.h b/src/core/module.h index ec59a8cce..6d720e11f 100644 --- a/src/core/module.h +++ b/src/core/module.h @@ -166,7 +166,7 @@ public: } bool IsSystemLib() { - auto system_path = EmulatorSettings::GetInstance()->GetSysModulesDir(); + auto system_path = EmulatorSettings.GetSysModulesDir(); if (file.string().starts_with(system_path.string().c_str())) { return true; } diff --git a/src/core/user_manager.cpp b/src/core/user_manager.cpp index f237e4236..02b2eddbd 100644 --- a/src/core/user_manager.cpp +++ b/src/core/user_manager.cpp @@ -17,7 +17,7 @@ bool UserManager::AddUser(const User& user) { // Create user home directory and subfolders const auto user_dir = - EmulatorSettings::GetInstance()->GetHomeDir() / std::to_string(user.user_id); + EmulatorSettings.GetHomeDir() / std::to_string(user.user_id); std::error_code ec; if (!std::filesystem::exists(user_dir)) { @@ -36,7 +36,7 @@ bool UserManager::RemoveUser(s32 user_id) { if (it == m_users.user.end()) return false; // not found - const auto user_dir = EmulatorSettings::GetInstance()->GetHomeDir() / std::to_string(user_id); + const auto user_dir = EmulatorSettings.GetHomeDir() / std::to_string(user_id); if (std::filesystem::exists(user_dir)) { std::error_code ec; @@ -81,7 +81,7 @@ std::vector UserManager::CreateDefaultUser() { default_user.controller_port = 1; const auto user_dir = - EmulatorSettings::GetInstance()->GetHomeDir() / std::to_string(default_user.user_id); + EmulatorSettings.GetHomeDir() / std::to_string(default_user.user_id); if (!std::filesystem::exists(user_dir)) { std::filesystem::create_directory(user_dir); @@ -121,7 +121,7 @@ std::vector UserManager::GetValidUsers() const { std::vector result; result.reserve(m_users.user.size()); - const auto home_dir = EmulatorSettings::GetInstance()->GetHomeDir(); + const auto home_dir = EmulatorSettings.GetHomeDir(); for (const auto& user : m_users.user) { const auto user_dir = home_dir / std::to_string(user.user_id); diff --git a/src/core/user_manager.h b/src/core/user_manager.h index 9285ac2c2..be9f3cbab 100644 --- a/src/core/user_manager.h +++ b/src/core/user_manager.h @@ -7,6 +7,8 @@ #include #include "common/types.h" +#define UserManagement EmulatorSettings.GetUserManager() + struct User { s32 user_id; u32 user_color; diff --git a/src/emulator.cpp b/src/emulator.cpp index cc1ae8d12..c8ae8d5eb 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -205,10 +205,10 @@ void Emulator::Run(std::filesystem::path file, std::vector args, game_info.game_folder = game_folder; - EmulatorSettings::GetInstance()->Load(id); + EmulatorSettings.Load(id); // Initialize logging as soon as possible - if (!id.empty() && EmulatorSettings::GetInstance()->IsSeparateLoggingEnabled()) { + if (!id.empty() && EmulatorSettings.IsSeparateLoggingEnabled()) { Common::Log::Initialize(id + ".log"); } else { Common::Log::Initialize(); @@ -229,46 +229,32 @@ void Emulator::Run(std::filesystem::path file, std::vector args, LOG_INFO(Config, "Game-specific config used: {}", EmulatorState::GetInstance()->IsGameSpecifigConfigUsed()); - LOG_INFO(Config, "General LogType: {}", EmulatorSettings::GetInstance()->GetLogType()); - LOG_INFO(Config, "General isIdenticalLogGrouped: {}", - EmulatorSettings::GetInstance()->IsIdenticalLogGrouped()); - LOG_INFO(Config, "General isNeo: {}", EmulatorSettings::GetInstance()->IsNeo()); - LOG_INFO(Config, "General isDevKit: {}", EmulatorSettings::GetInstance()->IsDevKit()); - LOG_INFO(Config, "General isConnectedToNetwork: {}", - EmulatorSettings::GetInstance()->IsConnectedToNetwork()); - LOG_INFO(Config, "General isPsnSignedIn: {}", EmulatorSettings::GetInstance()->IsPSNSignedIn()); - LOG_INFO(Config, "GPU isNullGpu: {}", EmulatorSettings::GetInstance()->IsNullGPU()); - LOG_INFO(Config, "GPU readbacksMode: {}", EmulatorSettings::GetInstance()->GetReadbacksMode()); + LOG_INFO(Config, "General LogType: {}", EmulatorSettings.GetLogType()); + LOG_INFO(Config, "General isIdenticalLogGrouped: {}", EmulatorSettings.IsIdenticalLogGrouped()); + LOG_INFO(Config, "General isNeo: {}", EmulatorSettings.IsNeo()); + LOG_INFO(Config, "General isDevKit: {}", EmulatorSettings.IsDevKit()); + LOG_INFO(Config, "General isConnectedToNetwork: {}", EmulatorSettings.IsConnectedToNetwork()); + LOG_INFO(Config, "General isPsnSignedIn: {}", EmulatorSettings.IsPSNSignedIn()); + LOG_INFO(Config, "GPU isNullGpu: {}", EmulatorSettings.IsNullGPU()); + LOG_INFO(Config, "GPU readbacksMode: {}", EmulatorSettings.GetReadbacksMode()); LOG_INFO(Config, "GPU readbackLinearImages: {}", - EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled()); - LOG_INFO(Config, "GPU directMemoryAccess: {}", - EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()); - LOG_INFO(Config, "GPU shouldDumpShaders: {}", EmulatorSettings::GetInstance()->IsDumpShaders()); - LOG_INFO(Config, "GPU vblankFrequency: {}", - EmulatorSettings::GetInstance()->GetVblankFrequency()); - LOG_INFO(Config, "GPU shouldCopyGPUBuffers: {}", - EmulatorSettings::GetInstance()->IsCopyGpuBuffers()); - LOG_INFO(Config, "Vulkan gpuId: {}", EmulatorSettings::GetInstance()->GetGpuId()); - LOG_INFO(Config, "Vulkan vkValidation: {}", - EmulatorSettings::GetInstance()->IsVkValidationEnabled()); - LOG_INFO(Config, "Vulkan vkValidationCore: {}", - EmulatorSettings::GetInstance()->IsVkValidationCoreEnabled()); - LOG_INFO(Config, "Vulkan vkValidationSync: {}", - EmulatorSettings::GetInstance()->IsVkValidationSyncEnabled()); - LOG_INFO(Config, "Vulkan vkValidationGpu: {}", - EmulatorSettings::GetInstance()->IsVkValidationGpuEnabled()); - LOG_INFO(Config, "Vulkan crashDiagnostics: {}", - EmulatorSettings::GetInstance()->IsVkCrashDiagnosticEnabled()); - LOG_INFO(Config, "Vulkan hostMarkers: {}", - EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()); - LOG_INFO(Config, "Vulkan guestMarkers: {}", - EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled()); - LOG_INFO(Config, "Vulkan rdocEnable: {}", - EmulatorSettings::GetInstance()->IsRenderdocEnabled()); - LOG_INFO(Config, "Vulkan PipelineCacheEnabled: {}", - EmulatorSettings::GetInstance()->IsPipelineCacheEnabled()); + EmulatorSettings.IsReadbackLinearImagesEnabled()); + LOG_INFO(Config, "GPU directMemoryAccess: {}", EmulatorSettings.IsDirectMemoryAccessEnabled()); + LOG_INFO(Config, "GPU shouldDumpShaders: {}", EmulatorSettings.IsDumpShaders()); + LOG_INFO(Config, "GPU vblankFrequency: {}", EmulatorSettings.GetVblankFrequency()); + LOG_INFO(Config, "GPU shouldCopyGPUBuffers: {}", EmulatorSettings.IsCopyGpuBuffers()); + LOG_INFO(Config, "Vulkan gpuId: {}", EmulatorSettings.GetGpuId()); + LOG_INFO(Config, "Vulkan vkValidation: {}", EmulatorSettings.IsVkValidationEnabled()); + LOG_INFO(Config, "Vulkan vkValidationCore: {}", EmulatorSettings.IsVkValidationCoreEnabled()); + LOG_INFO(Config, "Vulkan vkValidationSync: {}", EmulatorSettings.IsVkValidationSyncEnabled()); + LOG_INFO(Config, "Vulkan vkValidationGpu: {}", EmulatorSettings.IsVkValidationGpuEnabled()); + LOG_INFO(Config, "Vulkan crashDiagnostics: {}", EmulatorSettings.IsVkCrashDiagnosticEnabled()); + LOG_INFO(Config, "Vulkan hostMarkers: {}", EmulatorSettings.IsVkHostMarkersEnabled()); + LOG_INFO(Config, "Vulkan guestMarkers: {}", EmulatorSettings.IsVkGuestMarkersEnabled()); + LOG_INFO(Config, "Vulkan rdocEnable: {}", EmulatorSettings.IsRenderdocEnabled()); + LOG_INFO(Config, "Vulkan PipelineCacheEnabled: {}", EmulatorSettings.IsPipelineCacheEnabled()); LOG_INFO(Config, "Vulkan PipelineCacheArchived: {}", - EmulatorSettings::GetInstance()->IsPipelineCacheArchived()); + EmulatorSettings.IsPipelineCacheArchived()); hwinfo::Memory ram; hwinfo::OS os; @@ -345,9 +331,9 @@ void Emulator::Run(std::filesystem::path file, std::vector args, Common::g_scm_branch, Common::g_scm_desc, game_title); } } - window = std::make_unique( - EmulatorSettings::GetInstance()->GetWindowWidth(), - EmulatorSettings::GetInstance()->GetWindowHeight(), controllers, window_title); + window = std::make_unique(EmulatorSettings.GetWindowWidth(), + EmulatorSettings.GetWindowHeight(), controllers, + window_title); g_window = window.get(); @@ -378,7 +364,7 @@ void Emulator::Run(std::filesystem::path file, std::vector args, VideoCore::SetOutputDir(mount_captures_dir, id); // Mount system fonts - const auto& fonts_dir = EmulatorSettings::GetInstance()->GetFontsDir(); + const auto& fonts_dir = EmulatorSettings.GetFontsDir(); if (!std::filesystem::exists(fonts_dir)) { std::filesystem::create_directory(fonts_dir); } @@ -428,7 +414,7 @@ void Emulator::Run(std::filesystem::path file, std::vector args, #ifdef ENABLE_DISCORD_RPC // Discord RPC - if (EmulatorSettings::GetInstance()->IsDiscordRPCEnabled()) { + if (EmulatorSettings.IsDiscordRPCEnabled()) { auto* rpc = Common::Singleton::Instance(); if (rpc->getRPCEnabled() == false) { rpc->init(); @@ -584,7 +570,7 @@ void Emulator::LoadSystemModules(const std::string& game_serial) { {"libSceFreeTypeOt.sprx", nullptr}}); std::vector found_modules; - const auto& sys_module_path = EmulatorSettings::GetInstance()->GetSysModulesDir(); + const auto& sys_module_path = EmulatorSettings.GetSysModulesDir(); for (const auto& entry : std::filesystem::directory_iterator(sys_module_path)) { found_modules.push_back(entry.path()); } diff --git a/src/imgui/renderer/imgui_core.cpp b/src/imgui/renderer/imgui_core.cpp index 0b8ce074c..9d191a135 100644 --- a/src/imgui/renderer/imgui_core.cpp +++ b/src/imgui/renderer/imgui_core.cpp @@ -218,7 +218,7 @@ void Render(const vk::CommandBuffer& cmdbuf, const vk::ImageView& image_view, if (draw_data->CmdListsCount == 0) { return; } - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ .pLabelName = "ImGui Render", }); @@ -243,7 +243,7 @@ void Render(const vk::CommandBuffer& cmdbuf, const vk::ImageView& image_view, cmdbuf.beginRendering(render_info); Vulkan::RenderDrawData(*draw_data, cmdbuf); cmdbuf.endRendering(); - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.endDebugUtilsLabelEXT(); } } diff --git a/src/imgui/renderer/imgui_impl_sdl3.cpp b/src/imgui/renderer/imgui_impl_sdl3.cpp index 1e9c1e338..682afd758 100644 --- a/src/imgui/renderer/imgui_impl_sdl3.cpp +++ b/src/imgui/renderer/imgui_impl_sdl3.cpp @@ -396,7 +396,7 @@ bool ProcessEvent(const SDL_Event* event) { if (mouse_pos.x != bd->prev_mouse_pos.x || mouse_pos.y != bd->prev_mouse_pos.y) { bd->prev_mouse_pos.x = mouse_pos.x; bd->prev_mouse_pos.y = mouse_pos.y; - if (EmulatorSettings::GetInstance()->GetCursorState() == HideCursorState::Idle) { + if (EmulatorSettings.GetCursorState() == HideCursorState::Idle) { bd->lastCursorMoveTime = bd->time; } } @@ -656,7 +656,7 @@ static void UpdateMouseCursor() { return; SdlData* bd = GetBackendData(); - s16 cursorState = EmulatorSettings::GetInstance()->GetCursorState(); + s16 cursorState = EmulatorSettings.GetCursorState(); ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor(); if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None || cursorState == HideCursorState::Always) { @@ -665,7 +665,7 @@ static void UpdateMouseCursor() { } else if (cursorState == HideCursorState::Idle && bd->time - bd->lastCursorMoveTime >= - EmulatorSettings::GetInstance()->GetCursorHideTimeout() * + EmulatorSettings.GetCursorHideTimeout() * SDL_GetPerformanceFrequency()) { bool wasCursorVisible = SDL_CursorVisible(); diff --git a/src/imgui/renderer/texture_manager.cpp b/src/imgui/renderer/texture_manager.cpp index 56f12f44c..f8ac04352 100644 --- a/src/imgui/renderer/texture_manager.cpp +++ b/src/imgui/renderer/texture_manager.cpp @@ -152,7 +152,7 @@ void WorkerLoop() { g_job_list.pop_front(); g_job_list_mtx.unlock(); - if (EmulatorSettings::GetInstance()->IsVkCrashDiagnosticEnabled()) { + if (EmulatorSettings.IsVkCrashDiagnosticEnabled()) { // FIXME: Crash diagnostic hangs when building the command buffer here continue; } diff --git a/src/input/controller.cpp b/src/input/controller.cpp index e2625967f..19d4ae1e0 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -269,7 +269,7 @@ void GameControllers::TryOpenSDLControllers(GameControllers& controllers) { slot_taken[i] = true; c->player_index = i; AddUserServiceEvent({OrbisUserServiceEventType::Login, i + 1}); - if (EmulatorSettings::GetInstance()->IsMotionControlsEnabled()) { + if (EmulatorSettings.IsMotionControlsEnabled()) { if (SDL_SetGamepadSensorEnabled(c->m_sdl_gamepad, SDL_SENSOR_GYRO, true)) { c->gyro_poll_rate = SDL_GetGamepadSensorDataRate(c->m_sdl_gamepad, SDL_SENSOR_GYRO); @@ -369,11 +369,11 @@ namespace GamepadSelect { int GetDefaultGamepad(SDL_JoystickID* gamepadIDs, int gamepadCount) { char GUIDbuf[33]; - if (EmulatorSettings::GetInstance()->GetDefaultControllerId() != "") { + if (EmulatorSettings.GetDefaultControllerId() != "") { for (int i = 0; i < gamepadCount; i++) { SDL_GUIDToString(SDL_GetGamepadGUIDForID(gamepadIDs[i]), GUIDbuf, 33); std::string currentGUID = std::string(GUIDbuf); - if (currentGUID == EmulatorSettings::GetInstance()->GetDefaultControllerId()) { + if (currentGUID == EmulatorSettings.GetDefaultControllerId()) { return i; } } diff --git a/src/input/input_handler.cpp b/src/input/input_handler.cpp index 74bee3fc3..689d3db53 100644 --- a/src/input/input_handler.cpp +++ b/src/input/input_handler.cpp @@ -338,7 +338,7 @@ std::optional parseInt(const std::string& s) { void ParseInputConfig(const std::string game_id = "") { std::string game_id_or_default = - EmulatorSettings::GetInstance()->IsUseUnifiedInputConfig() ? "default" : game_id; + EmulatorSettings.IsUseUnifiedInputConfig() ? "default" : game_id; const auto config_file = GetInputConfigFile(game_id_or_default); const auto global_config_file = GetInputConfigFile("global"); @@ -767,13 +767,13 @@ void ControllerOutput::FinalizeUpdate(u8 gamepad_index) { PushSDLEvent(SDL_EVENT_REMOVE_VIRTUAL_USER); break; case HOTKEY_VOLUME_UP: - EmulatorSettings::GetInstance()->SetVolumeSlider( - std::clamp(EmulatorSettings::GetInstance()->GetVolumeSlider() + 10, 0, 500)); + EmulatorSettings.SetVolumeSlider( + std::clamp(EmulatorSettings.GetVolumeSlider() + 10, 0, 500)); Overlay::ShowVolume(); break; case HOTKEY_VOLUME_DOWN: - EmulatorSettings::GetInstance()->SetVolumeSlider( - std::clamp(EmulatorSettings::GetInstance()->GetVolumeSlider() - 10, 0, 500)); + EmulatorSettings.SetVolumeSlider( + std::clamp(EmulatorSettings.GetVolumeSlider() - 10, 0, 500)); Overlay::ShowVolume(); break; case HOTKEY_QUIT: diff --git a/src/main.cpp b/src/main.cpp index 284b2e9d3..21697d85f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,8 +35,8 @@ int main(int argc, char* argv[]) { std::shared_ptr m_emu_state = std::make_shared(); EmulatorState::SetInstance(m_emu_state); // Load configurations - std::shared_ptr emu_settings = std::make_shared(); - EmulatorSettings::SetInstance(emu_settings); + std::shared_ptr emu_settings = std::make_shared(); + EmulatorSettingsImpl::SetInstance(emu_settings); emu_settings->Load(); // TODO add back trophy key migration without the need of entire previous config framework @@ -110,15 +110,15 @@ int main(int argc, char* argv[]) { // ---- Utility commands ---- if (addGameFolder) { - EmulatorSettings::GetInstance()->AddGameInstallDir(*addGameFolder); - EmulatorSettings::GetInstance()->Save(); + EmulatorSettings.AddGameInstallDir(*addGameFolder); + EmulatorSettings.Save(); std::cout << "Game folder successfully saved.\n"; return 0; } if (setAddonFolder) { - EmulatorSettings::GetInstance()->SetAddonInstallDir(*setAddonFolder); - EmulatorSettings::GetInstance()->Save(); + EmulatorSettings.SetAddonInstallDir(*setAddonFolder); + EmulatorSettings.Save(); std::cout << "Addon folder successfully saved.\n"; return 0; } @@ -142,9 +142,9 @@ int main(int argc, char* argv[]) { if (fullscreenStr) { if (*fullscreenStr == "true") { - EmulatorSettings::GetInstance()->SetFullScreen(true); + EmulatorSettings.SetFullScreen(true); } else if (*fullscreenStr == "false") { - EmulatorSettings::GetInstance()->SetFullScreen(false); + EmulatorSettings.SetFullScreen(false); } else { std::cerr << "Error: Invalid argument for --fullscreen (use true|false)\n"; return 1; @@ -152,13 +152,13 @@ int main(int argc, char* argv[]) { } if (showFps) - EmulatorSettings::GetInstance()->SetShowFpsCounter(true); + EmulatorSettings.SetShowFpsCounter(true); if (configClean) - EmulatorSettings::GetInstance()->SetConfigMode(ConfigMode::Clean); + EmulatorSettings.SetConfigMode(ConfigMode::Clean); if (configGlobal) - EmulatorSettings::GetInstance()->SetConfigMode(ConfigMode::Global); + EmulatorSettings.SetConfigMode(ConfigMode::Global); if (logAppend) Common::Log::SetAppend(); @@ -168,7 +168,7 @@ int main(int argc, char* argv[]) { if (!std::filesystem::exists(ebootPath)) { bool found = false; constexpr int maxDepth = 5; - for (const auto& installDir : EmulatorSettings::GetInstance()->GetGameInstallDirs()) { + for (const auto& installDir : EmulatorSettings.GetGameInstallDirs()) { if (auto foundPath = Common::FS::FindGameByID(installDir, *gamePath, maxDepth)) { ebootPath = *foundPath; found = true; diff --git a/src/sdl_window.cpp b/src/sdl_window.cpp index 7272c0c0b..80ee219e2 100644 --- a/src/sdl_window.cpp +++ b/src/sdl_window.cpp @@ -117,12 +117,12 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameControllers* controller error = true; } if (!error) { - SDL_SetWindowFullscreenMode(window, EmulatorSettings::GetInstance()->GetFullScreenMode() == + SDL_SetWindowFullscreenMode(window, EmulatorSettings.GetFullScreenMode() == "Fullscreen" ? displayMode : NULL); } - SDL_SetWindowFullscreen(window, EmulatorSettings::GetInstance()->IsFullScreen()); + SDL_SetWindowFullscreen(window, EmulatorSettings.IsFullScreen()); SDL_InitSubSystem(SDL_INIT_GAMEPAD); @@ -153,7 +153,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameControllers* controller Input::ParseInputConfig(std::string(Common::ElfInfo::Instance().GameSerial())); Input::GameControllers::TryOpenSDLControllers(controllers); - if (EmulatorSettings::GetInstance()->IsBackgroundControllerInput()) { + if (EmulatorSettings.IsBackgroundControllerInput()) { SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); } } diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index bc3faf6f9..81f8d08d7 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp @@ -58,7 +58,7 @@ Id EmitGetUserData(EmitContext& ctx, IR::ScalarReg reg) { Id EmitReadConst(EmitContext& ctx, IR::Inst* inst, Id addr, Id offset) { const u32 flatbuf_off_dw = inst->Flags(); - if (!EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()) { + if (!EmulatorSettings.IsDirectMemoryAccessEnabled()) { return ctx.EmitFlatbufferLoad(ctx.ConstU32(flatbuf_off_dw)); } // We can only provide a fallback for immediate offsets. diff --git a/src/shader_recompiler/frontend/translate/translate.cpp b/src/shader_recompiler/frontend/translate/translate.cpp index 6627b035f..0489a5d88 100644 --- a/src/shader_recompiler/frontend/translate/translate.cpp +++ b/src/shader_recompiler/frontend/translate/translate.cpp @@ -552,7 +552,7 @@ void Translator::EmitFetch(const GcnInst& inst) { const auto fetch_data = ParseFetchShader(info); ASSERT(fetch_data.has_value()); - if (EmulatorSettings::GetInstance()->IsDumpShaders()) { + if (EmulatorSettings.IsDumpShaders()) { using namespace Common::FS; const auto dump_dir = GetUserPath(PathType::ShaderDir) / "dumps"; if (!std::filesystem::exists(dump_dir)) { diff --git a/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp b/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp index ec2df6e4f..a23ee2319 100644 --- a/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp +++ b/src/shader_recompiler/ir/passes/flatten_extended_userdata_pass.cpp @@ -228,7 +228,7 @@ static void GenerateSrtProgram(Info& info, PassInfo& pass_info) { info.srt_info.walker_func_size = c.getCurr() - reinterpret_cast(info.srt_info.walker_func); - if (EmulatorSettings::GetInstance()->IsDumpShaders()) { + if (EmulatorSettings.IsDumpShaders()) { DumpSrtProgram(info, reinterpret_cast(info.srt_info.walker_func), info.srt_info.walker_func_size); } diff --git a/src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp b/src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp index c8ab6086f..e26d3f078 100644 --- a/src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp +++ b/src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp @@ -176,7 +176,7 @@ void CollectShaderInfoPass(IR::Program& program, const Profile& profile) { // info.readconst_types |= Info::ReadConstType::Immediate; } - if (!EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()) { + if (!EmulatorSettings.IsDirectMemoryAccessEnabled()) { info.uses_dma = false; info.readconst_types = Info::ReadConstType::None; } diff --git a/src/shader_recompiler/ir/program.cpp b/src/shader_recompiler/ir/program.cpp index 018b7ac4e..926f8f29d 100644 --- a/src/shader_recompiler/ir/program.cpp +++ b/src/shader_recompiler/ir/program.cpp @@ -19,7 +19,7 @@ namespace Shader::IR { void DumpProgram(const Program& program, const Info& info, const std::string& type) { using namespace Common::FS; - if (!EmulatorSettings::GetInstance()->IsDumpShaders()) { + if (!EmulatorSettings.IsDumpShaders()) { return; } diff --git a/src/video_core/amdgpu/liverpool.cpp b/src/video_core/amdgpu/liverpool.cpp index 9560535e5..8446e37b0 100644 --- a/src/video_core/amdgpu/liverpool.cpp +++ b/src/video_core/amdgpu/liverpool.cpp @@ -230,9 +230,9 @@ Liverpool::Task Liverpool::ProcessGraphics(std::span dcb, std::spanIsVkHostMarkersEnabled(); + rasterizer && EmulatorSettings.IsVkHostMarkersEnabled(); const bool guest_markers_enabled = - rasterizer && EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled(); + rasterizer && EmulatorSettings.IsVkGuestMarkersEnabled(); const auto base_addr = reinterpret_cast(dcb.data()); while (!dcb.empty()) { @@ -902,7 +902,7 @@ Liverpool::Task Liverpool::ProcessCompute(std::span acb, u32 vqid) { FIBER_ENTER(acb_task_name[vqid]); auto& queue = asc_queues[{vqid}]; const bool host_markers_enabled = - rasterizer && EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled(); + rasterizer && EmulatorSettings.IsVkHostMarkersEnabled(); struct IndirectPatch { const PM4Header* header; @@ -1205,7 +1205,7 @@ Liverpool::CmdBuffer Liverpool::CopyCmdBuffers(std::span dcb, std::sp void Liverpool::SubmitGfx(std::span dcb, std::span ccb) { auto& queue = mapped_queues[GfxQueueId]; - if (EmulatorSettings::GetInstance()->IsCopyGpuBuffers()) { + if (EmulatorSettings.IsCopyGpuBuffers()) { std::tie(dcb, ccb) = CopyCmdBuffers(dcb, ccb); } diff --git a/src/video_core/buffer_cache/memory_tracker.h b/src/video_core/buffer_cache/memory_tracker.h index fddaf1d80..9a74c3c7e 100644 --- a/src/video_core/buffer_cache/memory_tracker.h +++ b/src/video_core/buffer_cache/memory_tracker.h @@ -74,7 +74,7 @@ public: // modified. If we need to flush the flush function is going to perform CPU // state change. std::scoped_lock lk{manager->lock}; - if (EmulatorSettings::GetInstance()->GetReadbacksMode() != + if (EmulatorSettings.GetReadbacksMode() != GpuReadbacksMode::Disabled && manager->template IsRegionModified(offset, size)) { return true; diff --git a/src/video_core/buffer_cache/region_manager.h b/src/video_core/buffer_cache/region_manager.h index 316dad7f3..104fd721a 100644 --- a/src/video_core/buffer_cache/region_manager.h +++ b/src/video_core/buffer_cache/region_manager.h @@ -95,7 +95,7 @@ public: } if constexpr (type == Type::CPU) { UpdateProtection(); - } else if (EmulatorSettings::GetInstance()->GetReadbacksMode() == + } else if (EmulatorSettings.GetReadbacksMode() == GpuReadbacksMode::Precise) { UpdateProtection(); } @@ -127,7 +127,7 @@ public: bits.UnsetRange(start_page, end_page); if constexpr (type == Type::CPU) { UpdateProtection(); - } else if (EmulatorSettings::GetInstance()->GetReadbacksMode() != + } else if (EmulatorSettings.GetReadbacksMode() != GpuReadbacksMode::Disabled) { UpdateProtection(); } diff --git a/src/video_core/cache_storage.cpp b/src/video_core/cache_storage.cpp index 906f99623..7117737fa 100644 --- a/src/video_core/cache_storage.cpp +++ b/src/video_core/cache_storage.cpp @@ -95,7 +95,7 @@ void DataBase::Open() { const auto& game_info = Common::ElfInfo::Instance(); using namespace Common::FS; - if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) { + if (EmulatorSettings.IsPipelineCacheArchived()) { mz_zip_zero_struct(&zip_ar); cache_path = GetUserPath(PathType::CacheDir) / @@ -128,7 +128,7 @@ void DataBase::Close() { io_worker.request_stop(); io_worker.join(); - if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) { + if (EmulatorSettings.IsPipelineCacheArchived()) { mz_zip_writer_finalize_archive(&zip_ar); mz_zip_writer_end(&zip_ar); } @@ -142,7 +142,7 @@ bool WriteVector(const BlobType type, std::filesystem::path&& path_, std::vector auto request = std::packaged_task{[=]() { auto path{path_}; path.replace_extension(GetBlobFileExtension(type)); - if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) { + if (EmulatorSettings.IsPipelineCacheArchived()) { ASSERT_MSG(!ar_is_read_only, "The archive is read-only. Did you forget to call `FinishPreload`?"); if (!mz_zip_writer_add_mem(&zip_ar, path.string().c_str(), v.data(), @@ -169,7 +169,7 @@ template void LoadVector(BlobType type, std::filesystem::path& path, std::vector& v) { using namespace Common::FS; path.replace_extension(GetBlobFileExtension(type)); - if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) { + if (EmulatorSettings.IsPipelineCacheArchived()) { int index{-1}; index = mz_zip_reader_locate_file(&zip_ar, path.string().c_str(), nullptr, 0); if (index < 0) { @@ -192,7 +192,7 @@ bool DataBase::Save(BlobType type, const std::string& name, std::vector&& da return false; } - auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived() + auto path = EmulatorSettings.IsPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name; return WriteVector(type, std::move(path), std::move(data)); @@ -203,7 +203,7 @@ bool DataBase::Save(BlobType type, const std::string& name, std::vector&& d return false; } - auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived() + auto path = EmulatorSettings.IsPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name; return WriteVector(type, std::move(path), std::move(data)); @@ -214,7 +214,7 @@ void DataBase::Load(BlobType type, const std::string& name, std::vector& dat return; } - auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived() + auto path = EmulatorSettings.IsPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name; return LoadVector(type, path, data); @@ -225,7 +225,7 @@ void DataBase::Load(BlobType type, const std::string& name, std::vector& da return; } - auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived() + auto path = EmulatorSettings.IsPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name; return LoadVector(type, path, data); @@ -233,7 +233,7 @@ void DataBase::Load(BlobType type, const std::string& name, std::vector& da void DataBase::ForEachBlob(BlobType type, const std::function&& data)>& func) { const auto& ext = GetBlobFileExtension(type); - if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) { + if (EmulatorSettings.IsPipelineCacheArchived()) { const auto num_files = mz_zip_reader_get_num_files(&zip_ar); for (int index = 0; index < num_files; ++index) { std::array file_name{}; @@ -263,7 +263,7 @@ void DataBase::ForEachBlob(BlobType type, const std::functionIsPipelineCacheArchived()) { + if (EmulatorSettings.IsPipelineCacheArchived()) { mz_zip_writer_init_from_reader(&zip_ar, cache_path.string().c_str()); ar_is_read_only = false; } diff --git a/src/video_core/renderdoc.cpp b/src/video_core/renderdoc.cpp index bd4818f48..b02752212 100644 --- a/src/video_core/renderdoc.cpp +++ b/src/video_core/renderdoc.cpp @@ -31,7 +31,7 @@ void LoadRenderDoc() { // Check if we are running by RDoc GUI HMODULE mod = GetModuleHandleA("renderdoc.dll"); - if (!mod && EmulatorSettings::GetInstance()->IsRenderdocEnabled()) { + if (!mod && EmulatorSettings.IsRenderdocEnabled()) { // If enabled in config, try to load RDoc runtime in offline mode HKEY h_reg_key; LONG result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -67,7 +67,7 @@ void LoadRenderDoc() { #endif // Check if we are running by RDoc GUI void* mod = dlopen(RENDERDOC_LIB, RTLD_NOW | RTLD_NOLOAD); - if (!mod && EmulatorSettings::GetInstance()->IsRenderdocEnabled()) { + if (!mod && EmulatorSettings.IsRenderdocEnabled()) { // If enabled in config, try to load RDoc runtime in offline mode if ((mod = dlopen(RENDERDOC_LIB, RTLD_NOW))) { const auto RENDERDOC_GetAPI = diff --git a/src/video_core/renderer_vulkan/host_passes/fsr_pass.cpp b/src/video_core/renderer_vulkan/host_passes/fsr_pass.cpp index a001fe94b..bf7828491 100644 --- a/src/video_core/renderer_vulkan/host_passes/fsr_pass.cpp +++ b/src/video_core/renderer_vulkan/host_passes/fsr_pass.cpp @@ -164,7 +164,7 @@ vk::ImageView FsrPass::Render(vk::CommandBuffer cmdbuf, vk::ImageView input, CreateImages(img); } - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ .pLabelName = "Host/FSR", }); @@ -387,7 +387,7 @@ vk::ImageView FsrPass::Render(vk::CommandBuffer cmdbuf, vk::ImageView input, .pImageMemoryBarriers = return_barrier.data(), }); - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.endDebugUtilsLabelEXT(); } diff --git a/src/video_core/renderer_vulkan/host_passes/pp_pass.cpp b/src/video_core/renderer_vulkan/host_passes/pp_pass.cpp index ec8d44e0c..4b073c5fe 100644 --- a/src/video_core/renderer_vulkan/host_passes/pp_pass.cpp +++ b/src/video_core/renderer_vulkan/host_passes/pp_pass.cpp @@ -188,7 +188,7 @@ void PostProcessingPass::Create(vk::Device device, const vk::Format surface_form void PostProcessingPass::Render(vk::CommandBuffer cmdbuf, vk::ImageView input, vk::Extent2D input_size, Frame& frame, Settings settings) { - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ .pLabelName = "Host/Post processing", }); @@ -279,7 +279,7 @@ void PostProcessingPass::Render(vk::CommandBuffer cmdbuf, vk::ImageView input, .pImageMemoryBarriers = &post_barrier, }); - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.endDebugUtilsLabelEXT(); } } diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index 6b1c6475c..e39464822 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp @@ -300,7 +300,7 @@ const GraphicsPipeline* PipelineCache::GetGraphicsPipeline() { RegisterPipelineData(graphics_key, pipeline_hash, sdata); ++num_new_pipelines; - if (EmulatorSettings::GetInstance()->IsShaderCollect()) { + if (EmulatorSettings.IsShaderCollect()) { for (auto stage = 0; stage < MaxShaderStages; ++stage) { if (infos[stage]) { auto& m = modules[stage]; @@ -329,7 +329,7 @@ const ComputePipeline* PipelineCache::GetComputePipeline() { RegisterPipelineData(compute_key, sdata); ++num_new_pipelines; - if (EmulatorSettings::GetInstance()->IsShaderCollect()) { + if (EmulatorSettings.IsShaderCollect()) { auto& m = modules[0]; module_related_pipelines[m].emplace_back(compute_key); } @@ -554,7 +554,7 @@ vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::Runtim vk::ShaderModule module; auto patch = GetShaderPatch(info.pgm_hash, info.stage, perm_idx, "spv"); - const bool is_patched = patch && EmulatorSettings::GetInstance()->IsPatchShaders(); + const bool is_patched = patch && EmulatorSettings.IsPatchShaders(); if (is_patched) { LOG_INFO(Loader, "Loaded patch for {} shader {:#x}", info.stage, info.pgm_hash); module = CompileSPV(*patch, instance.GetDevice()); @@ -566,7 +566,7 @@ vk::ShaderModule PipelineCache::CompileModule(Shader::Info& info, Shader::Runtim const auto name = GetShaderName(info.stage, info.pgm_hash, perm_idx); Vulkan::SetObjectName(instance.GetDevice(), module, name); - if (EmulatorSettings::GetInstance()->IsShaderCollect()) { + if (EmulatorSettings.IsShaderCollect()) { DebugState.CollectShader(name, info.l_stage, module, spv, code, patch ? *patch : std::span{}, is_patched); } @@ -659,7 +659,7 @@ std::string PipelineCache::GetShaderName(Shader::Stage stage, u64 hash, void PipelineCache::DumpShader(std::span code, u64 hash, Shader::Stage stage, size_t perm_idx, std::string_view ext) { - if (!EmulatorSettings::GetInstance()->IsDumpShaders()) { + if (!EmulatorSettings.IsDumpShaders()) { return; } diff --git a/src/video_core/renderer_vulkan/vk_pipeline_serialization.cpp b/src/video_core/renderer_vulkan/vk_pipeline_serialization.cpp index cb1ac3f64..eb31d4994 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_serialization.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_serialization.cpp @@ -295,7 +295,7 @@ bool PipelineCache::LoadPipelineStage(Serialization::Archive& ar, size_t stage) } void PipelineCache::WarmUp() { - if (!EmulatorSettings::GetInstance()->IsPipelineCacheEnabled()) { + if (!EmulatorSettings.IsPipelineCacheEnabled()) { return; } diff --git a/src/video_core/renderer_vulkan/vk_platform.cpp b/src/video_core/renderer_vulkan/vk_platform.cpp index 90fe630bd..1d1080b45 100644 --- a/src/video_core/renderer_vulkan/vk_platform.cpp +++ b/src/video_core/renderer_vulkan/vk_platform.cpp @@ -87,7 +87,7 @@ vk::SurfaceKHR CreateSurface(vk::Instance instance, const Frontend::WindowSDL& e UNREACHABLE(); } } else if (window_info.type == Frontend::WindowSystemType::Wayland) { - if (EmulatorSettings::GetInstance()->IsRenderdocEnabled()) { + if (EmulatorSettings.IsRenderdocEnabled()) { LOG_ERROR(Render_Vulkan, "RenderDoc is not compatible with Wayland, use an X11 window instead."); } @@ -200,7 +200,7 @@ std::vector GetInstanceExtensions(Frontend::WindowSystemType window extensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME); } - if (EmulatorSettings::GetInstance()->IsHdrAllowed()) { + if (EmulatorSettings.IsHdrAllowed()) { extensions.push_back(VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME); } @@ -307,11 +307,11 @@ vk::UniqueInstance CreateInstance(Frontend::WindowSystemType window_type, bool e // Validation settings vk::Bool32 enable_core = - EmulatorSettings::GetInstance()->IsVkValidationCoreEnabled() ? vk::True : vk::False; + EmulatorSettings.IsVkValidationCoreEnabled() ? vk::True : vk::False; vk::Bool32 enable_sync = - EmulatorSettings::GetInstance()->IsVkValidationSyncEnabled() ? vk::True : vk::False; + EmulatorSettings.IsVkValidationSyncEnabled() ? vk::True : vk::False; vk::Bool32 enable_gpuav = - EmulatorSettings::GetInstance()->IsVkValidationGpuEnabled() ? vk::True : vk::False; + EmulatorSettings.IsVkValidationGpuEnabled() ? vk::True : vk::False; // Crash diagnostics settings static const auto crash_diagnostic_path = diff --git a/src/video_core/renderer_vulkan/vk_presenter.cpp b/src/video_core/renderer_vulkan/vk_presenter.cpp index 14e1020d7..1893be0b6 100644 --- a/src/video_core/renderer_vulkan/vk_presenter.cpp +++ b/src/video_core/renderer_vulkan/vk_presenter.cpp @@ -104,9 +104,9 @@ static vk::Rect2D FitImage(s32 frame_width, s32 frame_height, s32 swapchain_widt Presenter::Presenter(Frontend::WindowSDL& window_, AmdGpu::Liverpool* liverpool_) : window{window_}, liverpool{liverpool_}, - instance{window, EmulatorSettings::GetInstance()->GetGpuId(), - EmulatorSettings::GetInstance()->IsVkValidationEnabled(), - EmulatorSettings::GetInstance()->IsVkCrashDiagnosticEnabled()}, + instance{window, EmulatorSettings.GetGpuId(), + EmulatorSettings.IsVkValidationEnabled(), + EmulatorSettings.IsVkCrashDiagnosticEnabled()}, draw_scheduler{instance}, present_scheduler{instance}, flip_scheduler{instance}, swapchain{instance, window}, rasterizer{std::make_unique(instance, draw_scheduler, liverpool)}, @@ -125,10 +125,10 @@ Presenter::Presenter(Frontend::WindowSDL& window_, AmdGpu::Liverpool* liverpool_ free_queue.push(&frame); } - fsr_settings.enable = EmulatorSettings::GetInstance()->IsFsrEnabled(); - fsr_settings.use_rcas = EmulatorSettings::GetInstance()->IsRcasEnabled(); + fsr_settings.enable = EmulatorSettings.IsFsrEnabled(); + fsr_settings.use_rcas = EmulatorSettings.IsRcasEnabled(); fsr_settings.rcas_attenuation = - static_cast(EmulatorSettings::GetInstance()->GetRcasAttenuation() / 1000.f); + static_cast(EmulatorSettings.GetRcasAttenuation() / 1000.f); fsr_pass.Create(device, instance.GetAllocator(), num_images); pp_pass.Create(device, swapchain.GetSurfaceFormat().format); @@ -467,7 +467,7 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) { auto& scheduler = present_scheduler; const auto cmdbuf = scheduler.CommandBuffer(); - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.beginDebugUtilsLabelEXT(vk::DebugUtilsLabelEXT{ .pLabelName = "Present", }); @@ -579,7 +579,7 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) { ImGui::SetCursorPos(ImGui::GetCursorStartPos() + offset); ImGui::Image(game_texture, size); - if (EmulatorSettings::GetInstance()->IsNullGPU()) { + if (EmulatorSettings.IsNullGPU()) { Core::Devtools::Layer::DrawNullGpuNotice(); } } @@ -598,7 +598,7 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) { } } - if (EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled()) { + if (EmulatorSettings.IsVkHostMarkersEnabled()) { cmdbuf.endDebugUtilsLabelEXT(); } diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 75e89c0d6..41dbcc7d4 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -38,7 +38,7 @@ Rasterizer::Rasterizer(const Instance& instance_, Scheduler& scheduler_, texture_cache{instance, scheduler, liverpool_, buffer_cache, page_manager}, liverpool{liverpool_}, memory{Core::Memory::Instance()}, pipeline_cache{instance, scheduler, liverpool} { - if (!EmulatorSettings::GetInstance()->IsNullGPU()) { + if (!EmulatorSettings.IsNullGPU()) { liverpool->BindRasterizer(this); } memory->SetRasterizer(this); @@ -1278,8 +1278,8 @@ void Rasterizer::UpdateColorBlendingState(const GraphicsPipeline* pipeline) cons } void Rasterizer::ScopeMarkerBegin(const std::string_view& str, bool from_guest) { - if ((from_guest && !EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled()) || - (!from_guest && !EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled())) { + if ((from_guest && !EmulatorSettings.IsVkGuestMarkersEnabled()) || + (!from_guest && !EmulatorSettings.IsVkHostMarkersEnabled())) { return; } const auto cmdbuf = scheduler.CommandBuffer(); @@ -1289,8 +1289,8 @@ void Rasterizer::ScopeMarkerBegin(const std::string_view& str, bool from_guest) } void Rasterizer::ScopeMarkerEnd(bool from_guest) { - if ((from_guest && !EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled()) || - (!from_guest && !EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled())) { + if ((from_guest && !EmulatorSettings.IsVkGuestMarkersEnabled()) || + (!from_guest && !EmulatorSettings.IsVkHostMarkersEnabled())) { return; } const auto cmdbuf = scheduler.CommandBuffer(); @@ -1298,8 +1298,8 @@ void Rasterizer::ScopeMarkerEnd(bool from_guest) { } void Rasterizer::ScopedMarkerInsert(const std::string_view& str, bool from_guest) { - if ((from_guest && !EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled()) || - (!from_guest && !EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled())) { + if ((from_guest && !EmulatorSettings.IsVkGuestMarkersEnabled()) || + (!from_guest && !EmulatorSettings.IsVkHostMarkersEnabled())) { return; } const auto cmdbuf = scheduler.CommandBuffer(); @@ -1310,8 +1310,8 @@ void Rasterizer::ScopedMarkerInsert(const std::string_view& str, bool from_guest void Rasterizer::ScopedMarkerInsertColor(const std::string_view& str, const u32 color, bool from_guest) { - if ((from_guest && !EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled()) || - (!from_guest && !EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled())) { + if ((from_guest && !EmulatorSettings.IsVkGuestMarkersEnabled()) || + (!from_guest && !EmulatorSettings.IsVkHostMarkersEnabled())) { return; } const auto cmdbuf = scheduler.CommandBuffer(); diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index f283448df..c2b8694be 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -164,7 +164,7 @@ void Swapchain::FindPresentFormat() { return format == SURFACE_FORMAT_HDR; }) != formats.end(); // Also make sure that user allowed us to use HDR - supports_hdr &= EmulatorSettings::GetInstance()->IsHdrAllowed(); + supports_hdr &= EmulatorSettings.IsHdrAllowed(); // If there is a single undefined surface format, the device doesn't care, so we'll just use // RGBA sRGB. @@ -199,7 +199,7 @@ void Swapchain::FindPresentMode() { return; } - const auto requested_mode = EmulatorSettings::GetInstance()->GetPresentMode(); + const auto requested_mode = EmulatorSettings.GetPresentMode(); if (requested_mode == "Mailbox") { present_mode = vk::PresentModeKHR::eMailbox; } else if (requested_mode == "Fifo") { @@ -208,7 +208,7 @@ void Swapchain::FindPresentMode() { present_mode = vk::PresentModeKHR::eImmediate; } else { LOG_ERROR(Render_Vulkan, "Unknown present mode {}, defaulting to Mailbox.", - EmulatorSettings::GetInstance()->GetPresentMode()); + EmulatorSettings.GetPresentMode()); present_mode = vk::PresentModeKHR::eMailbox; } diff --git a/src/video_core/texture_cache/texture_cache.cpp b/src/video_core/texture_cache/texture_cache.cpp index 9bbfeafb5..504e89a28 100644 --- a/src/video_core/texture_cache/texture_cache.cpp +++ b/src/video_core/texture_cache/texture_cache.cpp @@ -649,7 +649,7 @@ ImageView& TextureCache::FindTexture(ImageId image_id, const ImageDesc& desc) { Image& image = slot_images[image_id]; if (desc.type == BindingType::Storage) { image.flags |= ImageFlagBits::GpuModified; - if (EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled() && + if (EmulatorSettings.IsReadbackLinearImagesEnabled() && !image.info.props.is_tiled && image.info.guest_address != 0) { download_images.emplace(image_id); } @@ -661,7 +661,7 @@ ImageView& TextureCache::FindTexture(ImageId image_id, const ImageDesc& desc) { ImageView& TextureCache::FindRenderTarget(ImageId image_id, const ImageDesc& desc) { Image& image = slot_images[image_id]; image.flags |= ImageFlagBits::GpuModified; - if (EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled() && + if (EmulatorSettings.IsReadbackLinearImagesEnabled() && !image.info.props.is_tiled) { download_images.emplace(image_id); }