more settings

This commit is contained in:
georgemoralis
2025-11-28 15:11:41 +02:00
parent 6ee0ee65ad
commit 039b145159
8 changed files with 17 additions and 35 deletions

View File

@@ -160,7 +160,6 @@ static ConfigEntry<bool> directMemoryAccessEnabled(false);
static ConfigEntry<bool> shouldDumpShaders(false); static ConfigEntry<bool> shouldDumpShaders(false);
static ConfigEntry<bool> shouldPatchShaders(false); static ConfigEntry<bool> shouldPatchShaders(false);
static ConfigEntry<u32> vblankFrequency(60); static ConfigEntry<u32> vblankFrequency(60);
static ConfigEntry<bool> isFullscreen(false);
static ConfigEntry<string> fullscreenMode("Windowed"); static ConfigEntry<string> fullscreenMode("Windowed");
static ConfigEntry<string> presentMode("Mailbox"); static ConfigEntry<string> presentMode("Mailbox");
static ConfigEntry<bool> isHDRAllowed(false); static ConfigEntry<bool> isHDRAllowed(false);
@@ -169,7 +168,6 @@ static ConfigEntry<bool> rcasEnabled(true);
static ConfigEntry<int> rcasAttenuation(250); static ConfigEntry<int> rcasAttenuation(250);
// Vulkan // Vulkan
static ConfigEntry<s32> gpuId(-1);
static ConfigEntry<bool> vkValidation(false); static ConfigEntry<bool> vkValidation(false);
static ConfigEntry<bool> vkValidationCore(true); static ConfigEntry<bool> vkValidationCore(true);
static ConfigEntry<bool> vkValidationSync(false); static ConfigEntry<bool> vkValidationSync(false);
@@ -270,10 +268,6 @@ void setVolumeSlider(int volumeValue, bool is_game_specific) {
volumeSlider.set(volumeValue, is_game_specific); volumeSlider.set(volumeValue, is_game_specific);
} }
bool getIsFullscreen() {
return isFullscreen.get();
}
string getFullscreenMode() { string getFullscreenMode() {
return fullscreenMode.get(); return fullscreenMode.get();
} }
@@ -318,9 +312,6 @@ u32 getInternalScreenHeight() {
return internalScreenHeight.get(); return internalScreenHeight.get();
} }
s32 getGpuId() {
return gpuId.get();
}
string getUserName() { string getUserName() {
return userName.get(); return userName.get();
@@ -425,10 +416,6 @@ void setVkGuestMarkersEnabled(bool enable, bool is_game_specific) {
vkGuestMarkers.set(enable, is_game_specific); vkGuestMarkers.set(enable, is_game_specific);
} }
void setGpuId(s32 selectedGpuId, bool is_game_specific) {
gpuId.set(selectedGpuId, is_game_specific);
}
void setWindowWidth(u32 width, bool is_game_specific) { void setWindowWidth(u32 width, bool is_game_specific) {
windowWidth.set(width, is_game_specific); windowWidth.set(width, is_game_specific);
} }
@@ -501,10 +488,6 @@ void setVblankFreq(u32 value, bool is_game_specific) {
vblankFrequency.set(value, is_game_specific); vblankFrequency.set(value, is_game_specific);
} }
void setIsFullscreen(bool enable, bool is_game_specific) {
isFullscreen.set(enable, is_game_specific);
}
void setFullscreenMode(string mode, bool is_game_specific) { void setFullscreenMode(string mode, bool is_game_specific) {
fullscreenMode.set(mode, is_game_specific); fullscreenMode.set(mode, is_game_specific);
} }
@@ -682,7 +665,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
shouldDumpShaders.setFromToml(gpu, "dumpShaders", is_game_specific); shouldDumpShaders.setFromToml(gpu, "dumpShaders", is_game_specific);
shouldPatchShaders.setFromToml(gpu, "patchShaders", is_game_specific); shouldPatchShaders.setFromToml(gpu, "patchShaders", is_game_specific);
vblankFrequency.setFromToml(gpu, "vblankFrequency", is_game_specific); vblankFrequency.setFromToml(gpu, "vblankFrequency", is_game_specific);
isFullscreen.setFromToml(gpu, "Fullscreen", is_game_specific);
fullscreenMode.setFromToml(gpu, "FullscreenMode", is_game_specific); fullscreenMode.setFromToml(gpu, "FullscreenMode", is_game_specific);
presentMode.setFromToml(gpu, "presentMode", is_game_specific); presentMode.setFromToml(gpu, "presentMode", is_game_specific);
isHDRAllowed.setFromToml(gpu, "allowHDR", is_game_specific); isHDRAllowed.setFromToml(gpu, "allowHDR", is_game_specific);
@@ -694,7 +676,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
if (data.contains("Vulkan")) { if (data.contains("Vulkan")) {
const toml::value& vk = data.at("Vulkan"); const toml::value& vk = data.at("Vulkan");
gpuId.setFromToml(vk, "gpuId", is_game_specific);
vkValidation.setFromToml(vk, "validation", is_game_specific); vkValidation.setFromToml(vk, "validation", is_game_specific);
vkValidationCore.setFromToml(vk, "validation_core", is_game_specific); vkValidationCore.setFromToml(vk, "validation_core", is_game_specific);
vkValidationSync.setFromToml(vk, "validation_sync", is_game_specific); vkValidationSync.setFromToml(vk, "validation_sync", is_game_specific);
@@ -832,7 +813,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
readbackLinearImagesEnabled.setTomlValue(data, "GPU", "readbackLinearImages", is_game_specific); readbackLinearImagesEnabled.setTomlValue(data, "GPU", "readbackLinearImages", is_game_specific);
shouldDumpShaders.setTomlValue(data, "GPU", "dumpShaders", is_game_specific); shouldDumpShaders.setTomlValue(data, "GPU", "dumpShaders", is_game_specific);
vblankFrequency.setTomlValue(data, "GPU", "vblankFrequency", is_game_specific); vblankFrequency.setTomlValue(data, "GPU", "vblankFrequency", is_game_specific);
isFullscreen.setTomlValue(data, "GPU", "Fullscreen", is_game_specific);
fullscreenMode.setTomlValue(data, "GPU", "FullscreenMode", is_game_specific); fullscreenMode.setTomlValue(data, "GPU", "FullscreenMode", is_game_specific);
presentMode.setTomlValue(data, "GPU", "presentMode", is_game_specific); presentMode.setTomlValue(data, "GPU", "presentMode", is_game_specific);
isHDRAllowed.setTomlValue(data, "GPU", "allowHDR", is_game_specific); isHDRAllowed.setTomlValue(data, "GPU", "allowHDR", is_game_specific);
@@ -841,7 +821,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
rcasAttenuation.setTomlValue(data, "GPU", "rcasAttenuation", is_game_specific); rcasAttenuation.setTomlValue(data, "GPU", "rcasAttenuation", is_game_specific);
directMemoryAccessEnabled.setTomlValue(data, "GPU", "directMemoryAccess", is_game_specific); directMemoryAccessEnabled.setTomlValue(data, "GPU", "directMemoryAccess", is_game_specific);
gpuId.setTomlValue(data, "Vulkan", "gpuId", is_game_specific);
vkValidation.setTomlValue(data, "Vulkan", "validation", is_game_specific); vkValidation.setTomlValue(data, "Vulkan", "validation", is_game_specific);
vkValidationSync.setTomlValue(data, "Vulkan", "validation_sync", is_game_specific); vkValidationSync.setTomlValue(data, "Vulkan", "validation_sync", is_game_specific);
vkValidationCore.setTomlValue(data, "Vulkan", "validation_core", is_game_specific); vkValidationCore.setTomlValue(data, "Vulkan", "validation_core", is_game_specific);
@@ -943,7 +922,6 @@ void setDefaultValues(bool is_game_specific) {
shouldCopyGPUBuffers.set(false, is_game_specific); shouldCopyGPUBuffers.set(false, is_game_specific);
shouldDumpShaders.set(false, is_game_specific); shouldDumpShaders.set(false, is_game_specific);
vblankFrequency.set(60, is_game_specific); vblankFrequency.set(60, is_game_specific);
isFullscreen.set(false, is_game_specific);
fullscreenMode.set("Windowed", is_game_specific); fullscreenMode.set("Windowed", is_game_specific);
presentMode.set("Mailbox", is_game_specific); presentMode.set("Mailbox", is_game_specific);
isHDRAllowed.set(false, is_game_specific); isHDRAllowed.set(false, is_game_specific);
@@ -952,7 +930,6 @@ void setDefaultValues(bool is_game_specific) {
rcasAttenuation.set(250, is_game_specific); rcasAttenuation.set(250, is_game_specific);
// GS - Vulkan // GS - Vulkan
gpuId.set(-1, is_game_specific);
vkValidation.set(false, is_game_specific); vkValidation.set(false, is_game_specific);
vkValidationCore.set(true, is_game_specific); vkValidationCore.set(true, is_game_specific);
vkValidationSync.set(false, is_game_specific); vkValidationSync.set(false, is_game_specific);

View File

@@ -33,8 +33,6 @@ int getVolumeSlider();
void setVolumeSlider(int volumeValue, bool is_game_specific = false); void setVolumeSlider(int volumeValue, bool is_game_specific = false);
std::string getTrophyKey(); std::string getTrophyKey();
void setTrophyKey(std::string key); void setTrophyKey(std::string key);
bool getIsFullscreen();
void setIsFullscreen(bool enable, bool is_game_specific = false);
std::string getFullscreenMode(); std::string getFullscreenMode();
void setFullscreenMode(std::string mode, bool is_game_specific = false); void setFullscreenMode(std::string mode, bool is_game_specific = false);
std::string getPresentMode(); std::string getPresentMode();
@@ -47,8 +45,6 @@ u32 getInternalScreenWidth();
u32 getInternalScreenHeight(); u32 getInternalScreenHeight();
void setInternalScreenWidth(u32 width); void setInternalScreenWidth(u32 width);
void setInternalScreenHeight(u32 height); void setInternalScreenHeight(u32 height);
s32 getGpuId();
void setGpuId(s32 selectedGpuId, bool is_game_specific = false);
bool allowHDR(); bool allowHDR();
void setAllowHDR(bool enable, bool is_game_specific = false); void setAllowHDR(bool enable, bool is_game_specific = false);
bool nullGpu(); bool nullGpu();

View File

@@ -348,7 +348,7 @@ bool EmulatorSettings::Load(const std::string& serial) {
} }
} }
void EmulatorSettings::setDefaultValues() { void EmulatorSettings::SetDefaultValues() {
m_general = GeneralSettings{}; m_general = GeneralSettings{};
m_debug = DebugSettings{}; m_debug = DebugSettings{};
m_input = InputSettings{}; m_input = InputSettings{};

View File

@@ -233,12 +233,15 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GPUSettings, window_width, window_height, int
// ------------------------------- // -------------------------------
struct VulkanSettings { struct VulkanSettings {
Setting<s32> gpu_id{-1}; Setting<s32> gpu_id{-1};
Setting<bool> full_screen{false};
// TODO // TODO
std::vector<OverrideItem> GetOverrideableFields() const { std::vector<OverrideItem> GetOverrideableFields() const {
return std::vector<OverrideItem>{}; return std::vector<OverrideItem>{
make_override<VulkanSettings>("gpu_id", &VulkanSettings::gpu_id),
make_override<VulkanSettings>("full_screen", &VulkanSettings::full_screen)};
} }
}; };
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VulkanSettings, gpu_id) NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VulkanSettings, gpu_id,full_screen)
// ------------------------------- // -------------------------------
// User settings // User settings
// ------------------------------- // -------------------------------
@@ -258,7 +261,7 @@ public:
bool Save(const std::string& serial = "") const; bool Save(const std::string& serial = "") const;
bool Load(const std::string& serial = ""); bool Load(const std::string& serial = "");
void setDefaultValues(); void SetDefaultValues();
// general accessors // general accessors
bool AddGameInstallDir(const std::filesystem::path& dir, bool enabled = true); bool AddGameInstallDir(const std::filesystem::path& dir, bool enabled = true);
@@ -344,6 +347,10 @@ public:
SETTING_FORWARD_BOOL(m_debug, DebugDump, debug_dump) SETTING_FORWARD_BOOL(m_debug, DebugDump, debug_dump)
SETTING_FORWARD_BOOL(m_debug, ShaderDump, shader_dump) SETTING_FORWARD_BOOL(m_debug, ShaderDump, shader_dump)
// Vulkan settings
SETTING_FORWARD(m_vulkan, GpuId, gpu_id)
SETTING_FORWARD_BOOL(m_vulkan, FullScreen, full_screen)
#undef SETTING_FORWARD #undef SETTING_FORWARD
#undef SETTING_FORWARD_BOOL #undef SETTING_FORWARD_BOOL
}; };

