update SDL3 from 3.2.20 to 3.4.2
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2026 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
|
||||
@@ -106,7 +106,8 @@ static int keycode_to_SDL(int keycode)
|
||||
button = SDL_GAMEPAD_BUTTON_GUIDE;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_L2:
|
||||
button = 15;
|
||||
case AKEYCODE_MEDIA_RECORD:
|
||||
button = SDL_GAMEPAD_BUTTON_MISC1;
|
||||
break;
|
||||
case AKEYCODE_BUTTON_R2:
|
||||
button = 16;
|
||||
@@ -305,7 +306,7 @@ bool Android_OnHat(int device_id, int hat_id, int x, int y)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, int button_mask, int naxes, int axis_mask, int nhats, bool can_rumble)
|
||||
void Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, int button_mask, int naxes, int axis_mask, int nhats, bool can_rumble, bool has_rgb_led)
|
||||
{
|
||||
SDL_joylist_item *item;
|
||||
SDL_GUID guid;
|
||||
@@ -328,6 +329,10 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (SDL_ShouldIgnoreJoystick(vendor_id, product_id, 0, name)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_JOYSTICK
|
||||
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats);
|
||||
#endif
|
||||
@@ -376,6 +381,7 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
|
||||
item->naxes = naxes;
|
||||
item->nhats = nhats;
|
||||
item->can_rumble = can_rumble;
|
||||
item->has_rgb_led = has_rgb_led;
|
||||
item->device_instance = SDL_GetNextObjectID();
|
||||
if (!SDL_joylist_tail) {
|
||||
SDL_joylist = SDL_joylist_tail = item;
|
||||
@@ -577,6 +583,10 @@ static bool ANDROID_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN, true);
|
||||
}
|
||||
|
||||
if (item->has_rgb_led) {
|
||||
SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -603,7 +613,15 @@ static bool ANDROID_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_r
|
||||
|
||||
static bool ANDROID_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
|
||||
{
|
||||
return SDL_Unsupported();
|
||||
SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata;
|
||||
if (!item) {
|
||||
return SDL_SetError("SetLED failed, device disconnected");
|
||||
}
|
||||
if (!item->has_rgb_led) {
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
Android_JNI_JoystickSetLED(item->device_id, red, green, blue);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ANDROID_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2026 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
|
||||
@@ -32,7 +32,7 @@ extern bool Android_OnPadDown(int device_id, int keycode);
|
||||
extern bool Android_OnPadUp(int device_id, int keycode);
|
||||
extern bool Android_OnJoy(int device_id, int axisnum, float value);
|
||||
extern bool Android_OnHat(int device_id, int hat_id, int x, int y);
|
||||
extern void Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, int button_mask, int naxes, int axis_mask, int nhats, bool can_rumble);
|
||||
extern void Android_AddJoystick(int device_id, const char *name, const char *desc, int vendor_id, int product_id, int button_mask, int naxes, int axis_mask, int nhats, bool can_rumble, bool has_rgb_led);
|
||||
extern void Android_RemoveJoystick(int device_id);
|
||||
|
||||
// A linked list of available joysticks
|
||||
@@ -46,6 +46,7 @@ typedef struct SDL_joylist_item
|
||||
int nbuttons, naxes, nhats;
|
||||
int dpad_state;
|
||||
bool can_rumble;
|
||||
bool has_rgb_led;
|
||||
|
||||
struct SDL_joylist_item *next;
|
||||
} SDL_joylist_item;
|
||||
|
||||
Reference in New Issue
Block a user