Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'

This commit is contained in:
2024-01-17 17:02:59 +01:00
1244 changed files with 50102 additions and 28146 deletions

View File

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -101,6 +101,11 @@ extern "C"
return SDL_joyport[device_index];
}
static int HAIKU_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index)
{
return -1;
}
static int HAIKU_JoystickGetDevicePlayerIndex(int device_index)
{
return -1;
@ -113,7 +118,7 @@ extern "C"
/* Function to perform the mapping from device index to the instance id for this index */
static SDL_JoystickID HAIKU_JoystickGetDeviceInstanceID(int device_index)
{
return device_index;
return device_index + 1;
}
static void HAIKU_JoystickClose(SDL_Joystick *joystick);
@ -129,12 +134,10 @@ extern "C"
/* Create the joystick data structure */
joystick->instance_id = device_index;
joystick->hwdata = (struct joystick_hwdata *)
SDL_malloc(sizeof(*joystick->hwdata));
joystick->hwdata = (struct joystick_hwdata *) SDL_calloc(1, sizeof(*joystick->hwdata));
if (joystick->hwdata == NULL) {
return SDL_OutOfMemory();
return -1;
}
SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
stick = new BJoystick;
joystick->hwdata->stick = stick;
@ -152,13 +155,11 @@ extern "C"
joystick->naxes = stick->CountAxes();
joystick->nhats = stick->CountHats();
joystick->hwdata->new_axes = (int16 *)
SDL_malloc(joystick->naxes * sizeof(int16));
joystick->hwdata->new_hats = (uint8 *)
SDL_malloc(joystick->nhats * sizeof(uint8));
joystick->hwdata->new_axes = (int16 *) SDL_calloc(joystick->naxes, sizeof(int16));
joystick->hwdata->new_hats = (uint8 *) SDL_calloc(joystick->nhats, sizeof(uint8));
if (!joystick->hwdata->new_hats || !joystick->hwdata->new_axes) {
HAIKU_JoystickClose(joystick);
return SDL_OutOfMemory();
return -1;
}
/* We're done! */
@ -299,6 +300,7 @@ extern "C"
HAIKU_JoystickDetect,
HAIKU_JoystickGetDeviceName,
HAIKU_JoystickGetDevicePath,
HAIKU_JoystickGetDeviceSteamVirtualGamepadSlot,
HAIKU_JoystickGetDevicePlayerIndex,
HAIKU_JoystickSetDevicePlayerIndex,
HAIKU_JoystickGetDeviceGUID,