From a8f1e2e63f3927c20a96ae56d717f5cb2472e4a1 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Thu, 25 Dec 2025 18:15:19 +0200 Subject: [PATCH] added more settings --- src/common/config.cpp | 26 -------------------------- src/common/config.h | 4 ---- src/core/emulator_settings.h | 13 ++++++++++--- src/core/libraries/audio/sdl_audio.cpp | 7 ++++--- src/emulator.cpp | 2 +- 5 files changed, 15 insertions(+), 37 deletions(-) diff --git a/src/common/config.cpp b/src/common/config.cpp index f1fe62a1f..e7316054b 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -156,8 +156,6 @@ static ConfigEntry backgroundControllerInput(false); // Audio static ConfigEntry micDevice("Default Device"); -static ConfigEntry mainOutputDevice("Default Device"); -static ConfigEntry padSpkOutputDevice("Default Device"); // GPU static ConfigEntry windowWidth(1280); @@ -275,14 +273,6 @@ string getMicDevice() { return micDevice.get(); } -std::string getMainOutputDevice() { - return mainOutputDevice.get(); -} - -std::string getPadSpkOutputDevice() { - return padSpkOutputDevice.get(); -} - u32 getWindowWidth() { return windowWidth.get(); } @@ -504,14 +494,6 @@ void setMicDevice(std::string device, bool is_game_specific) { micDevice.set(device, is_game_specific); } -void setMainOutputDevice(std::string device, bool is_game_specific) { - mainOutputDevice.set(device, is_game_specific); -} - -void setPadSpkOutputDevice(std::string device, bool is_game_specific) { - padSpkOutputDevice.set(device, is_game_specific); -} - void setLanguage(u32 language, bool is_game_specific) { m_language.set(language, is_game_specific); } @@ -634,8 +616,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) { const toml::value& audio = data.at("Audio"); micDevice.setFromToml(audio, "micDevice", is_game_specific); - mainOutputDevice.setFromToml(audio, "mainOutputDevice", is_game_specific); - padSpkOutputDevice.setFromToml(audio, "padSpkOutputDevice", is_game_specific); } if (data.contains("GPU")) { @@ -762,8 +742,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) { usbDeviceBackend.setTomlValue(data, "Input", "usbDeviceBackend", is_game_specific); micDevice.setTomlValue(data, "Audio", "micDevice", is_game_specific); - mainOutputDevice.setTomlValue(data, "Audio", "mainOutputDevice", is_game_specific); - padSpkOutputDevice.setTomlValue(data, "Audio", "padSpkOutputDevice", is_game_specific); windowWidth.setTomlValue(data, "GPU", "screenWidth", is_game_specific); windowHeight.setTomlValue(data, "GPU", "screenHeight", is_game_specific); @@ -877,10 +855,6 @@ void setDefaultValues(bool is_game_specific) { controllerCustomColorRGB[1] = 0; controllerCustomColorRGB[2] = 255; - // TODO: Change to be game specific - mainOutputDevice = "Default Device"; - padSpkOutputDevice = "Default Device"; - // GPU shouldPatchShaders.base_value = false; internalScreenWidth.base_value = 1280; diff --git a/src/common/config.h b/src/common/config.h index 7780719ef..d4898e543 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -78,10 +78,6 @@ void setRdocEnabled(bool enable, bool is_game_specific = false); void setPipelineCacheEnabled(bool enable, bool is_game_specific = false); void setPipelineCacheArchived(bool enable, bool is_game_specific = false); int getCursorHideTimeout(); -std::string getMainOutputDevice(); -void setMainOutputDevice(std::string device, bool is_game_specific = false); -std::string getPadSpkOutputDevice(); -void setPadSpkOutputDevice(std::string device, bool is_game_specific = false); std::string getMicDevice(); void setCursorHideTimeout(int newcursorHideTimeout, bool is_game_specific = false); void setMicDevice(std::string device, bool is_game_specific = false); diff --git a/src/core/emulator_settings.h b/src/core/emulator_settings.h index 2a3f422ca..60c6f21b9 100644 --- a/src/core/emulator_settings.h +++ b/src/core/emulator_settings.h @@ -88,10 +88,10 @@ struct GeneralSettings { Setting psn_signed_in{false}; Setting trophy_popup_disabled{false}; Setting trophy_notification_duration{6.0}; + Setting trophy_notification_side{"right"}; Setting log_filter{""}; Setting log_type{"sync"}; Setting show_splash{false}; - Setting trophy_notification_side{"right"}; Setting connected_to_network{false}; Setting discord_rpc_enabled{false}; @@ -186,7 +186,10 @@ struct AudioSettings { // TODO add overrides std::vector GetOverrideableFields() const { - return std::vector{}; + return std::vector{ + make_override("main_output_device", &AudioSettings::main_output_device), + make_override("padSpk_output_device", + &AudioSettings::padSpk_output_device)}; } }; @@ -340,7 +343,11 @@ public: SETTING_FORWARD(m_general, LogFilter, log_filter) SETTING_FORWARD(m_general, LogType, log_type) SETTING_FORWARD_BOOL(m_general, ConnectedToNetwork, connected_to_network) - SETTING_FORWARD_BOOL(m_general, DiscorRPCEnabled, discord_rpc_enabled) + SETTING_FORWARD_BOOL(m_general, DiscordRPCEnabled, discord_rpc_enabled) + + // Audio settings + SETTING_FORWARD(m_audio, MainOutputDevice, main_output_device) + SETTING_FORWARD(m_audio, PadSpkOutputDevice, padSpk_output_device) // Debug settings SETTING_FORWARD_BOOL(m_debug, SeparateLoggingEnabled, separate_logging_enabled) diff --git a/src/core/libraries/audio/sdl_audio.cpp b/src/core/libraries/audio/sdl_audio.cpp index 46dd33d73..0f711c5e4 100644 --- a/src/core/libraries/audio/sdl_audio.cpp +++ b/src/core/libraries/audio/sdl_audio.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include @@ -8,6 +8,7 @@ #include "common/config.h" #include "common/logging/log.h" +#include "core/emulator_settings.h" #include "core/libraries/audio/audioout.h" #include "core/libraries/audio/audioout_backend.h" @@ -26,8 +27,8 @@ public: // Determine port type std::string port_name = port.type == OrbisAudioOutPort::PadSpk - ? Config::getPadSpkOutputDevice() - : Config::getMainOutputDevice(); + ? EmulatorSettings::GetInstance()->GetPadSpkOutputDevice() + : EmulatorSettings::GetInstance()->GetMainOutputDevice(); SDL_AudioDeviceID dev_id = SDL_INVALID_AUDIODEVICEID; if (port_name == "None") { stream = nullptr; diff --git a/src/emulator.cpp b/src/emulator.cpp index 31631bfee..673600c33 100644 --- a/src/emulator.cpp +++ b/src/emulator.cpp @@ -360,7 +360,7 @@ void Emulator::Run(std::filesystem::path file, std::vector args, #ifdef ENABLE_DISCORD_RPC // Discord RPC - if (EmulatorSettings::GetInstance()->IsDiscorRPCEnabled()) { + if (EmulatorSettings::GetInstance()->IsDiscordRPCEnabled()) { auto* rpc = Common::Singleton::Instance(); if (rpc->getRPCEnabled() == false) { rpc->init();