usbd: Implement usb backend system (#3737)

* initial impl

* reviews

* upstreamed deReaperJosh changes

* fixed config.cpp

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
This commit is contained in:
ElBread3
2025-10-31 09:11:14 +00:00
committed by GitHub
parent ed9ffbfb64
commit eda6be746f
7 changed files with 597 additions and 62 deletions

View File

@@ -208,6 +208,9 @@ std::filesystem::path save_data_path = {};
// Settings
ConfigEntry<u32> m_language(1); // english
// USB Device
static ConfigEntry<int> usbDeviceBackend(UsbBackendType::Real);
// Keys
static string trophyKey = "";
@@ -817,6 +820,14 @@ void setRcasAttenuation(int value, bool is_game_specific) {
rcasAttenuation.set(value, is_game_specific);
}
int getUsbDeviceBackend() {
return usbDeviceBackend.get();
}
void setUsbDeviceBackend(int value, bool is_game_specific) {
usbDeviceBackend.set(value, is_game_specific);
}
bool getLoadAutoPatches() {
return load_auto_patches;
}
@@ -881,6 +892,7 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
isMotionControlsEnabled.setFromToml(input, "isMotionControlsEnabled", is_game_specific);
useUnifiedInputConfig.setFromToml(input, "useUnifiedInputConfig", is_game_specific);
backgroundControllerInput.setFromToml(input, "backgroundControllerInput", is_game_specific);
usbDeviceBackend.setFromToml(input, "usbDeviceBackend", is_game_specific);
}
if (data.contains("Audio")) {
@@ -1063,6 +1075,7 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
is_game_specific);
backgroundControllerInput.setTomlValue(data, "Input", "backgroundControllerInput",
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);
@@ -1194,6 +1207,7 @@ void setDefaultValues(bool is_game_specific) {
cursorHideTimeout.set(5, is_game_specific);
isMotionControlsEnabled.set(true, is_game_specific);
backgroundControllerInput.set(false, is_game_specific);
usbDeviceBackend.set(UsbBackendType::Real, is_game_specific);
// GS - Audio
micDevice.set("Default Device", is_game_specific);