From dd12266c26f6e1bf0091041d22fbbd68886d0a40 Mon Sep 17 00:00:00 2001 From: xbzk Date: Sun, 9 Aug 2026 02:53:37 +0200 Subject: [PATCH] [input] added option to disable wgi/xinput to prevent SDL GUIDE hack (#4237) - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- So, many users hate the fact when they press START+SELECT, an additional HOME event is sent. That is annoying coz for most users' default hotkey settings, it closes eden when not in game, and when in game it calls a NOT controller responsive prompt about leaving Eden. There are several games with reasons to press start+select, also there are homebrews which relies on that combo to open internal menus. Again. That is annoying. Digging deep i've found that SDL implements something called guide hack: When Start+Select is pressed it sends a synthetic GUIDE(which code equals to HOME). This was intended for controllers missing the HOME button, but SDL fails to track them all, and misses API to disabling it. I've figured out a patch to SDL to disable it, but since it would be better to invest on a PR straight into SDL repo, on our side i thought it better to simply add an option to disable WGI (Windows.Gaming.Input) and Xinput, both paths which could lead into the hack enabling. Setting is available in a remote place no one will bother. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4237 Reviewed-by: Samuel Reviewed-by: MaranBr --- src/common/settings.h | 10 +++++++++- src/input_common/drivers/sdl_driver.cpp | 7 +++++++ .../configuration/configure_input_advanced.cpp | 3 +++ .../configuration/configure_input_advanced.ui | 16 ++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/common/settings.h b/src/common/settings.h index d25d5f690b..0f35045622 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -702,7 +702,15 @@ struct Values { // Controls InputSetting> players; - + Setting disable_wgi_xinput{ + linkage, false, "disable_wgi_xinput", Category::Controls, Specialization::Default, +// Only read/write disable_wgi_xinput on Windows platforms +#ifdef _WIN32 + true +#else + false +#endif + }; Setting enable_raw_input{ linkage, false, "enable_raw_input", Category::Controls, Specialization::Default, // Only read/write enable_raw_input on Windows platforms diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index a656dcf077..dd7e8edc30 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -648,6 +648,13 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en // Disable raw input. When enabled this setting causes SDL to die when a web applet opens SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, Settings::values.enable_raw_input ? "1" : "0"); +#ifdef _WIN32 + if (Settings::values.disable_wgi_xinput) { + SDL_SetHintWithPriority(SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, "0", SDL_HINT_OVERRIDE); + SDL_SetHintWithPriority(SDL_HINT_JOYSTICK_WGI, "0", SDL_HINT_OVERRIDE); + } +#endif + // SDL3 defaults Steam Controller Bluetooth HIDAPI support to off, which can disable gyro. SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_STEAM, "1"); SDL_SetHint(SDL_HINT_GAMECONTROLLER_SENSOR_FUSION, "1"); diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index d8f0ab7e6c..47b30322aa 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp @@ -99,6 +99,7 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(Core::HID::HIDCore& hid_core_, QW #ifndef _WIN32 ui->enable_raw_input->setVisible(false); + ui->disable_wgi_xinput->setVisible(false); #endif LoadConfiguration(); @@ -139,6 +140,7 @@ void ConfigureInputAdvanced::ApplyConfiguration() { Settings::values.emulate_analog_keyboard = ui->emulate_analog_keyboard->isChecked(); Settings::values.touchscreen.enabled = ui->touchscreen_enabled->isChecked(); Settings::values.enable_raw_input = ui->enable_raw_input->isChecked(); + Settings::values.disable_wgi_xinput = ui->disable_wgi_xinput->isChecked(); Settings::values.enable_udp_controller = ui->enable_udp_controller->isChecked(); Settings::values.controller_navigation = ui->controller_navigation->isChecked(); Settings::values.enable_ring_controller = ui->enable_ring_controller->isChecked(); @@ -174,6 +176,7 @@ void ConfigureInputAdvanced::LoadConfiguration() { ui->emulate_analog_keyboard->setChecked(Settings::values.emulate_analog_keyboard.GetValue()); ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled); ui->enable_raw_input->setChecked(Settings::values.enable_raw_input.GetValue()); + ui->disable_wgi_xinput->setChecked(Settings::values.disable_wgi_xinput.GetValue()); ui->enable_udp_controller->setChecked(Settings::values.enable_udp_controller.GetValue()); ui->controller_navigation->setChecked(Settings::values.controller_navigation.GetValue()); ui->enable_ring_controller->setChecked(Settings::values.enable_ring_controller.GetValue()); diff --git a/src/yuzu/configuration/configure_input_advanced.ui b/src/yuzu/configuration/configure_input_advanced.ui index f489d93965..a082523216 100644 --- a/src/yuzu/configuration/configure_input_advanced.ui +++ b/src/yuzu/configuration/configure_input_advanced.ui @@ -2757,6 +2757,22 @@ + + + + Aimed to disable SDL GUIDE button hack: synthetic GUIDE(HOME) event when SELECT(MINUS) + START(PLUS) pressed. May impact Win related trigger/rumble/etc stuff + + + + 0 + 23 + + + + Disable SDL WGI/XInput (Requires restart) + + +