mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-15 06:16:00 +00:00
Generalized the idea of joystick driver priority
Joystick drivers are sorted by priority in the driver list, and higher priority drivers report whether they are handling a device when lower priority drivers want to add it to their device list. This has been handled ad-hoc with the Windows and HIDAPI drivers, but this formalizes the idea and makes sure that GameInput has the highest priority of the Windows drivers.
This commit is contained in:
@@ -259,6 +259,12 @@ static void EMSCRIPTEN_JoystickDetect(void)
|
||||
{
|
||||
}
|
||||
|
||||
static SDL_bool EMSCRIPTEN_JoystickIsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
|
||||
{
|
||||
/* We don't override any other drivers */
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
static const char *EMSCRIPTEN_JoystickGetDeviceName(int device_index)
|
||||
{
|
||||
return JoystickByDeviceIndex(device_index)->name;
|
||||
@@ -414,6 +420,7 @@ SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver = {
|
||||
EMSCRIPTEN_JoystickInit,
|
||||
EMSCRIPTEN_JoystickGetCount,
|
||||
EMSCRIPTEN_JoystickDetect,
|
||||
EMSCRIPTEN_JoystickIsDevicePresent,
|
||||
EMSCRIPTEN_JoystickGetDeviceName,
|
||||
EMSCRIPTEN_JoystickGetDevicePath,
|
||||
EMSCRIPTEN_JoystickGetDeviceSteamVirtualGamepadSlot,
|
||||
|
Reference in New Issue
Block a user