even more settings

This commit is contained in:
georgemoralis
2025-11-28 20:04:20 +02:00
parent 039b145159
commit abc456b62f
10 changed files with 29 additions and 79 deletions

View File

@@ -152,7 +152,6 @@ static ConfigEntry<u32> windowWidth(1280);
static ConfigEntry<u32> windowHeight(720);
static ConfigEntry<u32> internalScreenWidth(1280);
static ConfigEntry<u32> internalScreenHeight(720);
static ConfigEntry<bool> isNullGpu(false);
static ConfigEntry<bool> shouldCopyGPUBuffers(false);
static ConfigEntry<bool> readbacksEnabled(false);
static ConfigEntry<bool> readbackLinearImagesEnabled(false);
@@ -160,8 +159,6 @@ static ConfigEntry<bool> directMemoryAccessEnabled(false);
static ConfigEntry<bool> shouldDumpShaders(false);
static ConfigEntry<bool> shouldPatchShaders(false);
static ConfigEntry<u32> vblankFrequency(60);
static ConfigEntry<string> fullscreenMode("Windowed");
static ConfigEntry<string> presentMode("Mailbox");
static ConfigEntry<bool> isHDRAllowed(false);
static ConfigEntry<bool> fsrEnabled(false);
static ConfigEntry<bool> rcasEnabled(true);
@@ -179,7 +176,6 @@ static ConfigEntry<bool> rdocEnable(false);
// Debug
static ConfigEntry<bool> isFpsColor(true);
static ConfigEntry<bool> logEnabled(true);
// GUI
static std::vector<GameInstallDir> settings_install_dirs = {};
@@ -239,10 +235,6 @@ int* GetControllerCustomColor() {
return controllerCustomColorRGB;
}
bool getLoggingEnabled() {
return logEnabled.get();
}
void SetControllerCustomColor(int r, int b, int g) {
controllerCustomColorRGB[0] = r;
controllerCustomColorRGB[1] = b;
@@ -268,14 +260,6 @@ void setVolumeSlider(int volumeValue, bool is_game_specific) {
volumeSlider.set(volumeValue, is_game_specific);
}
string getFullscreenMode() {
return fullscreenMode.get();
}
std::string getPresentMode() {
return presentMode.get();
}
s16 getCursorState() {
return cursorState.get();
}
@@ -312,7 +296,6 @@ u32 getInternalScreenHeight() {
return internalScreenHeight.get();
}
string getUserName() {
return userName.get();
}
@@ -329,10 +312,6 @@ bool getIsMotionControlsEnabled() {
return isMotionControlsEnabled.get();
}
bool nullGpu() {
return isNullGpu.get();
}
bool copyGPUCmdBuffers() {
return shouldCopyGPUBuffers.get();
}
@@ -365,10 +344,6 @@ bool fpsColor() {
return isFpsColor.get();
}
bool isLoggingEnabled() {
return logEnabled.get();
}
u32 vblankFreq() {
if (vblankFrequency.get() < 60) {
vblankFrequency = 60;
@@ -432,14 +407,6 @@ void setInternalScreenHeight(u32 height) {
internalScreenHeight.base_value = height;
}
void setLoggingEnabled(bool enable, bool is_game_specific) {
logEnabled.set(enable, is_game_specific);
}
void setNullGpu(bool enable, bool is_game_specific) {
isNullGpu.set(enable, is_game_specific);
}
void setAllowHDR(bool enable, bool is_game_specific) {
isHDRAllowed.set(enable, is_game_specific);
}
@@ -488,14 +455,6 @@ void setVblankFreq(u32 value, bool is_game_specific) {
vblankFrequency.set(value, is_game_specific);
}
void setFullscreenMode(string mode, bool is_game_specific) {
fullscreenMode.set(mode, is_game_specific);
}
void setPresentMode(std::string mode, bool is_game_specific) {
presentMode.set(mode, is_game_specific);
}
void setCursorState(s16 newCursorState, bool is_game_specific) {
cursorState.set(newCursorState, is_game_specific);
}
@@ -657,7 +616,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
windowHeight.setFromToml(gpu, "screenHeight", is_game_specific);
internalScreenWidth.setFromToml(gpu, "internalScreenWidth", is_game_specific);
internalScreenHeight.setFromToml(gpu, "internalScreenHeight", is_game_specific);
isNullGpu.setFromToml(gpu, "nullGpu", is_game_specific);
shouldCopyGPUBuffers.setFromToml(gpu, "copyGPUBuffers", is_game_specific);
readbacksEnabled.setFromToml(gpu, "readbacks", is_game_specific);
readbackLinearImagesEnabled.setFromToml(gpu, "readbackLinearImages", is_game_specific);
@@ -665,8 +623,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
shouldDumpShaders.setFromToml(gpu, "dumpShaders", is_game_specific);
shouldPatchShaders.setFromToml(gpu, "patchShaders", is_game_specific);
vblankFrequency.setFromToml(gpu, "vblankFrequency", is_game_specific);
fullscreenMode.setFromToml(gpu, "FullscreenMode", is_game_specific);
presentMode.setFromToml(gpu, "presentMode", is_game_specific);
isHDRAllowed.setFromToml(gpu, "allowHDR", is_game_specific);
fsrEnabled.setFromToml(gpu, "fsrEnabled", is_game_specific);
rcasEnabled.setFromToml(gpu, "rcasEnabled", is_game_specific);
@@ -691,7 +647,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
const toml::value& debug = data.at("Debug");
isFpsColor.setFromToml(debug, "FPSColor", is_game_specific);
logEnabled.setFromToml(debug, "logEnabled", is_game_specific);
current_version = toml::find_or<std::string>(debug, "ConfigVersion", current_version);
}
@@ -807,14 +762,11 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
windowWidth.setTomlValue(data, "GPU", "screenWidth", is_game_specific);
windowHeight.setTomlValue(data, "GPU", "screenHeight", is_game_specific);
isNullGpu.setTomlValue(data, "GPU", "nullGpu", is_game_specific);
shouldCopyGPUBuffers.setTomlValue(data, "GPU", "copyGPUBuffers", is_game_specific);
readbacksEnabled.setTomlValue(data, "GPU", "readbacks", 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);
fullscreenMode.setTomlValue(data, "GPU", "FullscreenMode", is_game_specific);
presentMode.setTomlValue(data, "GPU", "presentMode", is_game_specific);
isHDRAllowed.setTomlValue(data, "GPU", "allowHDR", is_game_specific);
fsrEnabled.setTomlValue(data, "GPU", "fsrEnabled", is_game_specific);
rcasEnabled.setTomlValue(data, "GPU", "rcasEnabled", is_game_specific);
@@ -830,8 +782,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
vkGuestMarkers.setTomlValue(data, "Vulkan", "guestMarkers", is_game_specific);
rdocEnable.setTomlValue(data, "Vulkan", "rdocEnable", is_game_specific);
logEnabled.setTomlValue(data, "Debug", "logEnabled", is_game_specific);
m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific);
if (!is_game_specific) {
@@ -918,12 +868,9 @@ void setDefaultValues(bool is_game_specific) {
// GS - GPU
windowWidth.set(1280, is_game_specific);
windowHeight.set(720, is_game_specific);
isNullGpu.set(false, is_game_specific);
shouldCopyGPUBuffers.set(false, is_game_specific);
shouldDumpShaders.set(false, is_game_specific);
vblankFrequency.set(60, is_game_specific);
fullscreenMode.set("Windowed", is_game_specific);
presentMode.set("Mailbox", is_game_specific);
isHDRAllowed.set(false, is_game_specific);
fsrEnabled.set(true, is_game_specific);
rcasEnabled.set(true, is_game_specific);
@@ -939,9 +886,6 @@ void setDefaultValues(bool is_game_specific) {
vkGuestMarkers.set(false, is_game_specific);
rdocEnable.set(false, is_game_specific);
// GS - Debug
logEnabled.set(true, is_game_specific);
// GS - Settings
m_language.set(1, is_game_specific);

View File

@@ -33,10 +33,6 @@ int getVolumeSlider();
void setVolumeSlider(int volumeValue, bool is_game_specific = false);
std::string getTrophyKey();
void setTrophyKey(std::string key);
std::string getFullscreenMode();
void setFullscreenMode(std::string mode, bool is_game_specific = false);
std::string getPresentMode();
void setPresentMode(std::string mode, bool is_game_specific = false);
u32 getWindowWidth();
u32 getWindowHeight();
void setWindowWidth(u32 width, bool is_game_specific = false);
@@ -47,8 +43,6 @@ void setInternalScreenWidth(u32 width);
void setInternalScreenHeight(u32 height);
bool allowHDR();
void setAllowHDR(bool enable, bool is_game_specific = false);
bool nullGpu();
void setNullGpu(bool enable, bool is_game_specific = false);
bool copyGPUCmdBuffers();
void setCopyGPUCmdBuffers(bool enable, bool is_game_specific = false);
bool readbacks();
@@ -101,8 +95,6 @@ std::string getDefaultControllerID();
void setDefaultControllerID(std::string id);
bool getBackgroundControllerInput();
void setBackgroundControllerInput(bool enable, bool is_game_specific = false);
bool getLoggingEnabled();
void setLoggingEnabled(bool enable, bool is_game_specific = false);
bool getFsrEnabled();
void setFsrEnabled(bool enable, bool is_game_specific = false);
bool getRcasEnabled();

View File

@@ -184,7 +184,8 @@ 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) || !Config::getLoggingEnabled()) {
if (!filter.CheckMessage(log_class, log_level) ||
!EmulatorSettings::GetInstance()->IsLogEnabled()) {
return;
}

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <fstream>

View File

@@ -218,7 +218,10 @@ struct GPUSettings {
Setting<int> rcas_attenuation{250};
// TODO add overrides
std::vector<OverrideItem> GetOverrideableFields() const {
return std::vector<OverrideItem>{};
return std::vector<OverrideItem>{
make_override<GPUSettings>("null_gpu", &GPUSettings::null_gpu),
make_override<GPUSettings>("full_screen", &GPUSettings::full_screen),
make_override<GPUSettings>("present_mode", &GPUSettings::present_mode)};
}
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GPUSettings, window_width, window_height, internal_screen_width,
@@ -241,7 +244,7 @@ struct VulkanSettings {
make_override<VulkanSettings>("full_screen", &VulkanSettings::full_screen)};
}
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VulkanSettings, gpu_id,full_screen)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VulkanSettings, gpu_id, full_screen)
// -------------------------------
// User settings
// -------------------------------
@@ -346,6 +349,12 @@ public:
SETTING_FORWARD_BOOL(m_debug, SeparateLoggingEnabled, separate_logging_enabled)
SETTING_FORWARD_BOOL(m_debug, DebugDump, debug_dump)
SETTING_FORWARD_BOOL(m_debug, ShaderDump, shader_dump)
SETTING_FORWARD_BOOL(m_debug, LogEnabled, log_enabled)
// GPU Settings
SETTING_FORWARD_BOOL(m_gpu, NullGPU, null_gpu)
SETTING_FORWARD(m_gpu, FullScreenMode, full_screen_mode)
SETTING_FORWARD(m_gpu, PresentMode, present_mode)
// Vulkan settings
SETTING_FORWARD(m_vulkan, GpuId, gpu_id)

View File

@@ -209,7 +209,7 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
LOG_INFO(Config, "General isConnectedToNetwork: {}",
EmulatorSettings::GetInstance()->IsConnectedToNetwork());
LOG_INFO(Config, "General isPsnSignedIn: {}", EmulatorSettings::GetInstance()->IsPSNSignedIn());
LOG_INFO(Config, "GPU isNullGpu: {}", Config::nullGpu());
LOG_INFO(Config, "GPU isNullGpu: {}", EmulatorSettings::GetInstance()->IsNullGPU());
LOG_INFO(Config, "GPU readbacks: {}", Config::readbacks());
LOG_INFO(Config, "GPU readbackLinearImages: {}", Config::readbackLinearImages());
LOG_INFO(Config, "GPU directMemoryAccess: {}", Config::directMemoryAccess());

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "SDL3/SDL_events.h"
@@ -315,8 +315,10 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_
error = true;
}
if (!error) {
SDL_SetWindowFullscreenMode(
window, Config::getFullscreenMode() == "Fullscreen" ? displayMode : NULL);
SDL_SetWindowFullscreenMode(window, EmulatorSettings::GetInstance()->GetFullScreenMode() ==
"Fullscreen"
? displayMode
: NULL);
}
SDL_SetWindowFullscreen(window, EmulatorSettings::GetInstance()->IsFullScreen());

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/config.h"
@@ -578,7 +578,7 @@ void Presenter::Present(Frame* frame, bool is_reusing_frame) {
ImGui::SetCursorPos(ImGui::GetCursorStartPos() + offset);
ImGui::Image(game_texture, size);
if (Config::nullGpu()) {
if (EmulatorSettings::GetInstance()->IsNullGPU()) {
Core::Devtools::Layer::DrawNullGpuNotice();
}
}

View File

@@ -1,8 +1,9 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/config.h"
#include "common/debug.h"
#include "core/emulator_settings.h"
#include "core/memory.h"
#include "shader_recompiler/runtime_info.h"
#include "video_core/amdgpu/liverpool.h"
@@ -38,7 +39,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 (!Config::nullGpu()) {
if (!EmulatorSettings::GetInstance()->IsNullGPU()) {
liverpool->BindRasterizer(this);
}
memory->SetRasterizer(this);

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
@@ -6,6 +6,7 @@
#include "common/assert.h"
#include "common/config.h"
#include "common/logging/log.h"
#include "core/emulator_settings.h"
#include "imgui/renderer/imgui_core.h"
#include "sdl_window.h"
#include "video_core/renderer_vulkan/vk_instance.h"
@@ -199,7 +200,7 @@ void Swapchain::FindPresentMode() {
return;
}
const auto requested_mode = Config::getPresentMode();
const auto requested_mode = EmulatorSettings::GetInstance()->GetPresentMode();
if (requested_mode == "Mailbox") {
present_mode = vk::PresentModeKHR::eMailbox;
} else if (requested_mode == "Fifo") {
@@ -208,7 +209,7 @@ void Swapchain::FindPresentMode() {
present_mode = vk::PresentModeKHR::eImmediate;
} else {
LOG_ERROR(Render_Vulkan, "Unknown present mode {}, defaulting to Mailbox.",
Config::getPresentMode());
EmulatorSettings::GetInstance()->GetPresentMode());
present_mode = vk::PresentModeKHR::eMailbox;
}