mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
Qt: Toggle for DualSense Player LED (#3254)
This commit is contained in:
parent
3172eac8df
commit
d9ada75d4f
|
@ -3707,6 +3707,10 @@ void FullscreenUI::DrawControllerSettingsPage()
|
||||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_WIFI, "SDL DualShock 4 / DualSense Enhanced Mode"),
|
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_WIFI, "SDL DualShock 4 / DualSense Enhanced Mode"),
|
||||||
FSUI_CSTR("Provides vibration and LED control support over Bluetooth."), "InputSources",
|
FSUI_CSTR("Provides vibration and LED control support over Bluetooth."), "InputSources",
|
||||||
"SDLControllerEnhancedMode", false, bsi->GetBoolValue("InputSources", "SDL", true), false);
|
"SDLControllerEnhancedMode", false, bsi->GetBoolValue("InputSources", "SDL", true), false);
|
||||||
|
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_LIGHTBULB, "SDL DualSense Player LED"),
|
||||||
|
FSUI_CSTR("Enable/Disable the Player LED on DualSense controllers."), "InputSources",
|
||||||
|
"SDLPS5PlayerLED", false, bsi->GetBoolValue("InputSources", "SDLControllerEnhancedMode", true),
|
||||||
|
false);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable XInput Input Source"),
|
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "Enable XInput Input Source"),
|
||||||
FSUI_CSTR("The XInput source provides support for XBox 360/XBox One/XBox Series controllers."),
|
FSUI_CSTR("The XInput source provides support for XBox 360/XBox One/XBox Series controllers."),
|
||||||
|
|
|
@ -134,6 +134,9 @@ ControllerLEDSettingsDialog::ControllerLEDSettingsDialog(QWidget* parent, Contro
|
||||||
linkButton(m_ui.SDL2LED, 2);
|
linkButton(m_ui.SDL2LED, 2);
|
||||||
linkButton(m_ui.SDL3LED, 3);
|
linkButton(m_ui.SDL3LED, 3);
|
||||||
|
|
||||||
|
SettingsInterface* sif = dialog->getProfileSettingsInterface();
|
||||||
|
|
||||||
|
ControllerSettingWidgetBinder::BindWidgetToInputProfileBool(sif, m_ui.enableSDLPS5PlayerLED, "InputSources", "SDLPS5PlayerLED", false);
|
||||||
connect(m_ui.buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &QDialog::accept);
|
connect(m_ui.buttonBox->button(QDialogButtonBox::Close), &QPushButton::clicked, this, &QDialog::accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>501</width>
|
<width>501</width>
|
||||||
<height>108</height>
|
<height>128</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -26,14 +26,14 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="3">
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_4">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>SDL-1 LED</string>
|
<string>SDL-3 LED</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="ColorPickerButton" name="SDL1LED"/>
|
<widget class="ColorPickerButton" name="SDL3LED"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -50,24 +50,53 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="0" column="1">
|
||||||
<widget class="QGroupBox" name="groupBox_4">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>SDL-3 LED</string>
|
<string>SDL-1 LED</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="ColorPickerButton" name="SDL3LED"/>
|
<widget class="ColorPickerButton" name="SDL1LED"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="4">
|
<item row="3" column="0" colspan="4">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||||
<property name="standardButtons">
|
<property name="sizeConstraint">
|
||||||
<set>QDialogButtonBox::Close</set>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="enableSDLPS5PlayerLED">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable DualSense Player LED</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -1283,6 +1283,7 @@ void InputManager::SetDefaultSourceConfig(SettingsInterface& si)
|
||||||
si.ClearSection("InputSources");
|
si.ClearSection("InputSources");
|
||||||
si.SetBoolValue("InputSources", "SDL", true);
|
si.SetBoolValue("InputSources", "SDL", true);
|
||||||
si.SetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
|
si.SetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
|
||||||
|
si.SetBoolValue("InputSources", "SDLPS5PlayerLED", false);
|
||||||
si.SetBoolValue("InputSources", "XInput", false);
|
si.SetBoolValue("InputSources", "XInput", false);
|
||||||
si.SetBoolValue("InputSources", "RawInput", false);
|
si.SetBoolValue("InputSources", "RawInput", false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@ bool SDLInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mut
|
||||||
void SDLInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
void SDLInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock)
|
||||||
{
|
{
|
||||||
const bool old_controller_enhanced_mode = m_controller_enhanced_mode;
|
const bool old_controller_enhanced_mode = m_controller_enhanced_mode;
|
||||||
|
const bool old_controller_ps5_player_led = m_controller_ps5_player_led;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
const bool old_enable_iokit_driver = m_enable_iokit_driver;
|
const bool old_enable_iokit_driver = m_enable_iokit_driver;
|
||||||
|
@ -188,7 +189,9 @@ void SDLInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std:
|
||||||
constexpr bool drivers_changed = false;
|
constexpr bool drivers_changed = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_controller_enhanced_mode != old_controller_enhanced_mode || drivers_changed)
|
if (m_controller_enhanced_mode != old_controller_enhanced_mode ||
|
||||||
|
m_controller_ps5_player_led != old_controller_ps5_player_led ||
|
||||||
|
drivers_changed)
|
||||||
{
|
{
|
||||||
settings_lock.unlock();
|
settings_lock.unlock();
|
||||||
ShutdownSubsystem();
|
ShutdownSubsystem();
|
||||||
|
@ -228,6 +231,7 @@ void SDLInputSource::LoadSettings(SettingsInterface& si)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_controller_enhanced_mode = si.GetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
|
m_controller_enhanced_mode = si.GetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
|
||||||
|
m_controller_ps5_player_led = si.GetBoolValue("InputSources", "SDLPS5PlayerLED", false);
|
||||||
m_sdl_hints = si.GetKeyValueList("SDLHints");
|
m_sdl_hints = si.GetKeyValueList("SDLHints");
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -275,6 +279,7 @@ void SDLInputSource::SetHints()
|
||||||
|
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
|
||||||
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, m_controller_ps5_player_led ? "1" : "0");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_WII, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_WII, "1");
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS3, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS3, "1");
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ private:
|
||||||
|
|
||||||
bool m_sdl_subsystem_initialized = false;
|
bool m_sdl_subsystem_initialized = false;
|
||||||
bool m_controller_enhanced_mode = false;
|
bool m_controller_enhanced_mode = false;
|
||||||
|
bool m_controller_ps5_player_led = false;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
bool m_enable_iokit_driver = false;
|
bool m_enable_iokit_driver = false;
|
||||||
|
|
Loading…
Reference in a new issue