even more settings

This commit is contained in:
georgemoralis 2026-01-05 18:51:36 +02:00
parent 61d5a93a11
commit fc227f5664
8 changed files with 27 additions and 93 deletions

View File

@ -154,14 +154,9 @@ static ConfigEntry<bool> useUnifiedInputConfig(true);
static ConfigEntry<string> defaultControllerID("");
static ConfigEntry<bool> backgroundControllerInput(false);
static ConfigEntry<bool> readbackLinearImagesEnabled(false);
static ConfigEntry<bool> directMemoryAccessEnabled(false);
static ConfigEntry<bool> shouldDumpShaders(false);
static ConfigEntry<bool> shouldPatchShaders(false);
static ConfigEntry<u32> vblankFrequency(60);
static ConfigEntry<bool> fsrEnabled(false);
static ConfigEntry<bool> rcasEnabled(true);
static ConfigEntry<int> rcasAttenuation(250);
// Vulkan
static ConfigEntry<bool> 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);

View File

@ -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);

View File

@ -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<int>(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<int>(fsr.rcas_attenuation * 1000));
EmulatorSettings::GetInstance()->Save();
CloseCurrentPopup();
}

View File

@ -214,8 +214,10 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> 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: {}",

View File

@ -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<u32>();
if (!Config::directMemoryAccess()) {
if (!EmulatorSettings::GetInstance()->IsDirectMemoryAccessEnabled()) {
return ctx.EmitFlatbufferLoad(ctx.ConstU32(flatbuf_off_dw));
}
// We can only provide a fallback for immediate offsets.

View File

@ -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;
}

View File

@ -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<float>(Config::getRcasAttenuation() / 1000.f);
fsr_settings.enable = EmulatorSettings::GetInstance()->IsFsrEnabled();
fsr_settings.use_rcas = EmulatorSettings::GetInstance()->IsRcasEnabled();
fsr_settings.rcas_attenuation =
static_cast<float>(EmulatorSettings::GetInstance()->GetRcasAttenuation() / 1000.f);
fsr_pass.Create(device, instance.GetAllocator(), num_images);
pp_pass.Create(device, swapchain.GetSurfaceFormat().format);

View File

@ -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 <xxhash.h>
#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;