Move (joykey == NO_BTN ) to input_joypad_driver

This commit is contained in:
twinaphex 2016-12-11 08:44:55 +01:00
parent 37559c6f5f
commit e9f853ba93
9 changed files with 6 additions and 35 deletions

View File

@ -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);
if (joykey == NO_BTN)
return false;
/* Check hat. */
if (GET_HAT_DIR(joykey))
return false;

View File

@ -73,9 +73,6 @@ static bool iohidmanager_hid_joypad_button(void *data,
iohidmanager_hid_joypad_get_buttons(data, port);
iohidmanager_hid_t *hid = (iohidmanager_hid_t*)data;
if (joykey == NO_BTN)
return false;
/* Check hat. */
if (GET_HAT_DIR(joykey))
return false;

View File

@ -442,9 +442,6 @@ static bool libusb_hid_joypad_button(void *data,
{
uint64_t buttons = libusb_hid_joypad_get_buttons(data, port);
if (joykey == NO_BTN)
return false;
/* Check hat. */
if (GET_HAT_DIR(joykey))
return false;

View File

@ -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);
if (joykey == NO_BTN)
return false;
/* Check hat. */
if (GET_HAT_DIR(joykey))
return false;

View File

@ -324,14 +324,9 @@ static bool dinput_joypad_init(void *data)
static bool dinput_joypad_button(unsigned port_num, uint16_t joykey)
{
const struct dinput_joypad *pad = NULL;
unsigned hat_dir = 0;
if (joykey == NO_BTN)
return false;
pad = &g_pads[port_num];
if (!pad->joypad)
const struct dinput_joypad *pad = &g_pads[port_num];
if (!pad || !pad->joypad)
return false;
hat_dir = GET_HAT_DIR(joykey);

View File

@ -207,9 +207,6 @@ static void apple_gamecontroller_joypad_destroy(void)
static bool apple_gamecontroller_joypad_button(unsigned port, uint16_t joykey)
{
if (joykey == NO_BTN)
return false;
/* Check hat. */
if (GET_HAT_DIR(joykey))
return false;

View File

@ -289,14 +289,9 @@ error:
static bool sdl_joypad_button(unsigned port, uint16_t joykey)
{
sdl_joypad_t *pad = NULL;
unsigned hat_dir = 0;
if (joykey == NO_BTN)
return false;
pad = (sdl_joypad_t*)&sdl_pads[port];
if (!pad->joypad)
sdl_joypad_t *pad = (sdl_joypad_t*)&sdl_pads[port];
if (!pad || !pad->joypad)
return false;
hat_dir = GET_HAT_DIR(joykey);

View File

@ -318,15 +318,11 @@ static const uint16_t button_index_to_bitmap_code[] = {
static bool xinput_joypad_button(unsigned port_num, uint16_t joykey)
{
int xuser;
uint16_t btn_word = 0;
unsigned num_buttons = 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)
return dinput_joypad.button(port_num, joykey);

View File

@ -250,7 +250,7 @@ bool input_joypad_pressed(
uint64_t joykey = (binds[key].joykey != NO_BTN)
? 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)
? binds[key].joyaxis : auto_binds[key].joyaxis;