diff --git a/src/common/config.cpp b/src/common/config.cpp index 54339f312..856451ae5 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -154,14 +154,9 @@ static ConfigEntry useUnifiedInputConfig(true); static ConfigEntry defaultControllerID(""); static ConfigEntry backgroundControllerInput(false); -static ConfigEntry readbackLinearImagesEnabled(false); -static ConfigEntry directMemoryAccessEnabled(false); static ConfigEntry shouldDumpShaders(false); static ConfigEntry shouldPatchShaders(false); static ConfigEntry vblankFrequency(60); -static ConfigEntry fsrEnabled(false); -static ConfigEntry rcasEnabled(true); -static ConfigEntry rcasAttenuation(250); // Vulkan static ConfigEntry vkValidation(false); @@ -272,14 +267,6 @@ bool getIsMotionControlsEnabled() { return isMotionControlsEnabled.get(); } -bool readbackLinearImages() { - return readbackLinearImagesEnabled.get(); -} - -bool directMemoryAccess() { - return directMemoryAccessEnabled.get(); -} - bool dumpShaders() { return shouldDumpShaders.get(); } @@ -359,14 +346,6 @@ void setVkGuestMarkersEnabled(bool enable, bool is_game_specific) { vkGuestMarkers.set(enable, is_game_specific); } -void setReadbackLinearImages(bool enable, bool is_game_specific) { - readbackLinearImagesEnabled.set(enable, is_game_specific); -} - -void setDirectMemoryAccess(bool enable, bool is_game_specific) { - directMemoryAccessEnabled.set(enable, is_game_specific); -} - void setDumpShaders(bool enable, bool is_game_specific) { shouldDumpShaders.set(enable, is_game_specific); } @@ -447,30 +426,6 @@ void setBackgroundControllerInput(bool enable, bool is_game_specific) { backgroundControllerInput.set(enable, is_game_specific); } -bool getFsrEnabled() { - return fsrEnabled.get(); -} - -void setFsrEnabled(bool enable, bool is_game_specific) { - fsrEnabled.set(enable, is_game_specific); -} - -bool getRcasEnabled() { - return rcasEnabled.get(); -} - -void setRcasEnabled(bool enable, bool is_game_specific) { - rcasEnabled.set(enable, is_game_specific); -} - -int getRcasAttenuation() { - return rcasAttenuation.get(); -} - -void setRcasAttenuation(int value, bool is_game_specific) { - rcasAttenuation.set(value, is_game_specific); -} - int getUsbDeviceBackend() { return usbDeviceBackend.get(); } @@ -531,14 +486,9 @@ void load(const std::filesystem::path& path, bool is_game_specific) { if (data.contains("GPU")) { const toml::value& gpu = data.at("GPU"); - readbackLinearImagesEnabled.setFromToml(gpu, "readbackLinearImages", is_game_specific); - directMemoryAccessEnabled.setFromToml(gpu, "directMemoryAccess", is_game_specific); shouldDumpShaders.setFromToml(gpu, "dumpShaders", is_game_specific); shouldPatchShaders.setFromToml(gpu, "patchShaders", is_game_specific); vblankFrequency.setFromToml(gpu, "vblankFrequency", is_game_specific); - fsrEnabled.setFromToml(gpu, "fsrEnabled", is_game_specific); - rcasEnabled.setFromToml(gpu, "rcasEnabled", is_game_specific); - rcasAttenuation.setFromToml(gpu, "rcasAttenuation", is_game_specific); } if (data.contains("Vulkan")) { @@ -644,13 +594,8 @@ void save(const std::filesystem::path& path, bool is_game_specific) { is_game_specific); usbDeviceBackend.setTomlValue(data, "Input", "usbDeviceBackend", is_game_specific); - readbackLinearImagesEnabled.setTomlValue(data, "GPU", "readbackLinearImages", is_game_specific); shouldDumpShaders.setTomlValue(data, "GPU", "dumpShaders", is_game_specific); vblankFrequency.setTomlValue(data, "GPU", "vblankFrequency", is_game_specific); - fsrEnabled.setTomlValue(data, "GPU", "fsrEnabled", is_game_specific); - rcasEnabled.setTomlValue(data, "GPU", "rcasEnabled", is_game_specific); - rcasAttenuation.setTomlValue(data, "GPU", "rcasAttenuation", is_game_specific); - directMemoryAccessEnabled.setTomlValue(data, "GPU", "directMemoryAccess", is_game_specific); vkValidation.setTomlValue(data, "Vulkan", "validation", is_game_specific); vkValidationSync.setTomlValue(data, "Vulkan", "validation_sync", is_game_specific); @@ -692,10 +637,6 @@ void setDefaultValues(bool is_game_specific) { // Entries with game-specific settings that are in the game-specific setings GUI but not in // the global settings GUI - if (is_game_specific) { - readbackLinearImagesEnabled.setDefault(is_game_specific); - directMemoryAccessEnabled.setDefault(is_game_specific); - } // Entries with game-specific settings that are in both the game-specific and global GUI // GS - General @@ -712,9 +653,6 @@ void setDefaultValues(bool is_game_specific) { // GS - GPU shouldDumpShaders.setDefault(is_game_specific); vblankFrequency.setDefault(is_game_specific); - fsrEnabled.setDefault(is_game_specific); - rcasEnabled.setDefault(is_game_specific); - rcasAttenuation.setDefault(is_game_specific); // GS - Vulkan vkValidation.set(false, is_game_specific); diff --git a/src/common/config.h b/src/common/config.h index 4178a7d2d..75b6d1d04 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -31,10 +31,6 @@ int getVolumeSlider(); void setVolumeSlider(int volumeValue, bool is_game_specific = false); std::string getTrophyKey(); void setTrophyKey(std::string key); -bool readbackLinearImages(); -void setReadbackLinearImages(bool enable, bool is_game_specific = false); -bool directMemoryAccess(); -void setDirectMemoryAccess(bool enable, bool is_game_specific = false); bool dumpShaders(); void setDumpShaders(bool enable, bool is_game_specific = false); u32 vblankFreq(); @@ -79,12 +75,6 @@ std::string getDefaultControllerID(); void setDefaultControllerID(std::string id); bool getBackgroundControllerInput(); void setBackgroundControllerInput(bool enable, bool is_game_specific = false); -bool getFsrEnabled(); -void setFsrEnabled(bool enable, bool is_game_specific = false); -bool getRcasEnabled(); -void setRcasEnabled(bool enable, bool is_game_specific = false); -int getRcasAttenuation(); -void setRcasAttenuation(int value, bool is_game_specific = false); void setUserName(const std::string& name, bool is_game_specific = false); bool getLoadAutoPatches(); void setLoadAutoPatches(bool enable); diff --git a/src/core/devtools/layer.cpp b/src/core/devtools/layer.cpp index cfa950568..5a0fdfd4d 100644 --- a/src/core/devtools/layer.cpp +++ b/src/core/devtools/layer.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2025-2026 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "layer.h" @@ -11,6 +11,7 @@ #include "common/singleton.h" #include "common/types.h" #include "core/debug_state.h" +#include "core/emulator_settings.h" #include "imgui/imgui_std.h" #include "imgui_internal.h" #include "options.h" @@ -106,11 +107,11 @@ void L::DrawMenuBar() { EndDisabled(); if (Button("Save")) { - Config::setFsrEnabled(fsr.enable); - Config::setRcasEnabled(fsr.use_rcas); - Config::setRcasAttenuation(static_cast(fsr.rcas_attenuation * 1000)); - Config::save(Common::FS::GetUserPath(Common::FS::PathType::UserDir) / - "config.toml"); + EmulatorSettings::GetInstance()->SetFsrEnabled(fsr.enable); + EmulatorSettings::GetInstance()->SetRcasEnabled(fsr.use_rcas); + EmulatorSettings::GetInstance()->SetRcasAttenuation( + static_cast(fsr.rcas_attenuation * 1000)); + EmulatorSettings::GetInstance()->Save(); CloseCurrentPopup(); } diff --git a/src/emulator.cpp b/src/emulator.cpp index 5807b12d9..78b7caed4 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -214,8 +214,10 @@ void Emulator::Run(std::filesystem::path file, std::vector args, LOG_INFO(Config, "General isPsnSignedIn: {}", EmulatorSettings::GetInstance()->IsPSNSignedIn()); LOG_INFO(Config, "GPU isNullGpu: {}", EmulatorSettings::GetInstance()->IsNullGPU()); LOG_INFO(Config, "GPU readbacks: {}", EmulatorSettings::GetInstance()->IsReadbacksEnabled()); - LOG_INFO(Config, "GPU readbackLinearImages: {}", Config::readbackLinearImages()); - LOG_INFO(Config, "GPU directMemoryAccess: {}", Config::directMemoryAccess()); + LOG_INFO(Config, "GPU readbackLinearImages: {}", + EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled()); + LOG_INFO(Config, "GPU directMemoryAccess: {}", + EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()); LOG_INFO(Config, "GPU shouldDumpShaders: {}", Config::dumpShaders()); LOG_INFO(Config, "GPU vblankFrequency: {}", Config::vblankFreq()); LOG_INFO(Config, "GPU shouldCopyGPUBuffers: {}", 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 554448b13..d9be5f948 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 @@ -1,8 +1,9 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/assert.h" #include "common/config.h" +#include "core/emulator_settings.h" #include "shader_recompiler/backend/spirv/emit_spirv_bounds.h" #include "shader_recompiler/backend/spirv/emit_spirv_instructions.h" #include "shader_recompiler/backend/spirv/spirv_emit_context.h" @@ -58,7 +59,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 (!Config::directMemoryAccess()) { + if (!EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()) { return ctx.EmitFlatbufferLoad(ctx.ConstU32(flatbuf_off_dw)); } // We can only provide a fallback for immediate offsets. 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 c298a1092..c8ab6086f 100644 --- a/src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp +++ b/src/shader_recompiler/ir/passes/shader_info_collection_pass.cpp @@ -1,7 +1,7 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "common/config.h" +#include "core/emulator_settings.h" #include "shader_recompiler/ir/program.h" #include "shader_recompiler/profile.h" #include "video_core/buffer_cache/buffer_cache.h" @@ -176,7 +176,7 @@ void CollectShaderInfoPass(IR::Program& program, const Profile& profile) { // info.readconst_types |= Info::ReadConstType::Immediate; } - if (!Config::directMemoryAccess()) { + if (!EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()) { info.uses_dma = false; info.readconst_types = Info::ReadConstType::None; } diff --git a/src/video_core/renderer_vulkan/vk_presenter.cpp b/src/video_core/renderer_vulkan/vk_presenter.cpp index 344d4db5f..1a4936348 100644 --- a/src/video_core/renderer_vulkan/vk_presenter.cpp +++ b/src/video_core/renderer_vulkan/vk_presenter.cpp @@ -125,9 +125,10 @@ Presenter::Presenter(Frontend::WindowSDL& window_, AmdGpu::Liverpool* liverpool_ free_queue.push(&frame); } - fsr_settings.enable = Config::getFsrEnabled(); - fsr_settings.use_rcas = Config::getRcasEnabled(); - fsr_settings.rcas_attenuation = static_cast(Config::getRcasAttenuation() / 1000.f); + fsr_settings.enable = EmulatorSettings::GetInstance()->IsFsrEnabled(); + fsr_settings.use_rcas = EmulatorSettings::GetInstance()->IsRcasEnabled(); + fsr_settings.rcas_attenuation = + static_cast(EmulatorSettings::GetInstance()->GetRcasAttenuation() / 1000.f); fsr_pass.Create(device, instance.GetAllocator(), num_images); pp_pass.Create(device, swapchain.GetSurfaceFormat().format); diff --git a/src/video_core/texture_cache/texture_cache.cpp b/src/video_core/texture_cache/texture_cache.cpp index 17c7e67b3..ad81c3f0b 100644 --- a/src/video_core/texture_cache/texture_cache.cpp +++ b/src/video_core/texture_cache/texture_cache.cpp @@ -1,12 +1,12 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include #include "common/assert.h" -#include "common/config.h" #include "common/debug.h" #include "common/scope_exit.h" +#include "core/emulator_settings.h" #include "core/memory.h" #include "video_core/buffer_cache/buffer_cache.h" #include "video_core/page_manager.h" @@ -536,8 +536,8 @@ 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 (Config::readbackLinearImages() && !image.info.props.is_tiled && - image.info.guest_address != 0) { + if (EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled() && + !image.info.props.is_tiled && image.info.guest_address != 0) { download_images.emplace(image_id); } } @@ -548,7 +548,8 @@ 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 (Config::readbackLinearImages() && !image.info.props.is_tiled) { + if (EmulatorSettings::GetInstance()->IsReadbackLinearImagesEnabled() && + !image.info.props.is_tiled) { download_images.emplace(image_id); } image.usage.render_target = 1u;