mirror of
https://github.com/libretro/RetroArch
synced 2025-03-20 10:20:51 +00:00
(input drivers) More simplifications
This commit is contained in:
parent
ceecf4751a
commit
51365ed387
@ -856,10 +856,9 @@ static bool udev_keyboard_pressed(udev_input_t *udev, unsigned key)
|
||||
return BIT_GET(udev_key_state,bit);
|
||||
}
|
||||
|
||||
static bool udev_mbutton_pressed(udev_input_t *udev, unsigned port, unsigned key)
|
||||
static bool udev_mouse_button_pressed(
|
||||
udev_input_t *udev, unsigned port, unsigned key)
|
||||
{
|
||||
bool result;
|
||||
|
||||
udev_input_mouse_t *mouse = udev_get_mouse(udev, port);
|
||||
|
||||
if (!mouse)
|
||||
@ -867,7 +866,6 @@ static bool udev_mbutton_pressed(udev_input_t *udev, unsigned port, unsigned key
|
||||
|
||||
switch ( key )
|
||||
{
|
||||
|
||||
case RETRO_DEVICE_ID_MOUSE_LEFT:
|
||||
return mouse->l;
|
||||
case RETRO_DEVICE_ID_MOUSE_RIGHT:
|
||||
@ -886,7 +884,6 @@ static bool udev_mbutton_pressed(udev_input_t *udev, unsigned port, unsigned key
|
||||
return mouse->whu;
|
||||
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
|
||||
return mouse->whd;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -905,7 +902,7 @@ static bool udev_is_pressed(udev_input_t *udev,
|
||||
|
||||
if (binds && binds[id].valid)
|
||||
{
|
||||
if (udev_mbutton_pressed(udev, port, bind->mbutton))
|
||||
if (udev_mouse_button_pressed(udev, port, bind->mbutton))
|
||||
return true;
|
||||
if (input_joypad_pressed(udev->joypad, joypad_info, port, binds, id))
|
||||
return true;
|
||||
|
@ -127,19 +127,6 @@ static void wiiu_input_poll(void *data)
|
||||
wiiu->joypad->poll();
|
||||
}
|
||||
|
||||
static bool wiiu_key_pressed(int key)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
if (key >= RETROK_LAST)
|
||||
return false;
|
||||
|
||||
if (keyboardState[key] && (keyboardChannel > 0))
|
||||
ret = true;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int16_t wiiu_input_state(void *data,
|
||||
rarch_joypad_info_t joypad_info,
|
||||
const struct retro_keybind **binds,
|
||||
@ -157,7 +144,9 @@ static int16_t wiiu_input_state(void *data,
|
||||
return input_joypad_pressed(wiiu->joypad,
|
||||
joypad_info, port, binds[port], id);
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return wiiu_key_pressed(id);
|
||||
if (id < RETROK_LAST && keyboardState[id] && (keyboardChannel > 0))
|
||||
return true;
|
||||
return false;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (binds[port])
|
||||
return input_joypad_analog(wiiu->joypad,
|
||||
|
@ -281,9 +281,7 @@ static int16_t winraw_lightgun_aiming_state(winraw_input_t *wr,
|
||||
|
||||
if ( !( video_driver_translate_coord_viewport_wrap(
|
||||
&vp, mouse->x, mouse->y, &res_x, &res_y, &res_screen_x, &res_screen_y ) ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
inside = (res_x >= -edge_detect) && (res_y >= -edge_detect) && (res_x <= edge_detect) && (res_y <= edge_detect);
|
||||
|
||||
@ -349,13 +347,10 @@ static int16_t winraw_mouse_state(winraw_input_t *wr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool winraw_keyboard_pressed(winraw_input_t *wr, unsigned key)
|
||||
{
|
||||
unsigned k = rarch_keysym_lut[(enum retro_key)key];
|
||||
return wr->keyboard.keys[k];
|
||||
}
|
||||
#define winraw_keyboard_pressed(wr, key) (wr->keyboard.keys[rarch_keysym_lut[(enum retro_key)(key)]])
|
||||
|
||||
static bool winraw_mbutton_pressed(winraw_input_t *wr, unsigned port, unsigned key)
|
||||
static bool winraw_mouse_button_pressed(
|
||||
winraw_input_t *wr, unsigned port, unsigned key)
|
||||
{
|
||||
unsigned i;
|
||||
winraw_mouse_t *mouse = NULL;
|
||||
@ -410,7 +405,7 @@ static bool winraw_is_pressed(winraw_input_t *wr,
|
||||
return true;
|
||||
if (binds && binds[id].valid)
|
||||
{
|
||||
if (winraw_mbutton_pressed(wr, port, bind->mbutton))
|
||||
if (winraw_mouse_button_pressed(wr, port, bind->mbutton))
|
||||
return true;
|
||||
if (input_joypad_pressed(wr->joypad, joypad_info, port, binds, id))
|
||||
return true;
|
||||
|
@ -79,7 +79,8 @@ static bool x_keyboard_pressed(x11_input_t *x11, unsigned key)
|
||||
return x11->state[keycode >> 3] & (1 << (keycode & 7));
|
||||
}
|
||||
|
||||
static bool x_mbutton_pressed(x11_input_t *x11, unsigned port, unsigned key)
|
||||
static bool x_mouse_button_pressed(
|
||||
x11_input_t *x11, unsigned port, unsigned key)
|
||||
{
|
||||
bool result;
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -137,7 +138,7 @@ static bool x_is_pressed(x11_input_t *x11,
|
||||
|
||||
if (binds && binds[id].valid)
|
||||
{
|
||||
if (x_mbutton_pressed(x11, port, bind->mbutton))
|
||||
if (x_mouse_button_pressed(x11, port, bind->mbutton))
|
||||
return true;
|
||||
if (input_joypad_pressed(x11->joypad, joypad_info, port, binds, id))
|
||||
return true;
|
||||
|
@ -66,21 +66,19 @@ static int16_t xenon360_input_state(void *data,
|
||||
{
|
||||
unsigned user = port;
|
||||
uint64_t button = binds[user][id].joykey;
|
||||
int16_t retval = 0;
|
||||
|
||||
if(user < MAX_PADS)
|
||||
{
|
||||
if (user >= MAX_PADS)
|
||||
return 0;
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
retval = (state[user] & button) ? 1 : 0;
|
||||
break;
|
||||
return (state[user] & button) ? 1 : 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void xenon360_input_free_input(void *data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user