mirror of https://github.com/PCSX2/pcsx2.git
SDLInputSource: SDL raw input as config option.
This commit is contained in:
parent
e95d75e01f
commit
8a9df89bf6
|
@ -37,11 +37,13 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,
|
||||||
#ifdef SDL_BUILD
|
#ifdef SDL_BUILD
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true);
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true);
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources", "SDLControllerEnhancedMode", false);
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources", "SDLControllerEnhancedMode", false);
|
||||||
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLRawInput, "InputSources", "SDLRawInput", false);
|
||||||
connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this, &ControllerGlobalSettingsWidget::updateSDLOptionsEnabled);
|
connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this, &ControllerGlobalSettingsWidget::updateSDLOptionsEnabled);
|
||||||
connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked);
|
connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked);
|
||||||
#else
|
#else
|
||||||
m_ui.enableSDLSource->setEnabled(false);
|
m_ui.enableSDLSource->setEnabled(false);
|
||||||
m_ui.ledSettings->setEnabled(false);
|
m_ui.ledSettings->setEnabled(false);
|
||||||
|
m_ui.enableSDLRawInput->setEnabled(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableMouseMapping, "UI", "EnableMouseMapping", false);
|
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableMouseMapping, "UI", "EnableMouseMapping", false);
|
||||||
|
@ -113,6 +115,7 @@ void ControllerGlobalSettingsWidget::updateSDLOptionsEnabled()
|
||||||
const bool enabled = m_ui.enableSDLSource->isChecked();
|
const bool enabled = m_ui.enableSDLSource->isChecked();
|
||||||
m_ui.enableSDLEnhancedMode->setEnabled(enabled);
|
m_ui.enableSDLEnhancedMode->setEnabled(enabled);
|
||||||
m_ui.ledSettings->setEnabled(enabled);
|
m_ui.ledSettings->setEnabled(enabled);
|
||||||
|
m_ui.enableSDLRawInput->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
void ControllerGlobalSettingsWidget::ledSettingsClicked()
|
||||||
|
|
|
@ -58,6 +58,13 @@
|
||||||
<string>SDL Input Source</string>
|
<string>SDL Input Source</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QCheckBox" name="enableSDLSource">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable SDL Input Source</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -68,13 +75,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="enableSDLSource">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable SDL Input Source</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
|
@ -97,6 +97,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QCheckBox" name="enableSDLRawInput">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable SDL Raw Input</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -3741,6 +3741,9 @@ void FullscreenUI::DrawControllerSettingsPage()
|
||||||
DrawToggleSetting(bsi, ICON_FA_WIFI " SDL DualShock 4 / DualSense Enhanced Mode",
|
DrawToggleSetting(bsi, ICON_FA_WIFI " SDL DualShock 4 / DualSense Enhanced Mode",
|
||||||
"Provides vibration and LED control support over Bluetooth.", "InputSources", "SDLControllerEnhancedMode", false,
|
"Provides vibration and LED control support over Bluetooth.", "InputSources", "SDLControllerEnhancedMode", false,
|
||||||
bsi->GetBoolValue("InputSources", "SDL", true), false);
|
bsi->GetBoolValue("InputSources", "SDL", true), false);
|
||||||
|
DrawToggleSetting(bsi, ICON_FA_COG " SDL Raw Input",
|
||||||
|
"Allow SDL to use raw access to input devices.", "InputSources", "SDLRawInput", false,
|
||||||
|
bsi->GetBoolValue("InputSources", "SDL", true), false);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DrawToggleSetting(bsi, ICON_FA_COG " Enable XInput Input Source",
|
DrawToggleSetting(bsi, ICON_FA_COG " Enable XInput Input Source",
|
||||||
|
|
|
@ -142,10 +142,11 @@ 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_raw_mode = m_controller_raw_mode;
|
||||||
|
|
||||||
LoadSettings(si);
|
LoadSettings(si);
|
||||||
|
|
||||||
if (m_controller_enhanced_mode != old_controller_enhanced_mode)
|
if (m_controller_enhanced_mode != old_controller_enhanced_mode || m_controller_raw_mode != old_controller_raw_mode)
|
||||||
{
|
{
|
||||||
settings_lock.unlock();
|
settings_lock.unlock();
|
||||||
ShutdownSubsystem();
|
ShutdownSubsystem();
|
||||||
|
@ -170,6 +171,7 @@ void SDLInputSource::Shutdown()
|
||||||
void SDLInputSource::LoadSettings(SettingsInterface& si)
|
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_raw_mode = si.GetBoolValue("InputSources", "SDLRawInput", false);
|
||||||
m_sdl_hints = si.GetKeyValueList("SDLHints");
|
m_sdl_hints = si.GetKeyValueList("SDLHints");
|
||||||
|
|
||||||
for (u32 i = 0; i < MAX_LED_COLORS; i++)
|
for (u32 i = 0; i < MAX_LED_COLORS; i++)
|
||||||
|
@ -208,6 +210,7 @@ u32 SDLInputSource::ParseRGBForPlayerId(const std::string_view& str, u32 player_
|
||||||
|
|
||||||
void SDLInputSource::SetHints()
|
void SDLInputSource::SetHints()
|
||||||
{
|
{
|
||||||
|
SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, m_controller_raw_mode ? "1" : "0");
|
||||||
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");
|
||||||
// Enable Wii U Pro Controller support
|
// Enable Wii U Pro Controller support
|
||||||
|
|
|
@ -97,6 +97,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_raw_mode = false;
|
||||||
std::array<u32, MAX_LED_COLORS> m_led_colors{};
|
std::array<u32, MAX_LED_COLORS> m_led_colors{};
|
||||||
std::vector<std::pair<std::string, std::string>> m_sdl_hints;
|
std::vector<std::pair<std::string, std::string>> m_sdl_hints;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue