mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Updates the SDL library to the latest standard bugfix release
This commit is contained in:
parent
cb766f2878
commit
083d2175ea
1280 changed files with 343926 additions and 179615 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 2020 Collabora Ltd.
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 2020-2022 Collabora Ltd.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
|
@ -31,10 +31,11 @@ static const struct
|
|||
{
|
||||
int code;
|
||||
const char *name;
|
||||
} device_classes[] =
|
||||
{
|
||||
#define CLS(x) \
|
||||
{ SDL_UDEV_DEVICE_ ## x, #x }
|
||||
} device_classes[] = {
|
||||
#define CLS(x) \
|
||||
{ \
|
||||
SDL_UDEV_DEVICE_##x, #x \
|
||||
}
|
||||
CLS(MOUSE),
|
||||
CLS(KEYBOARD),
|
||||
CLS(JOYSTICK),
|
||||
|
|
@ -48,18 +49,18 @@ static const struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
uint16_t bus_type;
|
||||
uint16_t vendor_id;
|
||||
uint16_t product_id;
|
||||
uint16_t version;
|
||||
uint8_t ev[(EV_MAX + 1) / 8];
|
||||
uint8_t keys[(KEY_MAX + 1) / 8];
|
||||
uint8_t abs[(ABS_MAX + 1) / 8];
|
||||
uint8_t rel[(REL_MAX + 1) / 8];
|
||||
uint8_t ff[(FF_MAX + 1) / 8];
|
||||
uint8_t props[INPUT_PROP_MAX / 8];
|
||||
int expected;
|
||||
const char *name;
|
||||
uint16_t bus_type;
|
||||
uint16_t vendor_id;
|
||||
uint16_t product_id;
|
||||
uint16_t version;
|
||||
uint8_t ev[(EV_MAX + 1) / 8];
|
||||
uint8_t keys[(KEY_MAX + 1) / 8];
|
||||
uint8_t abs[(ABS_MAX + 1) / 8];
|
||||
uint8_t rel[(REL_MAX + 1) / 8];
|
||||
uint8_t ff[(FF_MAX + 1) / 8];
|
||||
uint8_t props[INPUT_PROP_MAX / 8];
|
||||
int expected;
|
||||
} GuessTest;
|
||||
|
||||
/*
|
||||
|
|
@ -73,10 +74,11 @@ typedef struct
|
|||
*/
|
||||
#define ZEROx4 0, 0, 0, 0
|
||||
#define ZEROx8 ZEROx4, ZEROx4
|
||||
#define FFx4 0xff, 0xff, 0xff, 0xff
|
||||
#define FFx8 FFx4, FFx4
|
||||
#define FFx4 0xff, 0xff, 0xff, 0xff
|
||||
#define FFx8 FFx4, FFx4
|
||||
|
||||
/* Test-cases derived from real devices or from Linux kernel source */
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
static const GuessTest guess_tests[] =
|
||||
{
|
||||
{
|
||||
|
|
@ -934,13 +936,24 @@ static const GuessTest guess_tests[] =
|
|||
.expected = SDL_UDEV_DEVICE_UNKNOWN,
|
||||
}
|
||||
};
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
|
||||
#if ULONG_MAX == 0xFFFFFFFFUL
|
||||
# define SwapLongLE(X) SDL_SwapLE32(X)
|
||||
#else
|
||||
/* assume 64-bit */
|
||||
# define SwapLongLE(X) SDL_SwapLE64(X)
|
||||
#endif
|
||||
/* The Linux kernel provides capability info in EVIOCGBIT and in /sys
|
||||
* as an array of unsigned long in native byte order, rather than an array
|
||||
* of bytes, an array of native-endian 32-bit words or an array of
|
||||
* native-endian 64-bit words like you might have reasonably expected.
|
||||
* The order of words in the array is always lowest-valued first: for
|
||||
* instance, the first unsigned long in abs[] contains the bit representing
|
||||
* absolute axis 0 (ABS_X).
|
||||
*
|
||||
* The constant arrays above provide test data in little-endian, because
|
||||
* that's the easiest representation for hard-coding into a test like this.
|
||||
* On a big-endian platform we need to byteswap it, one unsigned long at a
|
||||
* time, to match what the kernel would produce. This requires us to choose
|
||||
* an appropriate byteswapping function for the architecture's word size. */
|
||||
SDL_COMPILE_TIME_ASSERT(sizeof_long, sizeof(unsigned long) == 4 || sizeof(unsigned long) == 8);
|
||||
#define SwapLongLE(X) \
|
||||
((sizeof(unsigned long) == 4) ? SDL_SwapLE32(X) : SDL_SwapLE64(X))
|
||||
|
||||
static int
|
||||
run_test(void)
|
||||
|
|
@ -952,7 +965,8 @@ run_test(void)
|
|||
const GuessTest *t = &guess_tests[i];
|
||||
size_t j;
|
||||
int actual;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
unsigned long ev[NBITS(EV_MAX)];
|
||||
unsigned long abs[NBITS(ABS_MAX)];
|
||||
unsigned long keys[NBITS(KEY_MAX)];
|
||||
|
|
@ -988,8 +1002,7 @@ run_test(void)
|
|||
|
||||
if (actual == t->expected) {
|
||||
printf("\tOK\n");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf("\tExpected 0x%08x\n", t->expected);
|
||||
|
||||
for (j = 0; device_classes[j].code != 0; j++) {
|
||||
|
|
@ -1024,8 +1037,7 @@ run_test(void)
|
|||
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return run_test() ? 0 : 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue