Send neutral stick positions when disconnected rather than down-left

This commit is contained in:
Julien Bernard
2026-02-25 23:06:50 +01:00
parent afc2920a5f
commit 0e8db4fa22
2 changed files with 15 additions and 14 deletions
+2 -1
View File
@@ -408,7 +408,8 @@ static void ScanThreadFunc()
#if LIBUSB_API_HAS_HOTPLUG #if LIBUSB_API_HAS_HOTPLUG
#ifndef __FreeBSD__ #ifndef __FreeBSD__
s_libusb_hotplug_enabled = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) != 0; s_libusb_hotplug_enabled = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG) != 0;
// As of 28/12/2025 libusb has hotplug event capability on Linux & MacOS, but not on Windows // As of v1.0.23-rc1 (2026/02) libusb has hotplug event capability on Linux & MacOS, but not on
// Windows
#endif #endif
if (s_libusb_hotplug_enabled) if (s_libusb_hotplug_enabled)
{ {
+11 -11
View File
@@ -37,11 +37,18 @@ enum SwitchButton
struct GCPadStatus struct GCPadStatus
{ {
static const u8 MAIN_STICK_CENTER_X = 0x80;
static const u8 MAIN_STICK_CENTER_Y = 0x80;
static const u8 MAIN_STICK_RADIUS = 0x7f;
static const u8 C_STICK_CENTER_X = 0x80;
static const u8 C_STICK_CENTER_Y = 0x80;
static const u8 C_STICK_RADIUS = 0x7f;
u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
u8 stickX = 0; // 0 <= stickX <= 255 u8 stickX = MAIN_STICK_CENTER_X; // 0 <= stickX <= 255
u8 stickY = 0; // 0 <= stickY <= 255 u8 stickY = MAIN_STICK_CENTER_Y; // 0 <= stickY <= 255
u8 substickX = 0; // 0 <= substickX <= 255 u8 substickX = C_STICK_CENTER_X; // 0 <= substickX <= 255
u8 substickY = 0; // 0 <= substickY <= 255 u8 substickY = C_STICK_CENTER_Y; // 0 <= substickY <= 255
u8 triggerLeft = 0; // 0 <= triggerLeft <= 255 u8 triggerLeft = 0; // 0 <= triggerLeft <= 255
u8 triggerRight = 0; // 0 <= triggerRight <= 255 u8 triggerRight = 0; // 0 <= triggerRight <= 255
u8 analogA = 0; // 0 <= analogA <= 255 u8 analogA = 0; // 0 <= analogA <= 255
@@ -49,11 +56,4 @@ struct GCPadStatus
// Triforce // Triforce
u8 switches = 0; u8 switches = 0;
bool isConnected = true; bool isConnected = true;
static const u8 MAIN_STICK_CENTER_X = 0x80;
static const u8 MAIN_STICK_CENTER_Y = 0x80;
static const u8 MAIN_STICK_RADIUS = 0x7f;
static const u8 C_STICK_CENTER_X = 0x80;
static const u8 C_STICK_CENTER_Y = 0x80;
static const u8 C_STICK_RADIUS = 0x7f;
}; };