mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Further input driver standardization
This commit is contained in:
parent
6e621a98d9
commit
4a91b11806
@ -1435,10 +1435,10 @@ static int16_t android_input_state(void *data,
|
|||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
android_keyboard_port_input_pressed(binds[port], i)
|
button_is_pressed(
|
||||||
|| button_is_pressed(
|
|
||||||
android->joypad, joypad_info, binds[port],
|
android->joypad, joypad_info, binds[port],
|
||||||
port, i)
|
port, i)
|
||||||
|
|| android_keyboard_port_input_pressed(binds[port], i)
|
||||||
)
|
)
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
@ -1447,10 +1447,11 @@ static int16_t android_input_state(void *data,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
android_keyboard_port_input_pressed(binds[port], id)
|
button_is_pressed(
|
||||||
|| button_is_pressed(
|
|
||||||
android->joypad, joypad_info, binds[port],
|
android->joypad, joypad_info, binds[port],
|
||||||
port, id))
|
port, id)
|
||||||
|
|| android_keyboard_port_input_pressed(binds[port], id)
|
||||||
|
)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -306,36 +306,36 @@ static int16_t cocoa_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (apple_key_state[rarch_keysym_lut[binds[port][i].key]])
|
if (button_is_pressed(
|
||||||
ret |= (1 << i);
|
|
||||||
else if (button_is_pressed(
|
|
||||||
apple->joypad,
|
apple->joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
#ifdef HAVE_MFI
|
#ifdef HAVE_MFI
|
||||||
else if (button_is_pressed(
|
else if (button_is_pressed(
|
||||||
apple->sec_joypad,
|
apple->sec_joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
#endif
|
#endif
|
||||||
|
else if (apple_key_state[rarch_keysym_lut[binds[port][i].key]])
|
||||||
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (button_is_pressed(
|
||||||
|
apple->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
#ifdef HAVE_MFI
|
||||||
|
else if (button_is_pressed(
|
||||||
|
apple->sec_joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
else if (id < RARCH_BIND_LIST_END)
|
||||||
if (apple_key_state[rarch_keysym_lut[binds[port][id].key]])
|
if (apple_key_state[rarch_keysym_lut[binds[port][id].key]])
|
||||||
return 1;
|
return 1;
|
||||||
if (button_is_pressed(
|
|
||||||
apple->joypad,
|
|
||||||
joypad_info, binds[port], port, id))
|
|
||||||
return 1;
|
|
||||||
#ifdef HAVE_MFI
|
|
||||||
if (button_is_pressed(
|
|
||||||
apple->sec_joypad,
|
|
||||||
joypad_info, binds[port], port, id))
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -74,11 +74,9 @@ static int16_t ctr_input_state(void *data,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
{
|
|
||||||
if (binds[port][id].valid)
|
if (binds[port][id].valid)
|
||||||
return button_is_pressed(
|
return button_is_pressed(
|
||||||
ctr->joypad, joypad_info, binds[port], port, id);
|
ctr->joypad, joypad_info, binds[port], port, id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -563,16 +563,16 @@ static int16_t dinput_input_state(void *data,
|
|||||||
{
|
{
|
||||||
if (binds[port][i].valid)
|
if (binds[port][i].valid)
|
||||||
{
|
{
|
||||||
if (
|
if (button_is_pressed(
|
||||||
|
di->joypad,
|
||||||
|
joypad_info, binds[port], port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
else if (
|
||||||
settings->uints.input_mouse_index[port] == 0
|
settings->uints.input_mouse_index[port] == 0
|
||||||
&& dinput_mouse_button_pressed(
|
&& dinput_mouse_button_pressed(
|
||||||
di, port, binds[port][i].mbutton)
|
di, port, binds[port][i].mbutton)
|
||||||
)
|
)
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
else if (button_is_pressed(
|
|
||||||
di->joypad,
|
|
||||||
joypad_info, binds[port], port, i))
|
|
||||||
ret |= (1 << i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,20 +580,21 @@ static int16_t dinput_input_state(void *data,
|
|||||||
{
|
{
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if ((binds[port][i].key < RETROK_LAST) &&
|
if (binds[port][i].valid)
|
||||||
di->state[rarch_keysym_lut[(enum retro_key)binds[port][i].key]] & 0x80)
|
|
||||||
ret |= (1 << i);
|
|
||||||
else if (binds[port][i].valid)
|
|
||||||
{
|
{
|
||||||
if (
|
if (button_is_pressed(
|
||||||
|
di->joypad, joypad_info,
|
||||||
|
binds[port], port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||||
|
di->state[rarch_keysym_lut
|
||||||
|
[(enum retro_key)binds[port][i].key]] & 0x80)
|
||||||
|
ret |= (1 << i);
|
||||||
|
else if (
|
||||||
settings->uints.input_mouse_index[port] == 0
|
settings->uints.input_mouse_index[port] == 0
|
||||||
&& dinput_mouse_button_pressed(
|
&& dinput_mouse_button_pressed(
|
||||||
di, port, binds[port][i].mbutton)
|
di, port, binds[port][i].mbutton)
|
||||||
)
|
)
|
||||||
ret |= (1 << i);
|
|
||||||
else if (button_is_pressed(
|
|
||||||
di->joypad, joypad_info,
|
|
||||||
binds[port], port, i))
|
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -604,23 +605,25 @@ static int16_t dinput_input_state(void *data,
|
|||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
{
|
{
|
||||||
if (binds[port][id].key < RETROK_LAST)
|
|
||||||
{
|
|
||||||
if (di->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]] & 0x80)
|
|
||||||
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_dinput.keyboard_mapping_blocked)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (binds[port][id].valid)
|
if (binds[port][id].valid)
|
||||||
{
|
{
|
||||||
if (
|
if (button_is_pressed(
|
||||||
|
di->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
else if (binds[port][id].key < RETROK_LAST
|
||||||
|
&& (di->state[rarch_keysym_lut
|
||||||
|
[(enum retro_key)binds[port][id].key]] & 0x80)
|
||||||
|
&& ( (id == RARCH_GAME_FOCUS_TOGGLE)
|
||||||
|
|| !input_dinput.keyboard_mapping_blocked)
|
||||||
|
)
|
||||||
|
return 1;
|
||||||
|
else if (
|
||||||
settings->uints.input_mouse_index[port] == 0
|
settings->uints.input_mouse_index[port] == 0
|
||||||
&& dinput_mouse_button_pressed(
|
&& dinput_mouse_button_pressed(
|
||||||
di, port, binds[port][id].mbutton)
|
di, port, binds[port][id].mbutton)
|
||||||
)
|
)
|
||||||
return 1;
|
return 1;
|
||||||
return button_is_pressed(
|
|
||||||
di->joypad,
|
|
||||||
joypad_info, binds[port], port, id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -723,23 +726,25 @@ static int16_t dinput_input_state(void *data,
|
|||||||
new_id = RARCH_LIGHTGUN_START;
|
new_id = RARCH_LIGHTGUN_START;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (binds[port][new_id].key < RETROK_LAST)
|
|
||||||
{
|
|
||||||
if (!input_dinput.keyboard_mapping_blocked)
|
|
||||||
if (di->state[rarch_keysym_lut[(enum retro_key)binds[port][new_id].key]] & 0x80)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (binds[port][new_id].valid)
|
if (binds[port][new_id].valid)
|
||||||
{
|
{
|
||||||
if (
|
if (button_is_pressed(di->joypad,
|
||||||
|
joypad_info,
|
||||||
|
binds[port], port, new_id))
|
||||||
|
return 1;
|
||||||
|
else if (
|
||||||
|
binds[port][new_id].key < RETROK_LAST
|
||||||
|
&& !input_dinput.keyboard_mapping_blocked
|
||||||
|
&& di->state[rarch_keysym_lut
|
||||||
|
[(enum retro_key)binds[port][new_id].key]] & 0x80
|
||||||
|
)
|
||||||
|
return 1;
|
||||||
|
else if (
|
||||||
settings->uints.input_mouse_index[port] == 0
|
settings->uints.input_mouse_index[port] == 0
|
||||||
&& dinput_mouse_button_pressed(
|
&& dinput_mouse_button_pressed(
|
||||||
di, port, binds[port][new_id].mbutton)
|
di, port, binds[port][new_id].mbutton)
|
||||||
)
|
)
|
||||||
return 1;
|
return 1;
|
||||||
return button_is_pressed(di->joypad,
|
|
||||||
joypad_info,
|
|
||||||
binds[port], port, new_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -89,22 +89,32 @@ static int16_t dos_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
dos_keyboard_port_input_pressed(binds[port], i)
|
{
|
||||||
|| button_is_pressed(dos->joypad, joypad_info, binds[port],
|
if (
|
||||||
port, i))
|
button_is_pressed(
|
||||||
ret |= (1 << i);
|
dos->joypad, joypad_info, binds[port],
|
||||||
|
port, i)
|
||||||
|
|| dos_keyboard_port_input_pressed(binds[port], i)
|
||||||
|
)
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
dos_keyboard_port_input_pressed(binds[port], id)
|
{
|
||||||
|| button_is_pressed(dos->joypad, joypad_info, binds[port],
|
if (
|
||||||
port, id))
|
button_is_pressed(
|
||||||
return 1;
|
dos->joypad, joypad_info, binds[port],
|
||||||
|
port, id)
|
||||||
|
|| dos_keyboard_port_input_pressed(binds[port], id)
|
||||||
|
)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_KEYBOARD:
|
case RETRO_DEVICE_KEYBOARD:
|
||||||
|
@ -154,20 +154,25 @@ static int16_t gx_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(gx->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(
|
||||||
|
gx->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
button_is_pressed(gx->joypad, joypad_info, binds[port],
|
if (
|
||||||
port, id))
|
button_is_pressed(gx->joypad, joypad_info, binds[port],
|
||||||
return 1;
|
port, id))
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -122,32 +122,19 @@ static int16_t linuxraw_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
/* Auto-binds are per joypad, not per user. */
|
if (binds[port][i].valid)
|
||||||
const uint64_t joykey = (binds[port][i].joykey != NO_BTN)
|
{
|
||||||
? binds[port][i].joykey : joypad_info->auto_binds[i].joykey;
|
if (
|
||||||
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
|
button_is_pressed(
|
||||||
? binds[port][i].joyaxis : joypad_info->auto_binds[i].joyaxis;
|
linuxraw->joypad, joypad_info, binds[port],
|
||||||
|
port, i)
|
||||||
if ((binds[port]->valid &&
|
)
|
||||||
|
ret |= (1 << i);
|
||||||
|
else if (
|
||||||
linuxraw->state[rarch_keysym_lut[
|
linuxraw->state[rarch_keysym_lut[
|
||||||
(enum retro_key)binds[port][i].key]]
|
(enum retro_key)binds[port][i].key]]
|
||||||
))
|
)
|
||||||
{
|
ret |= (1 << i);
|
||||||
ret |= (1 << i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(
|
|
||||||
joypad_info->joy_idx, (uint16_t)joykey))
|
|
||||||
{
|
|
||||||
ret |= (1 << i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (((float)abs(linuxraw->joypad->axis(
|
|
||||||
joypad_info->joy_idx, joyaxis)) / 0x8000) > joypad_info->axis_threshold)
|
|
||||||
{
|
|
||||||
ret |= (1 << i);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,20 +142,22 @@ static int16_t linuxraw_input_state(void *data,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Auto-binds are per joypad, not per user. */
|
if (id < RARCH_BIND_LIST_END)
|
||||||
const uint64_t joykey = (binds[port][id].joykey != NO_BTN)
|
{
|
||||||
? binds[port][id].joykey : joypad_info->auto_binds[id].joykey;
|
if (binds[port][id].valid)
|
||||||
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
|
{
|
||||||
? binds[port][id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
if (
|
||||||
if (((id < RARCH_BIND_LIST_END) && binds[port]->valid &&
|
button_is_pressed(
|
||||||
linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]]
|
linuxraw->joypad, joypad_info, binds[port],
|
||||||
))
|
port, id)
|
||||||
return 1;
|
)
|
||||||
|
return 1;
|
||||||
if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(joypad_info->joy_idx, (uint16_t)joykey))
|
else if ((linuxraw->state[rarch_keysym_lut
|
||||||
return 1;
|
[(enum retro_key)binds[port][id].key]]
|
||||||
if (((float)abs(linuxraw->joypad->axis(joypad_info->joy_idx, joyaxis)) / 0x8000) > joypad_info->axis_threshold)
|
))
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -58,18 +58,24 @@ static int16_t ps2_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (button_is_pressed(ps2->joypad, joypad_info, binds[port],
|
if (binds[port][i].valid)
|
||||||
port, i))
|
{
|
||||||
ret |= (1 << i);
|
if (button_is_pressed(ps2->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (button_is_pressed(ps2->joypad, joypad_info, binds[port],
|
if (binds[port][id].valid)
|
||||||
port, id))
|
{
|
||||||
return 1;
|
if (button_is_pressed(ps2->joypad, joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -113,19 +113,25 @@ static int16_t ps3_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
if (binds[port][id].valid)
|
||||||
port, id))
|
{
|
||||||
return 1;
|
if (button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -62,20 +62,26 @@ static int16_t ps4_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(ps4->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(ps4->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
button_is_pressed(ps4->joypad, joypad_info, binds[port],
|
{
|
||||||
port, id))
|
if (
|
||||||
return 1;
|
button_is_pressed(ps4->joypad, joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -223,25 +223,31 @@ static int16_t ps3_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
||||||
else if (psl1ght_keyboard_port_input_pressed(ps3, binds[port][i].key))
|
port, i))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
|
else if (psl1ght_keyboard_port_input_pressed(ps3, binds[port][i].key))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
{
|
||||||
port, id))
|
if (
|
||||||
return 1;
|
button_is_pressed(ps3->joypad, joypad_info, binds[port],
|
||||||
else if (psl1ght_keyboard_port_input_pressed(
|
port, id))
|
||||||
ps3, binds[port][id].key))
|
return 1;
|
||||||
return 1;
|
else if (psl1ght_keyboard_port_input_pressed(
|
||||||
|
ps3, binds[port][id].key))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -305,20 +305,26 @@ static int16_t psp_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(psp->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(psp->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
button_is_pressed(psp->joypad, joypad_info, binds[port],
|
{
|
||||||
port, id))
|
if (
|
||||||
return 1;
|
button_is_pressed(psp->joypad, joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -752,26 +752,20 @@ static int16_t qnx_is_pressed(
|
|||||||
{
|
{
|
||||||
const struct retro_keybind *bind = &binds[id];
|
const struct retro_keybind *bind = &binds[id];
|
||||||
int key = bind->key;
|
int key = bind->key;
|
||||||
if (id >= RARCH_BIND_LIST_END)
|
/* Auto-binds are per joypad, not per user. */
|
||||||
return 0;
|
const uint64_t joykey = (binds[id].joykey != NO_BTN)
|
||||||
|
? binds[id].joykey : joypad_info->auto_binds[id].joykey;
|
||||||
|
const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE)
|
||||||
|
? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
||||||
if (qnx_keyboard_pressed(qnx, key))
|
if (qnx_keyboard_pressed(qnx, key))
|
||||||
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_qnx.keyboard_mapping_blocked)
|
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_qnx.keyboard_mapping_blocked)
|
||||||
return 1;
|
return 1;
|
||||||
if (binds && binds[id].valid)
|
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
||||||
{
|
joypad_info->joy_idx, (uint16_t)joykey))
|
||||||
/* Auto-binds are per joypad, not per user. */
|
return 1;
|
||||||
const uint64_t joykey = (binds[id].joykey != NO_BTN)
|
if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis))
|
||||||
? binds[id].joykey : joypad_info->auto_binds[id].joykey;
|
/ 0x8000) > joypad_info->axis_threshold)
|
||||||
const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE)
|
return 1;
|
||||||
? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
|
||||||
|
|
||||||
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
|
||||||
joypad_info->joy_idx, (uint16_t)joykey))
|
|
||||||
return 1;
|
|
||||||
if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis))
|
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,21 +817,29 @@ static int16_t qnx_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (qnx_is_pressed(
|
if (binds[port][i].valid)
|
||||||
qnx, qnx->joypad,
|
|
||||||
joypad_info, binds[port], port, i))
|
|
||||||
{
|
{
|
||||||
ret |= (1 << i);
|
if (qnx_is_pressed(
|
||||||
continue;
|
qnx, qnx->joypad,
|
||||||
|
joypad_info, binds[port], port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (qnx_is_pressed(qnx, qnx->joypad,
|
{
|
||||||
joypad_info, binds[port], port, id))
|
if (id < RARCH_BIND_LIST_END)
|
||||||
return 1;
|
{
|
||||||
|
if (binds[port][id].valid)
|
||||||
|
{
|
||||||
|
if (qnx_is_pressed(qnx, qnx->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
if (binds[port])
|
if (binds[port])
|
||||||
|
@ -475,33 +475,25 @@ static int16_t rwebinput_is_pressed(
|
|||||||
const struct retro_keybind *binds,
|
const struct retro_keybind *binds,
|
||||||
unsigned port, unsigned id)
|
unsigned port, unsigned id)
|
||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
const struct retro_keybind *bind = &binds[id];
|
||||||
{
|
/* Auto-binds are per joypad, not per user. */
|
||||||
const struct retro_keybind *bind = &binds[id];
|
const uint64_t joykey = (binds[id].joykey != NO_BTN)
|
||||||
int key = bind->key;
|
? binds[id].joykey : joypad_info->auto_binds[id].joykey;
|
||||||
|
const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE)
|
||||||
|
? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
||||||
|
int key = bind->key;
|
||||||
|
|
||||||
if ((key < RETROK_LAST) && rwebinput_key_pressed(rwebinput, key))
|
if ((key < RETROK_LAST) && rwebinput_key_pressed(rwebinput, key))
|
||||||
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_rwebinput.keyboard_mapping_blocked)
|
if ((id == RARCH_GAME_FOCUS_TOGGLE) || !input_rwebinput.keyboard_mapping_blocked)
|
||||||
return 1;
|
return 1;
|
||||||
|
if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse,
|
||||||
if (bind->valid)
|
bind->mbutton, false))
|
||||||
{
|
return 1;
|
||||||
/* Auto-binds are per joypad, not per user. */
|
if ((uint16_t)joykey != NO_BTN && joypad->button(joypad_info->joy_idx, (uint16_t)joykey))
|
||||||
const uint64_t joykey = (binds[id].joykey != NO_BTN)
|
return 1;
|
||||||
? binds[id].joykey : joypad_info->auto_binds[id].joykey;
|
if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis))
|
||||||
const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE)
|
/ 0x8000) > joypad_info->axis_threshold)
|
||||||
? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
return 1;
|
||||||
|
|
||||||
if (port == 0 && !!rwebinput_mouse_state(&rwebinput->mouse,
|
|
||||||
bind->mbutton, false))
|
|
||||||
return 1;
|
|
||||||
if ((uint16_t)joykey != NO_BTN && joypad->button(joypad_info->joy_idx, (uint16_t)joykey))
|
|
||||||
return 1;
|
|
||||||
if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis))
|
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,12 +507,18 @@ static int16_t rwebinput_analog_pressed(rwebinput_input_t *rwebinput,
|
|||||||
|
|
||||||
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
input_conv_analog_id_to_bind_id(idx, id, id_minus, id_plus);
|
||||||
|
|
||||||
if (rwebinput_is_pressed(rwebinput,
|
if (id < RARCH_BIND_LIST_END)
|
||||||
rwebinput->joypad, joypad_info, binds, idx, id_minus))
|
{
|
||||||
pressed_minus = -0x7fff;
|
if (binds[id].valid)
|
||||||
if (rwebinput_is_pressed(rwebinput,
|
{
|
||||||
rwebinput->joypad, joypad_info, binds, idx, id_plus))
|
if (rwebinput_is_pressed(rwebinput,
|
||||||
pressed_plus = 0x7fff;
|
rwebinput->joypad, joypad_info, binds, idx, id_minus))
|
||||||
|
pressed_minus = -0x7fff;
|
||||||
|
if (rwebinput_is_pressed(rwebinput,
|
||||||
|
rwebinput->joypad, joypad_info, binds, idx, id_plus))
|
||||||
|
pressed_plus = 0x7fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return pressed_plus + pressed_minus;
|
return pressed_plus + pressed_minus;
|
||||||
}
|
}
|
||||||
@ -541,12 +539,12 @@ static int16_t rwebinput_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (rwebinput_is_pressed(
|
if (binds[port][i].valid)
|
||||||
rwebinput, rwebinput->joypad,
|
|
||||||
joypad_info, binds[port], port, i))
|
|
||||||
{
|
{
|
||||||
ret |= (1 << i);
|
if (rwebinput_is_pressed(
|
||||||
continue;
|
rwebinput, rwebinput->joypad,
|
||||||
|
joypad_info, binds[port], port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,10 +553,15 @@ static int16_t rwebinput_input_state(void *data,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
if (rwebinput_is_pressed(rwebinput, rwebinput->joypad,
|
{
|
||||||
joypad_info, binds[port],
|
if (binds[port][id].valid)
|
||||||
port, id))
|
{
|
||||||
return true;
|
if (rwebinput_is_pressed(rwebinput, rwebinput->joypad,
|
||||||
|
joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -89,29 +89,6 @@ static int16_t sdl_analog_pressed(sdl_input_t *sdl, const struct retro_keybind *
|
|||||||
return pressed_plus + pressed_minus;
|
return pressed_plus + pressed_minus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t sdl_is_pressed(
|
|
||||||
const input_device_driver_t *joypad,
|
|
||||||
rarch_joypad_info_t *joypad_info,
|
|
||||||
const struct retro_keybind *binds,
|
|
||||||
unsigned port, unsigned id)
|
|
||||||
{
|
|
||||||
/* Auto-binds are per joypad, not per user. */
|
|
||||||
const uint64_t joykey = (binds[id].joykey != NO_BTN)
|
|
||||||
? binds[id].joykey : joypad_info->auto_binds[id].joykey;
|
|
||||||
const uint32_t joyaxis = (binds[id].joyaxis != AXIS_NONE)
|
|
||||||
? binds[id].joyaxis : joypad_info->auto_binds[id].joyaxis;
|
|
||||||
|
|
||||||
if ((binds[id].key < RETROK_LAST) && sdl_key_pressed(binds[id].key))
|
|
||||||
return 1;
|
|
||||||
if ((uint16_t)joykey != NO_BTN && joypad->button(
|
|
||||||
joypad_info->joy_idx, (uint16_t)joykey))
|
|
||||||
return 1;
|
|
||||||
if (((float)abs(joypad->axis(joypad_info->joy_idx, joyaxis))
|
|
||||||
/ 0x8000) > joypad_info->axis_threshold)
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int16_t sdl_mouse_device_state(sdl_input_t *sdl, unsigned id)
|
static int16_t sdl_mouse_device_state(sdl_input_t *sdl, unsigned id)
|
||||||
{
|
{
|
||||||
switch (id)
|
switch (id)
|
||||||
@ -228,9 +205,14 @@ static int16_t sdl_input_state(void *data,
|
|||||||
|
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (sdl_is_pressed(
|
if (binds[port][i].valid)
|
||||||
sdl->joypad, joypad_info, binds[port], port, i))
|
{
|
||||||
ret |= (1 << i);
|
if (button_is_pressed(
|
||||||
|
sdl->joypad, joypad_info, binds[port], port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
else if (sdl_key_pressed(binds[port][i].key))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -238,9 +220,16 @@ static int16_t sdl_input_state(void *data,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
if (sdl_is_pressed(sdl->joypad,
|
{
|
||||||
joypad_info, binds[port], port, id))
|
if (binds[port][id].valid)
|
||||||
return 1;
|
{
|
||||||
|
if (button_is_pressed(sdl->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
else if (sdl_key_pressed(binds[port][id].key))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -399,20 +399,26 @@ static int16_t switch_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(sw->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(sw->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
button_is_pressed(sw->joypad, joypad_info, binds[port],
|
{
|
||||||
port, id))
|
if (
|
||||||
return 1;
|
button_is_pressed(sw->joypad, joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -1018,10 +1018,12 @@ static int16_t udev_input_state(void *data,
|
|||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (binds[port][i].valid)
|
if (binds[port][i].valid)
|
||||||
|
{
|
||||||
if (udev_is_pressed(
|
if (udev_is_pressed(
|
||||||
udev, udev->joypad,
|
udev, udev->joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1032,12 +1034,8 @@ static int16_t udev_input_state(void *data,
|
|||||||
{
|
{
|
||||||
if (udev_is_pressed(udev, udev->joypad,
|
if (udev_is_pressed(udev, udev->joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
{
|
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
continue;
|
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||||
}
|
|
||||||
|
|
||||||
if ((binds[port][i].key < RETROK_LAST) &&
|
|
||||||
udev_keyboard_pressed(udev, binds[port][i].key))
|
udev_keyboard_pressed(udev, binds[port][i].key))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
@ -1050,14 +1048,19 @@ static int16_t udev_input_state(void *data,
|
|||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
{
|
{
|
||||||
if ( (binds[port][id].key < RETROK_LAST) &&
|
|
||||||
udev_keyboard_pressed(udev, binds[port][id].key))
|
|
||||||
if (( id == RARCH_GAME_FOCUS_TOGGLE)
|
|
||||||
|| !input_udev.keyboard_mapping_blocked)
|
|
||||||
return 1;
|
|
||||||
if (binds[port][id].valid)
|
if (binds[port][id].valid)
|
||||||
return udev_is_pressed(udev, udev->joypad,
|
{
|
||||||
joypad_info, binds[port], port, id);
|
if (udev_is_pressed(udev, udev->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
else if (
|
||||||
|
(binds[port][id].key < RETROK_LAST) &&
|
||||||
|
udev_keyboard_pressed(udev, binds[port][id].key)
|
||||||
|
&& (( id == RARCH_GAME_FOCUS_TOGGLE)
|
||||||
|
|| !input_udev.keyboard_mapping_blocked)
|
||||||
|
)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1222,17 +1225,25 @@ static int16_t udev_input_state(void *data,
|
|||||||
case RETRO_DEVICE_ID_LIGHTGUN_X:
|
case RETRO_DEVICE_ID_LIGHTGUN_X:
|
||||||
{
|
{
|
||||||
udev_input_mouse_t *mouse = udev_get_mouse(udev, port);
|
udev_input_mouse_t *mouse = udev_get_mouse(udev, port);
|
||||||
return (mouse) ? udev_mouse_get_x(mouse) : 0;
|
if (mouse)
|
||||||
|
return udev_mouse_get_x(mouse);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_Y:
|
case RETRO_DEVICE_ID_LIGHTGUN_Y:
|
||||||
{
|
{
|
||||||
udev_input_mouse_t *mouse = udev_get_mouse(udev, port);
|
udev_input_mouse_t *mouse = udev_get_mouse(udev, port);
|
||||||
return (mouse) ? udev_mouse_get_y(mouse) : 0;
|
if (mouse)
|
||||||
|
return udev_mouse_get_y(mouse);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case RETRO_DEVICE_ID_LIGHTGUN_PAUSE:
|
case RETRO_DEVICE_ID_LIGHTGUN_PAUSE:
|
||||||
return udev_is_pressed(udev, udev->joypad,
|
if (binds[port][RARCH_LIGHTGUN_START].valid)
|
||||||
joypad_info,
|
{
|
||||||
binds[port], port, RARCH_LIGHTGUN_START);
|
return udev_is_pressed(udev, udev->joypad,
|
||||||
|
joypad_info,
|
||||||
|
binds[port], port, RARCH_LIGHTGUN_START);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -190,11 +190,11 @@ static int16_t uwp_input_state(void *data,
|
|||||||
int16_t ret = 0;
|
int16_t ret = 0;
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (uwp_pressed_joypad(
|
if (binds[port][i].valid)
|
||||||
uwp, joypad_info, binds[port], port, i))
|
|
||||||
{
|
{
|
||||||
ret |= (1 << i);
|
if (uwp_pressed_joypad(
|
||||||
continue;
|
uwp, joypad_info, binds[port], port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,8 +203,14 @@ static int16_t uwp_input_state(void *data,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
if (uwp_pressed_joypad(uwp, joypad_info, binds[port], port, id))
|
{
|
||||||
return 1;
|
if (binds[port][i].valid)
|
||||||
|
{
|
||||||
|
if (uwp_pressed_joypad(uwp, joypad_info,
|
||||||
|
binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -635,13 +635,13 @@ static int16_t winraw_input_state(void *d,
|
|||||||
{
|
{
|
||||||
if (binds[port][i].valid)
|
if (binds[port][i].valid)
|
||||||
{
|
{
|
||||||
if (mouse && winraw_mouse_button_pressed(wr,
|
if (button_is_pressed(
|
||||||
mouse, port, binds[port][i].mbutton))
|
|
||||||
ret |= (1 << i);
|
|
||||||
else if (button_is_pressed(
|
|
||||||
wr->joypad,
|
wr->joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
|
else if (mouse && winraw_mouse_button_pressed(wr,
|
||||||
|
mouse, port, binds[port][i].mbutton))
|
||||||
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,18 +649,18 @@ static int16_t winraw_input_state(void *d,
|
|||||||
{
|
{
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if ((binds[port][i].key < RETROK_LAST) &&
|
if (binds[port][i].valid)
|
||||||
winraw_keyboard_pressed(wr, binds[port][i].key))
|
|
||||||
ret |= (1 << i);
|
|
||||||
else if (binds[port][i].valid)
|
|
||||||
{
|
{
|
||||||
if (mouse && winraw_mouse_button_pressed(wr,
|
if (button_is_pressed(
|
||||||
mouse, port, binds[port][i].mbutton))
|
|
||||||
ret |= (1 << i);
|
|
||||||
else if (button_is_pressed(
|
|
||||||
wr->joypad,
|
wr->joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
|
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||||
|
winraw_keyboard_pressed(wr, binds[port][i].key))
|
||||||
|
ret |= (1 << i);
|
||||||
|
else if (mouse && winraw_mouse_button_pressed(wr,
|
||||||
|
mouse, port, binds[port][i].mbutton))
|
||||||
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -671,19 +671,22 @@ static int16_t winraw_input_state(void *d,
|
|||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
{
|
{
|
||||||
if ((binds[port][id].key < RETROK_LAST)
|
|
||||||
&& winraw_keyboard_pressed(wr, binds[port][id].key))
|
|
||||||
if (( id == RARCH_GAME_FOCUS_TOGGLE)
|
|
||||||
|| !input_winraw.keyboard_mapping_blocked)
|
|
||||||
return 1;
|
|
||||||
if (binds[port][id].valid)
|
if (binds[port][id].valid)
|
||||||
{
|
{
|
||||||
if (mouse && winraw_mouse_button_pressed(wr,
|
if (button_is_pressed(
|
||||||
|
wr->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
else if (
|
||||||
|
(binds[port][id].key < RETROK_LAST)
|
||||||
|
&& winraw_keyboard_pressed(wr, binds[port][id].key)
|
||||||
|
&& (( id == RARCH_GAME_FOCUS_TOGGLE)
|
||||||
|
|| !input_winraw.keyboard_mapping_blocked)
|
||||||
|
)
|
||||||
|
return 1;
|
||||||
|
else if (mouse && winraw_mouse_button_pressed(wr,
|
||||||
mouse, port, binds[port][id].mbutton))
|
mouse, port, binds[port][id].mbutton))
|
||||||
return 1;
|
return 1;
|
||||||
return button_is_pressed(
|
|
||||||
wr->joypad,
|
|
||||||
joypad_info, binds[port], port, id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,12 +333,8 @@ static int16_t x_input_state(void *data,
|
|||||||
{
|
{
|
||||||
if (x_is_pressed(x11, x11->joypad,
|
if (x_is_pressed(x11, x11->joypad,
|
||||||
joypad_info, binds[port], port, i))
|
joypad_info, binds[port], port, i))
|
||||||
{
|
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
continue;
|
else if ((binds[port][i].key < RETROK_LAST) &&
|
||||||
}
|
|
||||||
|
|
||||||
if ((binds[port][i].key < RETROK_LAST) &&
|
|
||||||
x_keyboard_pressed(x11, binds[port][i].key))
|
x_keyboard_pressed(x11, binds[port][i].key))
|
||||||
ret |= (1 << i);
|
ret |= (1 << i);
|
||||||
}
|
}
|
||||||
@ -351,14 +347,19 @@ static int16_t x_input_state(void *data,
|
|||||||
{
|
{
|
||||||
if (id < RARCH_BIND_LIST_END)
|
if (id < RARCH_BIND_LIST_END)
|
||||||
{
|
{
|
||||||
if ((binds[port][id].key < RETROK_LAST) &&
|
|
||||||
x_keyboard_pressed(x11, binds[port][id].key) )
|
|
||||||
if (( id == RARCH_GAME_FOCUS_TOGGLE)
|
|
||||||
|| !input_x.keyboard_mapping_blocked)
|
|
||||||
return 1;
|
|
||||||
if (binds[port][id].valid)
|
if (binds[port][id].valid)
|
||||||
return x_is_pressed(x11, x11->joypad,
|
{
|
||||||
joypad_info, binds[port], port, id);
|
if (x_is_pressed(x11, x11->joypad,
|
||||||
|
joypad_info, binds[port], port, id))
|
||||||
|
return 1;
|
||||||
|
else if (
|
||||||
|
((binds[port][id].key < RETROK_LAST) &&
|
||||||
|
x_keyboard_pressed(x11, binds[port][id].key))
|
||||||
|
&& (( id == RARCH_GAME_FOCUS_TOGGLE)
|
||||||
|
|| !input_x.keyboard_mapping_blocked)
|
||||||
|
)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -69,20 +69,26 @@ static int16_t xdk_input_state(void *data,
|
|||||||
|
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][i].valid)
|
||||||
button_is_pressed(xdk->joypad, joypad_info, binds[port],
|
{
|
||||||
port, i))
|
if (
|
||||||
ret |= (1 << i);
|
button_is_pressed(xdk->joypad, joypad_info, binds[port],
|
||||||
|
port, i))
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (
|
if (binds[port][id].valid)
|
||||||
button_is_pressed(xdk->joypad, joypad_info, binds[port],
|
{
|
||||||
port, id))
|
if (
|
||||||
return 1;
|
button_is_pressed(xdk->joypad, joypad_info, binds[port],
|
||||||
|
port, id))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RETRO_DEVICE_ANALOG:
|
case RETRO_DEVICE_ANALOG:
|
||||||
|
@ -81,15 +81,23 @@ static int16_t xenon360_input_state(void *data,
|
|||||||
|
|
||||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||||
{
|
{
|
||||||
if (state[port] & binds[port][i].joykey)
|
if (binds[port][i].valid)
|
||||||
ret |= (1 << i);
|
{
|
||||||
|
if (state[port] & binds[port][i].joykey)
|
||||||
|
ret |= (1 << i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (state[port] & binds[port][id].joykey)
|
{
|
||||||
return 1;
|
if (binds[port][id].valid)
|
||||||
|
{
|
||||||
|
if (state[port] & binds[port][id].joykey)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user