Ds4 Speaker Audio Rebase Fix (#3607)

* Logic update, no QT ui

* Fixing errors

* Gui boxes

* fixes

* prevent device list refreshing too fast when game not running

* Removed duplicate Socket declarations in kernel/file_system.cpp and fs.h

* Fixed clang-format and micDevice errors

* Ran clang-format and fixed rebase compiler issues

* Settings dialog fix

* Addressed squidbus' concerns

* Update config.cpp to adhere to clang-format

* Removed a space causing clang-format to complain

* Addressed squidbus' concerns and added fallbacks

Concerns:
- Changed dev_name construct to remove unnecessary cast
- Added an invalid AudioDeviceID macro to replace magic number

---------

Co-authored-by: rainmakerv2 <30595646+rainmakerv3@users.noreply.github.com>
This commit is contained in:
nickci2002
2025-09-18 01:28:12 -04:00
committed by GitHub
parent 7101caa80b
commit 0d09c32df9
12 changed files with 304 additions and 106 deletions

View File

@@ -136,10 +136,14 @@ static ConfigEntry<bool> useSpecialPad(false);
static ConfigEntry<int> specialPadClass(1);
static ConfigEntry<bool> isMotionControlsEnabled(true);
static ConfigEntry<bool> useUnifiedInputConfig(true);
static ConfigEntry<string> micDevice("Default Device");
static ConfigEntry<string> defaultControllerID("");
static ConfigEntry<bool> backgroundControllerInput(false);
// Audio
static ConfigEntry<string> micDevice("Default Device");
static ConfigEntry<string> mainOutputDevice("Default Device");
static ConfigEntry<string> padSpkOutputDevice("Default Device");
// GPU
static ConfigEntry<u32> windowWidth(1280);
static ConfigEntry<u32> windowHeight(720);
@@ -302,6 +306,14 @@ string getMicDevice() {
return micDevice.get();
}
std::string getMainOutputDevice() {
return mainOutputDevice.get();
}
std::string getPadSpkOutputDevice() {
return padSpkOutputDevice.get();
}
double getTrophyNotificationDuration() {
return trophyNotificationDuration.get();
}
@@ -581,10 +593,18 @@ void setCursorHideTimeout(int newcursorHideTimeout, bool is_game_specific) {
cursorHideTimeout.set(newcursorHideTimeout, is_game_specific);
}
void setMicDevice(string device, bool is_game_specific) {
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 setTrophyNotificationDuration(double newTrophyNotificationDuration, bool is_game_specific) {
trophyNotificationDuration.set(newTrophyNotificationDuration, is_game_specific);
}
@@ -826,10 +846,17 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
specialPadClass.setFromToml(input, "specialPadClass", is_game_specific);
isMotionControlsEnabled.setFromToml(input, "isMotionControlsEnabled", is_game_specific);
useUnifiedInputConfig.setFromToml(input, "useUnifiedInputConfig", is_game_specific);
micDevice.setFromToml(input, "micDevice", is_game_specific);
backgroundControllerInput.setFromToml(input, "backgroundControllerInput", is_game_specific);
}
if (data.contains("Audio")) {
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")) {
const toml::value& gpu = data.at("GPU");
@@ -999,10 +1026,13 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
cursorHideTimeout.setTomlValue(data, "Input", "cursorHideTimeout", is_game_specific);
isMotionControlsEnabled.setTomlValue(data, "Input", "isMotionControlsEnabled",
is_game_specific);
micDevice.setTomlValue(data, "Input", "micDevice", is_game_specific);
backgroundControllerInput.setTomlValue(data, "Input", "backgroundControllerInput",
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);
isNullGpu.setTomlValue(data, "GPU", "nullGpu", is_game_specific);
@@ -1036,9 +1066,8 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific);
// All other entries
if (!is_game_specific) {
std::vector<string> install_dirs;
std::vector<std::string> install_dirs;
std::vector<bool> install_dirs_enabled;
// temporary structure for ordering
@@ -1077,23 +1106,18 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
data["GUI"]["loadGameSizeEnabled"] = load_game_size;
data["GUI"]["addonInstallDir"] =
string{fmt::UTF(settings_addon_install_dir.u8string()).data};
data["Debug"]["ConfigVersion"] = config_version;
data["Keys"]["TrophyKey"] = trophyKey;
// Do not save these entries in the game-specific dialog since they are not in the GUI
data["General"]["defaultControllerID"] = defaultControllerID.base_value;
data["Input"]["useSpecialPad"] = useSpecialPad.base_value;
data["Input"]["specialPadClass"] = specialPadClass.base_value;
data["Input"]["useUnifiedInputConfig"] = useUnifiedInputConfig.base_value;
data["GPU"]["internalScreenWidth"] = internalScreenWidth.base_value;
data["GPU"]["internalScreenHeight"] = internalScreenHeight.base_value;
data["GPU"]["patchShaders"] = shouldPatchShaders.base_value;
data["Vulkan"]["validation_gpu"] = vkValidationGpu.base_value;
data["Debug"]["FPSColor"] = isFpsColor.base_value;
}
@@ -1135,9 +1159,11 @@ void setDefaultValues(bool is_game_specific) {
cursorState.set(HideCursorState::Idle, is_game_specific);
cursorHideTimeout.set(5, is_game_specific);
isMotionControlsEnabled.set(true, is_game_specific);
micDevice.set("Default Device", is_game_specific);
backgroundControllerInput.set(false, is_game_specific);
// GS - Audio
micDevice.set("Default Device", is_game_specific);
// GS - GPU
windowWidth.set(1280, is_game_specific);
windowHeight.set(720, is_game_specific);
@@ -1184,11 +1210,14 @@ void setDefaultValues(bool is_game_specific) {
useSpecialPad.base_value = false;
specialPadClass.base_value = 1;
useUnifiedInputConfig.base_value = true;
overrideControllerColor = false;
controllerCustomColorRGB[0] = 0;
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;