View File

@@ -216,7 +216,7 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
LOG_INFO(Config, "GPU shouldDumpShaders: {}", Config::dumpShaders()); LOG_INFO(Config, "GPU shouldDumpShaders: {}", Config::dumpShaders());
LOG_INFO(Config, "GPU vblankFrequency: {}", Config::vblankFreq()); LOG_INFO(Config, "GPU vblankFrequency: {}", Config::vblankFreq());
LOG_INFO(Config, "GPU shouldCopyGPUBuffers: {}", Config::copyGPUCmdBuffers()); LOG_INFO(Config, "GPU shouldCopyGPUBuffers: {}", Config::copyGPUCmdBuffers());
LOG_INFO(Config, "Vulkan gpuId: {}", Config::getGpuId()); LOG_INFO(Config, "Vulkan gpuId: {}", EmulatorSettings::GetInstance()->GetGpuId());
LOG_INFO(Config, "Vulkan vkValidation: {}", Config::vkValidationEnabled()); LOG_INFO(Config, "Vulkan vkValidation: {}", Config::vkValidationEnabled());
LOG_INFO(Config, "Vulkan vkValidationCore: {}", Config::vkValidationCoreEnabled()); LOG_INFO(Config, "Vulkan vkValidationCore: {}", Config::vkValidationCoreEnabled());
LOG_INFO(Config, "Vulkan vkValidationSync: {}", Config::vkValidationSyncEnabled()); LOG_INFO(Config, "Vulkan vkValidationSync: {}", Config::vkValidationSyncEnabled());

