Skip to content

Commit

Permalink
push before testing with QtCreator platform swap (to be squashed)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsyntax committed Feb 27, 2024
1 parent c8f1606 commit 33f9030
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions pcsx2-qt/Settings/ControllerGlobalSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent,

SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLSource, "InputSources", "SDL", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLEnhancedMode, "InputSources", "SDLControllerEnhancedMode", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableSDLPS5PlayerLED, "InputSources", "SDLPS5PlayerLED", false);
connect(m_ui.enableSDLSource, &QCheckBox::stateChanged, this, &ControllerGlobalSettingsWidget::updateSDLOptionsEnabled);
connect(m_ui.ledSettings, &QToolButton::clicked, this, &ControllerGlobalSettingsWidget::ledSettingsClicked);

Expand Down
3 changes: 3 additions & 0 deletions pcsx2/ImGui/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3916,6 +3916,9 @@ void FullscreenUI::DrawControllerSettingsPage()
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_WIFI, "SDL DualShock 4 / DualSense Enhanced Mode"),
FSUI_CSTR("Provides vibration and LED control support over Bluetooth."), "InputSources", "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
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_COG, "SDL Raw Input"), FSUI_CSTR("Allow SDL to use raw access to input devices."),
"InputSources", "SDLRawInput", false, bsi->GetBoolValue("InputSources", "SDL", true), false);
Expand Down
5 changes: 4 additions & 1 deletion pcsx2/Input/SDLInputSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ static constexpr const char* s_sdl_default_led_colors[] = {
static void SetControllerRGBLED(SDL_GameController* gc, u32 color)
{
SDL_GameControllerSetLED(gc, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
SDL_GameControllerSetPlayerIndex(gc, -1);
}

static void SDLLogCallback(void* userdata, int category, SDL_LogPriority priority, const char* message)
Expand Down Expand Up @@ -159,6 +158,7 @@ bool SDLInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mut
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_ps5_player_led = m_controller_ps5_player_led;
const bool old_controller_raw_mode = m_controller_raw_mode;

#ifdef __APPLE__
Expand All @@ -176,6 +176,7 @@ void SDLInputSource::UpdateSettings(SettingsInterface& si, std::unique_lock<std:
#endif

if (m_controller_enhanced_mode != old_controller_enhanced_mode ||
m_controller_ps5_player_led != old_controller_ps5_player_led ||
m_controller_raw_mode != old_controller_raw_mode ||
drivers_changed)
{
Expand Down Expand Up @@ -219,6 +220,7 @@ void SDLInputSource::LoadSettings(SettingsInterface& si)
m_sdl_hints = si.GetKeyValueList("SDLHints");

m_controller_enhanced_mode = si.GetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
m_controller_ps5_player_led = si.GetBoolValue("InputSources", "SDLPS5PlayerLED", false);
m_controller_raw_mode = si.GetBoolValue("InputSources", "SDLRawInput", false);

#ifdef __APPLE__
Expand Down Expand Up @@ -265,6 +267,7 @@ 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_PS5_RUMBLE, m_controller_enhanced_mode ? "1" : "0");
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, m_controller_ps5_player_led ? "1" : "0");
// Enable Wii U Pro Controller support
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_WII, "1");
#ifndef _WIN32
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Input/SDLInputSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class SDLInputSource final : public InputSource
bool m_sdl_subsystem_initialized = false;
bool m_controller_enhanced_mode = false;
bool m_controller_raw_mode = false;
bool m_controller_ps5_player_led = false;

#ifdef __APPLE__
bool m_enable_iokit_driver = false;
Expand Down
2 changes: 2 additions & 0 deletions pcsx2/SIO/Pad/Pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void Pad::SetDefaultControllerConfig(SettingsInterface& si)
InputManager::GetInputSourceDefaultEnabled(static_cast<InputSourceType>(i)));
}
si.SetBoolValue("InputSources", "SDLControllerEnhancedMode", false);
si.SetBoolValue("InputSources", "SDLPS5PlayerLED", false);
si.SetBoolValue("Pad", "MultitapPort1", false);
si.SetBoolValue("Pad", "MultitapPort2", false);
si.SetFloatValue("Pad", "PointerXScale", 8.0f);
Expand Down Expand Up @@ -329,6 +330,7 @@ void Pad::CopyConfiguration(SettingsInterface* dest_si, const SettingsInterface&
InputManager::InputSourceToString(static_cast<InputSourceType>(i)));
}
dest_si->CopyBoolValue(src_si, "InputSources", "SDLControllerEnhancedMode");
dest_si->CopyBoolValue(src_si, "InputSources", "SDLPS5PlayerLED");
}

for (u32 port = 0; port < Pad::NUM_CONTROLLER_PORTS; port++)
Expand Down

0 comments on commit 33f9030

Please sign in to comment.