|
@@ -49,6 +49,8 @@ typedef struct GAMEINPUT_InternalDevice
|
|
|
SDL_GUID guid; // generated by SDL
|
|
SDL_GUID guid; // generated by SDL
|
|
|
SDL_JoystickID device_instance; // generated by SDL
|
|
SDL_JoystickID device_instance; // generated by SDL
|
|
|
const GameInputDeviceInfo *info;
|
|
const GameInputDeviceInfo *info;
|
|
|
|
|
+ Uint16 vendor;
|
|
|
|
|
+ Uint16 product;
|
|
|
int raw_type;
|
|
int raw_type;
|
|
|
int steam_virtual_gamepad_slot;
|
|
int steam_virtual_gamepad_slot;
|
|
|
bool isAdded;
|
|
bool isAdded;
|
|
@@ -279,6 +281,8 @@ static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
|
|
|
elem->guid = SDL_CreateJoystickGUID(bus, vendor, product, version, NULL, product_string, driver_signature, subtype);
|
|
elem->guid = SDL_CreateJoystickGUID(bus, vendor, product, version, NULL, product_string, driver_signature, subtype);
|
|
|
elem->device_instance = SDL_GetNextObjectID();
|
|
elem->device_instance = SDL_GetNextObjectID();
|
|
|
elem->info = info;
|
|
elem->info = info;
|
|
|
|
|
+ elem->vendor = vendor;
|
|
|
|
|
+ elem->product = product;
|
|
|
elem->raw_type = raw_type;
|
|
elem->raw_type = raw_type;
|
|
|
#if GAMEINPUT_API_VERSION >= 1
|
|
#if GAMEINPUT_API_VERSION >= 1
|
|
|
elem->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot(info->pnpPath);
|
|
elem->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot(info->pnpPath);
|
|
@@ -609,11 +613,15 @@ static bool GAMEINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|
|
|
|
|
|
|
#if GAMEINPUT_API_VERSION >= 1
|
|
#if GAMEINPUT_API_VERSION >= 1
|
|
|
if (info->supportedSystemButtons != GameInputSystemButtonNone) {
|
|
if (info->supportedSystemButtons != GameInputSystemButtonNone) {
|
|
|
- if (info->supportedSystemButtons & GameInputSystemButtonShare) {
|
|
|
|
|
|
|
+ GameInputSystemButtons buttons = GameInputSystemButtonGuide;
|
|
|
|
|
+
|
|
|
|
|
+ if (SDL_IsJoystickXboxSeriesX(elem->vendor, elem->product) &&
|
|
|
|
|
+ (info->supportedSystemButtons & GameInputSystemButtonShare)) {
|
|
|
++joystick->nbuttons;
|
|
++joystick->nbuttons;
|
|
|
|
|
+ buttons |= GameInputSystemButtonShare;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- g_pGameInput->RegisterSystemButtonCallback(elem->device, (GameInputSystemButtonGuide | GameInputSystemButtonShare), joystick, GAMEINPUT_InternalSystemButtonCallback, &hwdata->system_button_callback_token);
|
|
|
|
|
|
|
+ g_pGameInput->RegisterSystemButtonCallback(elem->device, buttons, joystick, GAMEINPUT_InternalSystemButtonCallback, &hwdata->system_button_callback_token);
|
|
|
}
|
|
}
|
|
|
#endif // GAMEINPUT_API_VERSION >= 1
|
|
#endif // GAMEINPUT_API_VERSION >= 1
|
|
|
} else {
|
|
} else {
|
|
@@ -990,7 +998,8 @@ static bool GAMEINPUT_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap
|
|
|
out->guide.target = SDL_GAMEPAD_BUTTON_GUIDE;
|
|
out->guide.target = SDL_GAMEPAD_BUTTON_GUIDE;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (elem->info->supportedSystemButtons & GameInputSystemButtonShare) {
|
|
|
|
|
|
|
+ if (SDL_IsJoystickXboxSeriesX(elem->vendor, elem->product) &&
|
|
|
|
|
+ (elem->info->supportedSystemButtons & GameInputSystemButtonShare)) {
|
|
|
out->misc1.kind = EMappingKind_Button;
|
|
out->misc1.kind = EMappingKind_Button;
|
|
|
out->misc1.target = SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE;
|
|
out->misc1.target = SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE;
|
|
|
}
|
|
}
|