Send neutral stick positions when disconnected rather than down-left

This commit is contained in:
Julien Bernard 2026-02-25 22:50:06 +01:00
parent afc2920a5f
commit 0e8db4fa22
2 changed files with 15 additions and 14 deletions

View File

@ -408,7 +408,8 @@ static void ScanThreadFunc()
#if LIBUSB_API_HAS_HOTPLUG
#ifndef __FreeBSD__
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
if (s_libusb_hotplug_enabled)
{

View File

@ -37,23 +37,23 @@ enum SwitchButton
struct GCPadStatus
{
u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
u8 stickX = 0; // 0 <= stickX <= 255
u8 stickY = 0; // 0 <= stickY <= 255
u8 substickX = 0; // 0 <= substickX <= 255
u8 substickY = 0; // 0 <= substickY <= 255
u8 triggerLeft = 0; // 0 <= triggerLeft <= 255
u8 triggerRight = 0; // 0 <= triggerRight <= 255
u8 analogA = 0; // 0 <= analogA <= 255
u8 analogB = 0; // 0 <= analogB <= 255
// Triforce
u8 switches = 0;
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;
u16 button = 0; // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
u8 stickX = MAIN_STICK_CENTER_X; // 0 <= stickX <= 255
u8 stickY = MAIN_STICK_CENTER_Y; // 0 <= stickY <= 255
u8 substickX = C_STICK_CENTER_X; // 0 <= substickX <= 255
u8 substickY = C_STICK_CENTER_Y; // 0 <= substickY <= 255
u8 triggerLeft = 0; // 0 <= triggerLeft <= 255
u8 triggerRight = 0; // 0 <= triggerRight <= 255
u8 analogA = 0; // 0 <= analogA <= 255
u8 analogB = 0; // 0 <= analogB <= 255
// Triforce
u8 switches = 0;
bool isConnected = true;
};