Merge pull request #11594 from davidgfnet/master

Add support for 64 buttons in udev gamepads
This commit is contained in:
Autechre 2020-11-19 07:11:54 +01:00 committed by GitHub
commit f7e9dd651f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -49,7 +49,7 @@
* Code adapted from SDL 2.0's implementation.
*/
#define UDEV_NUM_BUTTONS 32
#define UDEV_NUM_BUTTONS 64
#define NUM_AXES 32
#ifndef NUM_HATS
@ -638,7 +638,7 @@ static void udev_joypad_get_buttons(unsigned port, input_bits_t *state)
if (pad)
{
BITS_COPY16_PTR( state, pad->buttons );
BITS_COPY64_PTR( state, pad->buttons );
}
else
BIT256_CLEAR_ALL_PTR(state);

View File

@ -152,6 +152,13 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
BITS_GET_ELEM_PTR(a, 0) = (bits); \
}
#define BITS_COPY64_PTR(a,bits) \
{ \
BIT128_CLEAR_ALL_PTR(a); \
BITS_GET_ELEM_PTR(a, 0) = (bits); \
BITS_GET_ELEM_PTR(a, 1) = (bits >> 32); \
}
/* Helper macros and struct to keep track of many booleans. */
/* This struct has 256 bits. */
typedef struct