View File

@@ -117,7 +117,7 @@ int main(int argc, char* argv[]) {
exit(1); exit(1);
} }
// Set fullscreen mode without saving it to config file // Set fullscreen mode without saving it to config file
Config::setIsFullscreen(is_fullscreen); EmulatorSettings::GetInstance()->SetFullScreen(is_fullscreen);
}}, }},
{"--fullscreen", [&](int& i) { arg_map["-f"](i); }}, {"--fullscreen", [&](int& i) { arg_map["-f"](i); }},
{"--add-game-folder", {"--add-game-folder",

View File

@@ -12,6 +12,7 @@
#include "common/elf_info.h" #include "common/elf_info.h"
#include "core/debug_state.h" #include "core/debug_state.h"
#include "core/devtools/layer.h" #include "core/devtools/layer.h"
#include "core/emulator_settings.h"
#include "core/libraries/kernel/time.h" #include "core/libraries/kernel/time.h"
#include "core/libraries/pad/pad.h" #include "core/libraries/pad/pad.h"
#include "imgui/renderer/imgui_core.h" #include "imgui/renderer/imgui_core.h"
@@ -317,7 +318,7 @@ WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_
SDL_SetWindowFullscreenMode( SDL_SetWindowFullscreenMode(
window, Config::getFullscreenMode() == "Fullscreen" ? displayMode : NULL); window, Config::getFullscreenMode() == "Fullscreen" ? displayMode : NULL);
} }
SDL_SetWindowFullscreen(window, Config::getIsFullscreen()); SDL_SetWindowFullscreen(window, EmulatorSettings::GetInstance()->IsFullScreen());
SDL_InitSubSystem(SDL_INIT_GAMEPAD); SDL_InitSubSystem(SDL_INIT_GAMEPAD);
controller->SetEngine(std::make_unique<Input::SDLInputEngine>()); controller->SetEngine(std::make_unique<Input::SDLInputEngine>());

View File

@@ -7,6 +7,7 @@
#include "common/singleton.h" #include "common/singleton.h"
#include "core/debug_state.h" #include "core/debug_state.h"
#include "core/devtools/layer.h" #include "core/devtools/layer.h"
#include "core/emulator_settings.h"
#include "core/libraries/system/systemservice.h" #include "core/libraries/system/systemservice.h"
#include "imgui/renderer/imgui_core.h" #include "imgui/renderer/imgui_core.h"
#include "imgui/renderer/imgui_impl_vulkan.h" #include "imgui/renderer/imgui_impl_vulkan.h"
@@ -104,7 +105,7 @@ static vk::Rect2D FitImage(s32 frame_width, s32 frame_height, s32 swapchain_widt
Presenter::Presenter(Frontend::WindowSDL& window_, AmdGpu::Liverpool* liverpool_) Presenter::Presenter(Frontend::WindowSDL& window_, AmdGpu::Liverpool* liverpool_)
: window{window_}, liverpool{liverpool_}, : window{window_}, liverpool{liverpool_},
instance{window, Config::getGpuId(), Config::vkValidationEnabled(), instance{window, EmulatorSettings::GetInstance()->GetGpuId(), Config::vkValidationEnabled(),
Config::getVkCrashDiagnosticEnabled()}, Config::getVkCrashDiagnosticEnabled()},
draw_scheduler{instance}, present_scheduler{instance}, flip_scheduler{instance}, draw_scheduler{instance}, present_scheduler{instance}, flip_scheduler{instance},
swapchain{instance, window}, swapchain{instance, window},