Reverted: Added Steam Virtual Gamepad support to the GameInput driver

This version of SDL doesn't support newer GameInput versions required for this feature.
This commit is contained in:
Sam Lantinga
2025-07-24 14:00:20 -07:00
parent a140bba55a
commit 707717e94b

View File

@@ -46,7 +46,6 @@ typedef struct GAMEINPUT_InternalDevice
SDL_GUID guid; // generated by SDL
SDL_JoystickID device_instance; // generated by SDL
const GameInputDeviceInfo *info;
int steam_virtual_gamepad_slot;
bool isAdded;
bool isDeleteRequested;
} GAMEINPUT_InternalDevice;
@@ -78,18 +77,6 @@ static bool GAMEINPUT_InternalIsGamepad(const GameInputDeviceInfo *info)
return false;
}
#if GAMEINPUT_API_VERSION >= 1
static int GetSteamVirtualGamepadSlot(const char *device_path)
{
int slot = -1;
// The format for the raw input device path is documented here:
// https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices
(void)SDL_sscanf(device_path, "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%*X&%*X&%*X#%d#%*u", &slot);
return slot;
}
#endif // GAMEINPUT_API_VERSION >= 1
static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
{
GAMEINPUT_InternalDevice **devicelist = NULL;
@@ -160,11 +147,6 @@ static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
elem->guid = SDL_CreateJoystickGUID(bus, vendor, product, version, manufacturer_string, product_string, 'g', 0);
elem->device_instance = SDL_GetNextObjectID();
elem->info = info;
#if GAMEINPUT_API_VERSION >= 1
elem->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot(info->pnpPath);
#else
elem->steam_virtual_gamepad_slot = -1;
#endif
g_GameInputList.devices = devicelist;
g_GameInputList.devices[g_GameInputList.count++] = elem;
@@ -351,7 +333,7 @@ static const char *GAMEINPUT_JoystickGetDevicePath(int device_index)
static int GAMEINPUT_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
{
return GAMEINPUT_InternalFindByIndex(device_index)->steam_virtual_gamepad_slot;
return -1;
}
static int GAMEINPUT_JoystickGetDevicePlayerIndex(int device_index)