Update all other input drivers

This commit is contained in:
twinaphex 2019-07-22 01:20:00 +02:00
parent f9f2e2f48d
commit bee9984745
22 changed files with 398 additions and 263 deletions

View File

@ -293,7 +293,6 @@ static int16_t cocoa_input_state(void *data,
const struct retro_keybind **binds, unsigned port,
unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
switch (device)
@ -302,6 +301,7 @@ static int16_t cocoa_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -309,26 +309,37 @@ static int16_t cocoa_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = apple_key_state[rarch_keysym_lut[binds[port][i].key]];
if (!res)
if (apple_key_state[rarch_keysym_lut[binds[port][i].key]])
{
if ((uint16_t)joykey != NO_BTN && apple->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(apple->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
ret |= (1 << i);
continue;
}
if ((uint16_t)joykey != NO_BTN && apple->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
{
ret |= (1 << i);
continue;
}
if (((float)abs(apple->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
#ifdef HAVE_MFI
if (!res)
if ((uint16_t)joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
{
if ((uint16_t)joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(apple->sec_joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
ret |= (1 << i);
continue;
}
if (((float)abs(apple->sec_joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
#endif
if (res)
ret |= (1 << i);
}
return ret;
}
else
{
@ -338,35 +349,33 @@ static int16_t cocoa_input_state(void *data,
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if (id < RARCH_BIND_LIST_END)
ret = apple_key_state[rarch_keysym_lut[binds[port][id].key]];
if (!ret)
{
if ((uint16_t)joykey != NO_BTN && apple->joypad->button(
joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(apple->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
}
if (apple_key_state[rarch_keysym_lut[binds[port][id].key]])
return true;
if ((uint16_t)joykey != NO_BTN && apple->joypad->button(
joypad_info.joy_idx, (uint16_t)joykey))
return true;
if (((float)abs(apple->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
#ifdef HAVE_MFI
if (!ret)
{
if ((uint16_t)joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(apple->sec_joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
}
if ((uint16_t)joykey != NO_BTN && apple->sec_joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
return true;
if (((float)abs(apple->sec_joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
#endif
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
{
int16_t ret = 0;
#ifdef HAVE_MFI
ret = input_joypad_analog(apple->sec_joypad, joypad_info, port,
idx, id, binds[port]);
#endif
if (!ret && binds[port])
ret = input_joypad_analog(apple->joypad, joypad_info, port,
ret = input_joypad_analog(apple->sec_joypad, joypad_info, port,
idx, id, binds[port]);
return ret;
#endif
if (!ret && binds[port])
ret = input_joypad_analog(apple->joypad, joypad_info, port,
idx, id, binds[port]);
return ret;
}
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && apple_key_state[rarch_keysym_lut[(enum retro_key)id]];
case RETRO_DEVICE_MOUSE:

View File

@ -50,7 +50,6 @@ static int16_t ctr_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
ctr_input_t *ctr = (ctr_input_t*)data;
if (port > 0)
@ -62,6 +61,7 @@ static int16_t ctr_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -69,17 +69,21 @@ static int16_t ctr_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN &&
ctr->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(ctr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(ctr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -90,11 +94,11 @@ static int16_t ctr_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && ctr->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(ctr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(ctr->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ctr->joypad,

View File

@ -558,7 +558,6 @@ static int16_t dinput_input_state(void *data,
const struct retro_keybind **binds, unsigned port,
unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
struct dinput_input *di = (struct dinput_input*)data;
switch (device)
@ -567,6 +566,7 @@ static int16_t dinput_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (binds[port][i].key < RETROK_LAST)
@ -609,8 +609,10 @@ static int16_t dinput_input_state(void *data,
}
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
{
if (binds[port][id].key < RETROK_LAST)
@ -636,13 +638,14 @@ static int16_t dinput_input_state(void *data,
return true;
}
}
return ret;
}
break;
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && di->state[rarch_keysym_lut[(enum retro_key)id]] & 0x80;
case RETRO_DEVICE_ANALOG:
if (binds[port])
{
ret = dinput_pressed_analog(di, binds[port], idx, id);
int16_t ret = dinput_pressed_analog(di, binds[port], idx, id);
if (!ret)
ret = input_joypad_analog(di->joypad, joypad_info,
port, idx, id, binds[port]);

View File

@ -75,7 +75,6 @@ static int16_t dos_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
dos_input_t *dos = (dos_input_t*)data;
if (port > 0)
@ -87,6 +86,7 @@ static int16_t dos_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -94,17 +94,25 @@ static int16_t dos_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && dos->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(dos->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (!res)
res = dos_keyboard_port_input_pressed(binds[port], i);
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(dos->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
if (dos_keyboard_port_input_pressed(binds[port], i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -115,14 +123,14 @@ static int16_t dos_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && dos->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(dos->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(dos->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
if (!ret)
ret = dos_keyboard_port_input_pressed(binds[port], id);
if (dos_keyboard_port_input_pressed(binds[port], id))
return true;
}
return ret;
break;
case RETRO_DEVICE_KEYBOARD:
return dos_keyboard_port_input_pressed(binds[port], id);
}

View File

@ -45,7 +45,6 @@ static int16_t gx_input_state(void *data,
unsigned idx, unsigned id)
{
gx_input_t *gx = (gx_input_t*)data;
int16_t ret = 0;
if (port >= DEFAULT_MAX_PADS || !gx)
return 0;
@ -56,6 +55,7 @@ static int16_t gx_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -63,16 +63,20 @@ static int16_t gx_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && gx->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(gx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(gx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -83,11 +87,11 @@ static int16_t gx_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && gx->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(gx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(gx->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(gx->joypad,

View File

@ -112,7 +112,6 @@ static int16_t linuxraw_input_state(void *data,
const struct retro_keybind **binds, unsigned port,
unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
switch (device)
@ -121,57 +120,64 @@ static int16_t linuxraw_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
bool res = (binds[port]->valid &&
linuxraw->state[rarch_keysym_lut[
(enum retro_key)binds[port][i].key]]
);
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][i].joykey != NO_BTN)
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
if (!res)
if ((binds[port]->valid &&
linuxraw->state[rarch_keysym_lut[
(enum retro_key)binds[port][i].key]]
))
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][i].joykey != NO_BTN)
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(linuxraw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
ret |= (1 << i);
continue;
}
if (res)
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;
}
}
return ret;
}
else
{
ret = ((id < RARCH_BIND_LIST_END) && binds[port]->valid &&
linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]]
);
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][id].joykey != NO_BTN)
? binds[port][id].joykey : joypad_info.auto_binds[id].joykey;
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if (((id < RARCH_BIND_LIST_END) && binds[port]->valid &&
linuxraw->state[rarch_keysym_lut[(enum retro_key)binds[port][id].key]]
))
return true;
if (!ret)
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][id].joykey != NO_BTN)
? binds[port][id].joykey : joypad_info.auto_binds[id].joykey;
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(linuxraw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
}
if ((uint16_t)joykey != NO_BTN && linuxraw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
return true;
if (((float)abs(linuxraw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(linuxraw->joypad,
joypad_info, port, idx, id, binds[port]);
return ret;
{
int16_t ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(linuxraw->joypad,
joypad_info, port, idx, id, binds[port]);
return ret;
}
}
return 0;

View File

@ -48,7 +48,6 @@ static int16_t ps2_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
ps2_input_t *ps2 = (ps2_input_t*)data;
switch (device)
@ -57,6 +56,7 @@ static int16_t ps2_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -64,16 +64,20 @@ static int16_t ps2_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && ps2->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(ps2->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(ps2->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -84,11 +88,11 @@ static int16_t ps2_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && ps2->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(ps2->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return ret;
if (((float)abs(ps2->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return ret;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ps2->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -103,7 +103,6 @@ static int16_t ps3_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
ps3_input_t *ps3 = (ps3_input_t*)data;
if (!ps3)
@ -115,6 +114,7 @@ static int16_t ps3_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -122,16 +122,20 @@ static int16_t ps3_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && ps3->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(ps3->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
else if (((float)abs(ps3->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -142,11 +146,11 @@ static int16_t ps3_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && ps3->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(ps3->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(ps3->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ps3->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -52,7 +52,6 @@ static int16_t ps4_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
ps4_input_t *ps4 = (ps4_input_t*)data;
switch (device)
@ -61,6 +60,7 @@ static int16_t ps4_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -68,16 +68,20 @@ static int16_t ps4_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && ps4->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(ps4->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(ps4->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -88,11 +92,11 @@ static int16_t ps4_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && ps4->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(ps4->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(ps4->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(ps4->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -302,7 +302,6 @@ static int16_t psp_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
psp_input_t *psp = (psp_input_t*)data;
#if !defined(SN_TARGET_PSP2) && !defined(VITA)
@ -316,6 +315,7 @@ static int16_t psp_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -323,16 +323,20 @@ static int16_t psp_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && psp->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(psp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(psp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -343,11 +347,11 @@ static int16_t psp_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && psp->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(psp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(psp->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(psp->joypad, joypad_info, port, idx, id, binds[port]);

View File

@ -796,7 +796,6 @@ static int16_t qnx_input_state(void *data,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
qnx_input_t *qnx = (qnx_input_t*)data;
switch (device)
@ -805,16 +804,23 @@ static int16_t qnx_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (qnx_is_pressed(
qnx, joypad_info, port, binds[port], i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
ret = qnx_is_pressed(qnx, joypad_info, port, binds[port], id);
return ret;
if (qnx_is_pressed(qnx, joypad_info, port, binds[port], id))
return true;
break;
case RETRO_DEVICE_KEYBOARD:
return qnx_keyboard_pressed(qnx, id);
case RETRO_DEVICE_POINTER:

View File

@ -527,7 +527,6 @@ static int16_t rwebinput_input_state(void *data,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
switch (device)
@ -536,27 +535,37 @@ static int16_t rwebinput_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (rwebinput_is_pressed(
rwebinput, joypad_info, port, binds[port], i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
ret = rwebinput_is_pressed(rwebinput, joypad_info, binds[port],
port, id);
if (rwebinput_is_pressed(rwebinput, joypad_info, binds[port],
port, id))
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
ret = rwebinput_analog_pressed(rwebinput, joypad_info, binds[port],
idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(rwebinput->joypad, joypad_info, port,
idx, id, binds[port]);
return ret;
{
int16_t ret = rwebinput_analog_pressed(
rwebinput, joypad_info, binds[port],
idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(rwebinput->joypad, joypad_info, port,
idx, id, binds[port]);
return ret;
}
case RETRO_DEVICE_KEYBOARD:
return rwebinput_key_pressed(rwebinput, id);
case RETRO_DEVICE_MOUSE:

View File

@ -223,7 +223,6 @@ static int16_t sdl_input_state(void *data,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
enum input_device_type type = INPUT_DEVICE_TYPE_NONE;
sdl_input_t *sdl = (sdl_input_t*)data;
@ -233,27 +232,35 @@ static int16_t sdl_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (sdl_joypad_device_state(
sdl, joypad_info, binds[port], port, i, &type))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
ret = sdl_joypad_device_state(sdl,
joypad_info, binds[port], port, id, &type);
if (sdl_joypad_device_state(sdl,
joypad_info, binds[port], port, id, &type))
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
{
int16_t ret = sdl_analog_pressed(sdl, binds[port], idx, id);
if (!ret)
ret = input_joypad_analog(sdl->joypad,
joypad_info, port, idx, id, binds[port]);
joypad_info, port, idx, id, binds[port]);
return ret;
}
break;
@ -262,7 +269,8 @@ static int16_t sdl_input_state(void *data,
case RETRO_DEVICE_POINTER:
case RARCH_DEVICE_POINTER_SCREEN:
if (idx == 0)
return sdl_pointer_device_state(sdl, idx, id, device == RARCH_DEVICE_POINTER_SCREEN);
return sdl_pointer_device_state(sdl, idx, id,
device == RARCH_DEVICE_POINTER_SCREEN);
break;
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && sdl_key_pressed(id);

View File

@ -372,7 +372,6 @@ static int16_t switch_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
switch_input_t *sw = (switch_input_t*) data;
if (port > DEFAULT_MAX_PADS - 1)
@ -384,6 +383,7 @@ static int16_t switch_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -393,10 +393,18 @@ static int16_t switch_input_state(void *data,
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
if ((uint16_t)joykey != NO_BTN && sw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
{
ret |= (1 << i);
else if (((float)abs(sw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
continue;
}
if (((float)abs(sw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << 1);
continue;
}
}
return ret;
}
else
{
@ -406,11 +414,11 @@ static int16_t switch_input_state(void *data,
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && sw->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(sw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(sw->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(sw->joypad,

View File

@ -1008,7 +1008,6 @@ static int16_t udev_input_state(void *data,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
udev_input_t *udev = (udev_input_t*)data;
switch (device)
@ -1017,26 +1016,34 @@ static int16_t udev_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (udev_is_pressed(
udev, joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
ret = udev_is_pressed(udev, joypad_info, binds[port], port, id);
if (udev_is_pressed(udev, joypad_info, binds[port], port, id))
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
ret = udev_analog_pressed(binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(udev->joypad,
joypad_info, port, idx, id, binds[port]);
return ret;
{
int16_t ret = udev_analog_pressed(binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(udev->joypad,
joypad_info, port, idx, id, binds[port]);
return ret;
}
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && udev_keyboard_pressed(udev, id);

View File

@ -192,7 +192,6 @@ static int16_t uwp_input_state(void *data,
unsigned port, unsigned device,
unsigned index, unsigned id)
{
int16_t ret = 0;
uwp_input_t *uwp = (uwp_input_t*)data;
switch (device)
@ -201,23 +200,29 @@ static int16_t uwp_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (uwp_pressed_joypad(
uwp, joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
ret = uwp_pressed_joypad(uwp, joypad_info, binds[port], port, id);
if (uwp_pressed_joypad(uwp, joypad_info, binds[port], port, id))
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return uwp_pressed_analog(uwp, joypad_info, binds[port], port, index, id);
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && uwp_keyboard_pressed(id);

View File

@ -285,7 +285,6 @@ static int16_t input_wl_state(void *data,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
input_ctx_wayland_data_t *wl = (input_ctx_wayland_data_t*)data;
switch (device)
@ -294,49 +293,65 @@ static int16_t input_wl_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
bool res = BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][i].key]) ;
if (!res && binds[port])
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][i].joykey != NO_BTN)
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
if (BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][i].key]) )
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][i].joykey != NO_BTN)
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
if ((uint16_t)joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(wl->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
}
if (res)
ret |= (1 << i);
continue;
}
if (binds[port])
{
if ((uint16_t)joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
{
ret |= (1 << i);
continue;
}
if (((float)abs(wl->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
}
return ret;
}
else
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][id].joykey != NO_BTN)
? binds[port][id].joykey : joypad_info.auto_binds[id].joykey;
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if (id < RARCH_BIND_LIST_END)
ret = BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key]);
if (!ret && binds[port])
if (BIT_GET(wl->key_state, rarch_keysym_lut[binds[port][id].key]))
return true;
if (binds[port])
{
/* Auto-binds are per joypad, not per user. */
const uint64_t joykey = (binds[port][id].joykey != NO_BTN)
? binds[port][id].joykey : joypad_info.auto_binds[id].joykey;
const uint32_t joyaxis = (binds[port][id].joyaxis != AXIS_NONE)
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && wl->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(wl->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(wl->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
ret = input_wl_analog_pressed(wl, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(wl->joypad, joypad_info, port, idx, id, binds[port]);
return ret;
{
int16_t ret = input_wl_analog_pressed(wl, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(wl->joypad, joypad_info, port, idx, id, binds[port]);
return ret;
}
case RETRO_DEVICE_KEYBOARD:
return input_wl_state_kb(wl, binds, port, device, idx, id);
case RETRO_DEVICE_MOUSE:

View File

@ -129,7 +129,6 @@ static int16_t wiiu_input_state(void *data,
unsigned port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
wiiu_input_t *wiiu = (wiiu_input_t*)data;
if(!wiiu || !(port < DEFAULT_MAX_PADS) || !binds || !binds[port])
@ -141,6 +140,8 @@ static int16_t wiiu_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -148,16 +149,20 @@ static int16_t wiiu_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && wiiu->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(wiiu->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(wiiu->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -168,11 +173,11 @@ static int16_t wiiu_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && wiiu->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(wiiu->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(wiiu->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_KEYBOARD:
if (id < RETROK_LAST && keyboardState[id] && (keyboardChannel > 0))
return true;

View File

@ -703,7 +703,6 @@ static int16_t winraw_input_state(void *d,
const struct retro_keybind **binds,
unsigned port, unsigned device, unsigned index, unsigned id)
{
int16_t ret = 0;
winraw_input_t *wr = (winraw_input_t*)d;
switch (device)
@ -712,19 +711,25 @@ static int16_t winraw_input_state(void *d,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (winraw_is_pressed(
wr, joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
ret = winraw_is_pressed(wr, joypad_info, binds[port], port, id);
return winraw_is_pressed(wr, joypad_info, binds[port], port, id);
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(wr->joypad, joypad_info,

View File

@ -311,7 +311,6 @@ static int16_t x_input_state(void *data,
const struct retro_keybind **binds, unsigned port,
unsigned device, unsigned idx, unsigned id)
{
int16_t ret = 0;
x11_input_t *x11 = (x11_input_t*)data;
switch (device)
@ -320,26 +319,35 @@ static int16_t x_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (x_is_pressed(
x11, joypad_info, binds[port], port, i))
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
if (id < RARCH_BIND_LIST_END)
ret = x_is_pressed(x11, joypad_info, binds[port], port, id);
if (x_is_pressed(x11, joypad_info, binds[port], port, id))
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
ret = x_pressed_analog(x11, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(x11->joypad, joypad_info,
port, idx,
id, binds[port]);
return ret;
{
int16_t ret = x_pressed_analog(x11, binds[port], idx, id);
if (!ret && binds[port])
ret = input_joypad_analog(x11->joypad, joypad_info,
port, idx,
id, binds[port]);
return ret;
}
case RETRO_DEVICE_KEYBOARD:
return (id < RETROK_LAST) && x_keyboard_pressed(x11, id);
case RETRO_DEVICE_MOUSE:

View File

@ -55,7 +55,6 @@ static int16_t xdk_input_state(void *data,
unsigned port, unsigned device,
unsigned index, unsigned id)
{
int16_t ret = 0;
xdk_input_t *xdk = (xdk_input_t*)data;
if (port >= DEFAULT_MAX_PADS)
@ -67,6 +66,8 @@ static int16_t xdk_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
/* Auto-binds are per joypad, not per user. */
@ -74,16 +75,20 @@ static int16_t xdk_input_state(void *data,
? binds[port][i].joykey : joypad_info.auto_binds[i].joykey;
const uint32_t joyaxis = (binds[port][i].joyaxis != AXIS_NONE)
? binds[port][i].joyaxis : joypad_info.auto_binds[i].joyaxis;
bool res = false;
if ((uint16_t)joykey != NO_BTN && xdk->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
res = true;
else if (((float)abs(xdk->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
res = true;
if (res)
{
ret |= (1 << i);
continue;
}
if (((float)abs(xdk->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
{
ret |= (1 << i);
continue;
}
}
return ret;
}
else
{
@ -94,11 +99,11 @@ static int16_t xdk_input_state(void *data,
? binds[port][id].joyaxis : joypad_info.auto_binds[id].joyaxis;
if ((uint16_t)joykey != NO_BTN && xdk->joypad->button(joypad_info.joy_idx, (uint16_t)joykey))
ret = 1;
else if (((float)abs(xdk->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
ret = 1;
return true;
if (((float)abs(xdk->joypad->axis(joypad_info.joy_idx, joyaxis)) / 0x8000) > joypad_info.axis_threshold)
return true;
}
return ret;
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(xdk->joypad, joypad_info, port, index, id, binds[port]);

View File

@ -64,7 +64,6 @@ static int16_t xenon360_input_state(void *data,
bool port, unsigned device,
unsigned idx, unsigned id)
{
int16_t ret = 0;
uint64_t button = binds[port][id].joykey;
if (port >= DEFAULT_MAX_PADS)
@ -76,15 +75,20 @@ static int16_t xenon360_input_state(void *data,
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (state[port] & binds[port][i].joykey)
ret |= (1 << i);
}
return ret;
}
else
ret = (state[port] & binds[port][id].joykey) ? 1 : 0;
return ret;
if (state[port] & binds[port][id].joykey)
return true;
break;
default:
break;
}