Move (joykey == NO_BTN ) to input_joypad_driver
This commit is contained in:
parent
37559c6f5f
commit
e9f853ba93
|
@ -1372,9 +1372,6 @@ static bool btstack_hid_joypad_button(void *data, unsigned port, uint16_t joykey
|
||||||
{
|
{
|
||||||
uint64_t buttons = btstack_hid_joypad_get_buttons(data, port);
|
uint64_t buttons = btstack_hid_joypad_get_buttons(data, port);
|
||||||
|
|
||||||
if (joykey == NO_BTN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Check hat. */
|
/* Check hat. */
|
||||||
if (GET_HAT_DIR(joykey))
|
if (GET_HAT_DIR(joykey))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -73,9 +73,6 @@ static bool iohidmanager_hid_joypad_button(void *data,
|
||||||
iohidmanager_hid_joypad_get_buttons(data, port);
|
iohidmanager_hid_joypad_get_buttons(data, port);
|
||||||
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
|
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
|
||||||
|
|
||||||
if (joykey == NO_BTN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Check hat. */
|
/* Check hat. */
|
||||||
if (GET_HAT_DIR(joykey))
|
if (GET_HAT_DIR(joykey))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -442,9 +442,6 @@ static bool libusb_hid_joypad_button(void *data,
|
||||||
{
|
{
|
||||||
uint64_t buttons = libusb_hid_joypad_get_buttons(data, port);
|
uint64_t buttons = libusb_hid_joypad_get_buttons(data, port);
|
||||||
|
|
||||||
if (joykey == NO_BTN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Check hat. */
|
/* Check hat. */
|
||||||
if (GET_HAT_DIR(joykey))
|
if (GET_HAT_DIR(joykey))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -493,9 +493,6 @@ static bool wiiusb_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
|
||||||
{
|
{
|
||||||
uint64_t buttons = wiiusb_hid_joypad_get_buttons(data, port);
|
uint64_t buttons = wiiusb_hid_joypad_get_buttons(data, port);
|
||||||
|
|
||||||
if (joykey == NO_BTN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Check hat. */
|
/* Check hat. */
|
||||||
if (GET_HAT_DIR(joykey))
|
if (GET_HAT_DIR(joykey))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -324,14 +324,9 @@ static bool dinput_joypad_init(void *data)
|
||||||
|
|
||||||
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
|
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
|
||||||
{
|
{
|
||||||
const struct dinput_joypad *pad = NULL;
|
|
||||||
unsigned hat_dir = 0;
|
unsigned hat_dir = 0;
|
||||||
|
const struct dinput_joypad *pad = &g_pads[port_num];
|
||||||
if (joykey == NO_BTN)
|
if (!pad || !pad->joypad)
|
||||||
return false;
|
|
||||||
|
|
||||||
pad = &g_pads[port_num];
|
|
||||||
if (!pad->joypad)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
hat_dir = GET_HAT_DIR(joykey);
|
hat_dir = GET_HAT_DIR(joykey);
|
||||||
|
|
|
@ -207,9 +207,6 @@ static void apple_gamecontroller_joypad_destroy(void)
|
||||||
|
|
||||||
static bool apple_gamecontroller_joypad_button(unsigned port, uint16_t joykey)
|
static bool apple_gamecontroller_joypad_button(unsigned port, uint16_t joykey)
|
||||||
{
|
{
|
||||||
if (joykey == NO_BTN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Check hat. */
|
/* Check hat. */
|
||||||
if (GET_HAT_DIR(joykey))
|
if (GET_HAT_DIR(joykey))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -289,14 +289,9 @@ error:
|
||||||
|
|
||||||
static bool sdl_joypad_button(unsigned port, uint16_t joykey)
|
static bool sdl_joypad_button(unsigned port, uint16_t joykey)
|
||||||
{
|
{
|
||||||
sdl_joypad_t *pad = NULL;
|
|
||||||
unsigned hat_dir = 0;
|
unsigned hat_dir = 0;
|
||||||
|
sdl_joypad_t *pad = (sdl_joypad_t*)&sdl_pads[port];
|
||||||
if (joykey == NO_BTN)
|
if (!pad || !pad->joypad)
|
||||||
return false;
|
|
||||||
|
|
||||||
pad = (sdl_joypad_t*)&sdl_pads[port];
|
|
||||||
if (!pad->joypad)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
hat_dir = GET_HAT_DIR(joykey);
|
hat_dir = GET_HAT_DIR(joykey);
|
||||||
|
|
|
@ -318,15 +318,11 @@ static const uint16_t button_index_to_bitmap_code[] = {
|
||||||
|
|
||||||
static bool xinput_joypad_button(unsigned port_num, uint16_t joykey)
|
static bool xinput_joypad_button(unsigned port_num, uint16_t joykey)
|
||||||
{
|
{
|
||||||
int xuser;
|
|
||||||
uint16_t btn_word = 0;
|
uint16_t btn_word = 0;
|
||||||
unsigned num_buttons = 0;
|
unsigned num_buttons = 0;
|
||||||
unsigned hat_dir = 0;
|
unsigned hat_dir = 0;
|
||||||
|
int xuser = pad_index_to_xuser_index(port_num);
|
||||||
|
|
||||||
if (joykey == NO_BTN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
xuser = pad_index_to_xuser_index(port_num);
|
|
||||||
if (xuser == -1)
|
if (xuser == -1)
|
||||||
return dinput_joypad.button(port_num, joykey);
|
return dinput_joypad.button(port_num, joykey);
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ bool input_joypad_pressed(
|
||||||
uint64_t joykey = (binds[key].joykey != NO_BTN)
|
uint64_t joykey = (binds[key].joykey != NO_BTN)
|
||||||
? binds[key].joykey : auto_binds[key].joykey;
|
? binds[key].joykey : auto_binds[key].joykey;
|
||||||
|
|
||||||
if (!drv->button(joy_idx, (uint16_t)joykey))
|
if ((uint16_t)joykey == NO_BTN || !drv->button(joy_idx, (uint16_t)joykey))
|
||||||
{
|
{
|
||||||
uint32_t joyaxis = (binds[key].joyaxis != AXIS_NONE)
|
uint32_t joyaxis = (binds[key].joyaxis != AXIS_NONE)
|
||||||
? binds[key].joyaxis : auto_binds[key].joyaxis;
|
? binds[key].joyaxis : auto_binds[key].joyaxis;
|
||||||
|
|
Loading…
Reference in New Issue