Change local index variables
This commit is contained in:
parent
49bffb85db
commit
faeca01e7a
|
@ -94,7 +94,7 @@ static bool android_input_set_sensor_state(void *data, unsigned port,
|
|||
enum retro_sensor_action action, unsigned event_rate);
|
||||
|
||||
extern float AMotionEvent_getAxisValue(const AInputEvent* motion_event,
|
||||
int32_t axis, size_t pointer_index);
|
||||
int32_t axis, size_t pointer_idx);
|
||||
|
||||
static typeof(AMotionEvent_getAxisValue) *p_AMotionEvent_getAxisValue;
|
||||
|
||||
|
@ -614,7 +614,7 @@ static void android_input_poll(void *data)
|
|||
|
||||
static int16_t android_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
android_input_t *android = (android_input_t*)data;
|
||||
|
||||
|
@ -623,32 +623,32 @@ static int16_t android_input_state(void *data,
|
|||
case RETRO_DEVICE_JOYPAD:
|
||||
return input_joypad_pressed(android->joypad, port, binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(android->joypad, port, index, id,
|
||||
return input_joypad_analog(android->joypad, port, idx, id,
|
||||
binds[port]);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
return android->pointer[index].x;
|
||||
return android->pointer[idx].x;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
return android->pointer[index].y;
|
||||
return android->pointer[idx].y;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return (index < android->pointer_count) &&
|
||||
(android->pointer[index].x != -0x8000) &&
|
||||
(android->pointer[index].y != -0x8000);
|
||||
return (idx < android->pointer_count) &&
|
||||
(android->pointer[idx].x != -0x8000) &&
|
||||
(android->pointer[idx].y != -0x8000);
|
||||
}
|
||||
break;
|
||||
case RARCH_DEVICE_POINTER_SCREEN:
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
return android->pointer[index].full_x;
|
||||
return android->pointer[idx].full_x;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
return android->pointer[index].full_y;
|
||||
return android->pointer[idx].full_y;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return (index < android->pointer_count) &&
|
||||
(android->pointer[index].full_x != -0x8000) &&
|
||||
(android->pointer[index].full_y != -0x8000);
|
||||
return (idx < android->pointer_count) &&
|
||||
(android->pointer[idx].full_x != -0x8000) &&
|
||||
(android->pointer[idx].full_y != -0x8000);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -412,14 +412,14 @@ static int16_t apple_mouse_state(apple_input_data_t *apple,
|
|||
}
|
||||
|
||||
static int16_t apple_pointer_state(apple_input_data_t *apple,
|
||||
unsigned device, unsigned index, unsigned id)
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
const bool want_full = (device == RARCH_DEVICE_POINTER_SCREEN);
|
||||
|
||||
if (index < apple->touch_count && index < MAX_TOUCHES)
|
||||
if (idx < apple->touch_count && (idx < MAX_TOUCHES))
|
||||
{
|
||||
const apple_touch_data_t *touch = (const apple_touch_data_t *)
|
||||
&apple->touches[index];
|
||||
&apple->touches[idx];
|
||||
int16_t x = want_full ? touch->full_x : touch->fixed_x;
|
||||
int16_t y = want_full ? touch->full_y : touch->fixed_y;
|
||||
|
||||
|
@ -439,7 +439,7 @@ static int16_t apple_pointer_state(apple_input_data_t *apple,
|
|||
|
||||
static int16_t apple_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port,
|
||||
unsigned device, unsigned index, unsigned id)
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
apple_input_data_t *apple = (apple_input_data_t*)data;
|
||||
|
||||
|
@ -453,7 +453,7 @@ static int16_t apple_input_state(void *data,
|
|||
input_joypad_pressed(apple->joypad, port, binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(apple->joypad, port,
|
||||
index, id, binds[port]);
|
||||
idx, id, binds[port]);
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
{
|
||||
unsigned bit = input_translate_rk_to_keysym((enum retro_key)id);
|
||||
|
@ -463,7 +463,7 @@ static int16_t apple_input_state(void *data,
|
|||
return apple_mouse_state(apple, id);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
case RARCH_DEVICE_POINTER_SCREEN:
|
||||
return apple_pointer_state(apple, device, index, id);
|
||||
return apple_pointer_state(apple, device, idx, id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -234,11 +234,11 @@ static bool dinput_is_pressed(struct dinput_input *di,
|
|||
|
||||
static int16_t dinput_pressed_analog(struct dinput_input *di,
|
||||
const struct retro_keybind *binds,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);
|
||||
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
|
||||
|
||||
const struct retro_keybind *bind_minus = &binds[id_minus];
|
||||
const struct retro_keybind *bind_plus = &binds[id_plus];
|
||||
|
@ -305,17 +305,17 @@ static int16_t dinput_mouse_state(struct dinput_input *di, unsigned id)
|
|||
}
|
||||
|
||||
static int16_t dinput_pointer_state(struct dinput_input *di,
|
||||
unsigned index, unsigned id, bool screen)
|
||||
unsigned idx, unsigned id, bool screen)
|
||||
{
|
||||
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
|
||||
unsigned num = 0;
|
||||
struct pointer_status *check_pos = di->pointer_head.next;
|
||||
while (check_pos && num < index)
|
||||
while (check_pos && num < idx)
|
||||
{
|
||||
num++;
|
||||
check_pos = check_pos->next;
|
||||
}
|
||||
if (!check_pos && index > 0) /* index = 0 has mouse fallback. */
|
||||
if (!check_pos && idx > 0) /* idx = 0 has mouse fallback. */
|
||||
return 0;
|
||||
|
||||
int x = check_pos ? check_pos->pointer_x : di->mouse_x;
|
||||
|
@ -354,7 +354,7 @@ static int16_t dinput_pointer_state(struct dinput_input *di,
|
|||
|
||||
static int16_t dinput_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port,
|
||||
unsigned device, unsigned index, unsigned id)
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
struct dinput_input *di = (struct dinput_input*)data;
|
||||
int16_t ret;
|
||||
|
@ -368,10 +368,10 @@ static int16_t dinput_input_state(void *data,
|
|||
return dinput_keyboard_pressed(di, id);
|
||||
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = dinput_pressed_analog(di, binds[port], index, id);
|
||||
ret = dinput_pressed_analog(di, binds[port], idx, id);
|
||||
if (!ret)
|
||||
ret = input_joypad_analog(di->joypad, port,
|
||||
index, id, g_settings.input.binds[port]);
|
||||
idx, id, g_settings.input.binds[port]);
|
||||
return ret;
|
||||
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
|
@ -379,7 +379,7 @@ static int16_t dinput_input_state(void *data,
|
|||
|
||||
case RETRO_DEVICE_POINTER:
|
||||
case RARCH_DEVICE_POINTER_SCREEN:
|
||||
return dinput_pointer_state(di, index, id,
|
||||
return dinput_pointer_state(di, idx, id,
|
||||
device == RARCH_DEVICE_POINTER_SCREEN);
|
||||
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
|
@ -727,7 +727,7 @@ static bool guid_is_xinput_device(const GUID* product_guid)
|
|||
/* Forward declaration */
|
||||
static const char *dinput_joypad_name(unsigned pad);
|
||||
|
||||
static unsigned g_last_xinput_pad_index;
|
||||
static unsigned g_last_xinput_pad_idx;
|
||||
|
||||
static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||
{
|
||||
|
@ -758,8 +758,8 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
|||
|
||||
if (is_xinput_pad)
|
||||
{
|
||||
if (g_last_xinput_pad_index < 4)
|
||||
g_xinput_pad_indexes[g_joypad_cnt] = g_last_xinput_pad_index++;
|
||||
if (g_last_xinput_pad_idx < 4)
|
||||
g_xinput_pad_indexes[g_joypad_cnt] = g_last_xinput_pad_idx++;
|
||||
goto enum_iteration_done;
|
||||
}
|
||||
#endif
|
||||
|
@ -795,7 +795,7 @@ static bool dinput_joypad_init(void)
|
|||
if (!dinput_init_context())
|
||||
return false;
|
||||
|
||||
g_last_xinput_pad_index = 0;
|
||||
g_last_xinput_pad_idx = 0;
|
||||
|
||||
for (i = 0; i < MAX_PLAYERS; ++i)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct gx_input
|
|||
|
||||
static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
gx_input_t *gx = (gx_input_t*)data;
|
||||
if (port >= MAX_PADS || !gx)
|
||||
|
@ -49,7 +49,7 @@ static int16_t gx_input_state(void *data, const struct retro_keybind **binds,
|
|||
case RETRO_DEVICE_JOYPAD:
|
||||
return input_joypad_pressed(gx->joypad, port, binds[port], id);;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(gx->joypad, port, index, id, binds[port]);
|
||||
return input_joypad_analog(gx->joypad, port, idx, id, binds[port]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ static void input_autoconfigure_joypad_conf(config_file_t *conf,
|
|||
}
|
||||
|
||||
static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
|
||||
unsigned index, const char *name, const char *drv,
|
||||
unsigned idx, const char *name, const char *drv,
|
||||
int32_t vid, int32_t pid, bool block_osd_spam)
|
||||
{
|
||||
if (!conf)
|
||||
|
@ -54,7 +54,7 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
|
|||
config_get_int(conf, "input_vendor_id", &input_vid);
|
||||
config_get_int(conf, "input_product_id", &input_pid);
|
||||
|
||||
snprintf(ident_idx, sizeof(ident_idx), "%s_p%u", ident, index);
|
||||
snprintf(ident_idx, sizeof(ident_idx), "%s_p%u", ident, idx);
|
||||
|
||||
//RARCH_LOG("ident_idx: %s\n", ident_idx);
|
||||
|
||||
|
@ -79,12 +79,12 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
|
|||
return false;
|
||||
|
||||
found:
|
||||
g_settings.input.autoconfigured[index] = true;
|
||||
input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[index]);
|
||||
g_settings.input.autoconfigured[idx] = true;
|
||||
input_autoconfigure_joypad_conf(conf, g_settings.input.autoconf_binds[idx]);
|
||||
|
||||
char msg[512];
|
||||
snprintf(msg, sizeof(msg), "Joypad port #%u (%s) configured.",
|
||||
index, name);
|
||||
idx, name);
|
||||
|
||||
if (!block_osd_spam)
|
||||
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
|
||||
|
@ -93,7 +93,7 @@ found:
|
|||
return true;
|
||||
}
|
||||
|
||||
void input_config_autoconfigure_joypad(unsigned index,
|
||||
void input_config_autoconfigure_joypad(unsigned idx,
|
||||
const char *name, int32_t vid, int32_t pid,
|
||||
const char *drv)
|
||||
{
|
||||
|
@ -105,14 +105,14 @@ void input_config_autoconfigure_joypad(unsigned index,
|
|||
/* This will be the case if input driver is reinit.
|
||||
* No reason to spam autoconfigure messages
|
||||
* every time (fine in log). */
|
||||
bool block_osd_spam = g_settings.input.autoconfigured[index] && name;
|
||||
bool block_osd_spam = g_settings.input.autoconfigured[idx] && name;
|
||||
|
||||
for (i = 0; i < RARCH_BIND_LIST_END; i++)
|
||||
{
|
||||
g_settings.input.autoconf_binds[index][i].joykey = NO_BTN;
|
||||
g_settings.input.autoconf_binds[index][i].joyaxis = AXIS_NONE;
|
||||
g_settings.input.autoconf_binds[idx][i].joykey = NO_BTN;
|
||||
g_settings.input.autoconf_binds[idx][i].joyaxis = AXIS_NONE;
|
||||
}
|
||||
g_settings.input.autoconfigured[index] = false;
|
||||
g_settings.input.autoconfigured[idx] = false;
|
||||
|
||||
if (!name)
|
||||
return;
|
||||
|
@ -127,7 +127,7 @@ void input_config_autoconfigure_joypad(unsigned index,
|
|||
config_file_t *conf = (config_file_t*)
|
||||
config_file_new_from_string(input_builtin_autoconfs[i]);
|
||||
bool success = input_try_autoconfigure_joypad_from_conf(conf,
|
||||
index, name, drv, vid, pid, block_osd_spam);
|
||||
idx, name, drv, vid, pid, block_osd_spam);
|
||||
config_file_free(conf);
|
||||
if (success)
|
||||
break;
|
||||
|
@ -148,7 +148,7 @@ void input_config_autoconfigure_joypad(unsigned index,
|
|||
if (!conf)
|
||||
continue;
|
||||
bool success = input_try_autoconfigure_joypad_from_conf(conf,
|
||||
index, name, drv, vid, pid, block_osd_spam);
|
||||
idx, name, drv, vid, pid, block_osd_spam);
|
||||
config_file_free(conf);
|
||||
if (success)
|
||||
break;
|
||||
|
@ -160,8 +160,8 @@ void input_config_autoconfigure_joypad(unsigned index,
|
|||
|
||||
const struct retro_keybind *input_get_auto_bind(unsigned port, unsigned id)
|
||||
{
|
||||
int joy_index = g_settings.input.joypad_map[port];
|
||||
if (joy_index < 0)
|
||||
int joy_idx = g_settings.input.joypad_map[port];
|
||||
if (joy_idx < 0)
|
||||
return NULL;
|
||||
return &g_settings.input.autoconf_binds[joy_index][id];
|
||||
return &g_settings.input.autoconf_binds[joy_idx][id];
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
const struct retro_keybind *input_get_auto_bind(unsigned port,
|
||||
unsigned id);
|
||||
|
||||
void input_config_autoconfigure_joypad(unsigned index,
|
||||
void input_config_autoconfigure_joypad(unsigned idx,
|
||||
const char *name, int32_t vid, int32_t pid,
|
||||
const char *driver);
|
||||
|
||||
|
|
|
@ -148,11 +148,11 @@ bool input_joypad_set_rumble(const rarch_joypad_driver_t *drv,
|
|||
if (!drv || !drv->set_rumble)
|
||||
return false;
|
||||
|
||||
int joy_index = g_settings.input.joypad_map[port];
|
||||
if (joy_index < 0 || joy_index >= MAX_PLAYERS)
|
||||
int joy_idx = g_settings.input.joypad_map[port];
|
||||
if (joy_idx < 0 || joy_idx >= MAX_PLAYERS)
|
||||
return false;
|
||||
|
||||
return drv->set_rumble(joy_index, effect, strength);
|
||||
return drv->set_rumble(joy_idx, effect, strength);
|
||||
}
|
||||
|
||||
bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
||||
|
@ -161,13 +161,13 @@ bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
|||
if (!drv)
|
||||
return false;
|
||||
|
||||
int joy_index = g_settings.input.joypad_map[port];
|
||||
if (joy_index < 0 || joy_index >= MAX_PLAYERS)
|
||||
int joy_idx = g_settings.input.joypad_map[port];
|
||||
if (joy_idx < 0 || joy_idx >= MAX_PLAYERS)
|
||||
return false;
|
||||
|
||||
/* Auto-binds are per joypad, not per player. */
|
||||
const struct retro_keybind *auto_binds =
|
||||
g_settings.input.autoconf_binds[joy_index];
|
||||
g_settings.input.autoconf_binds[joy_idx];
|
||||
|
||||
if (!binds[key].valid)
|
||||
return false;
|
||||
|
@ -176,14 +176,14 @@ bool input_joypad_pressed(const rarch_joypad_driver_t *drv,
|
|||
if (joykey == NO_BTN)
|
||||
joykey = auto_binds[key].joykey;
|
||||
|
||||
if (drv->button(joy_index, (uint16_t)joykey))
|
||||
if (drv->button(joy_idx, (uint16_t)joykey))
|
||||
return true;
|
||||
|
||||
uint32_t joyaxis = binds[key].joyaxis;
|
||||
if (joyaxis == AXIS_NONE)
|
||||
joyaxis = auto_binds[key].joyaxis;
|
||||
|
||||
int16_t axis = drv->axis(joy_index, joyaxis);
|
||||
int16_t axis = drv->axis(joy_idx, joyaxis);
|
||||
float scaled_axis = (float)abs(axis) / 0x8000;
|
||||
return scaled_axis > g_settings.input.axis_threshold;
|
||||
}
|
||||
|
@ -195,13 +195,13 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
|
|||
if (!drv)
|
||||
return 0;
|
||||
|
||||
int joy_index = g_settings.input.joypad_map[port];
|
||||
if (joy_index < 0 || joy_index >= MAX_PLAYERS)
|
||||
int joy_idx = g_settings.input.joypad_map[port];
|
||||
if (joy_idx < 0 || joy_idx >= MAX_PLAYERS)
|
||||
return 0;
|
||||
|
||||
/* Auto-binds are per joypad, not per player. */
|
||||
const struct retro_keybind *auto_binds =
|
||||
g_settings.input.autoconf_binds[joy_index];
|
||||
g_settings.input.autoconf_binds[joy_idx];
|
||||
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
|
@ -219,8 +219,8 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
|
|||
if (axis_plus == AXIS_NONE)
|
||||
axis_plus = auto_binds[id_plus].joyaxis;
|
||||
|
||||
int16_t pressed_minus = abs(drv->axis(joy_index, axis_minus));
|
||||
int16_t pressed_plus = abs(drv->axis(joy_index, axis_plus));
|
||||
int16_t pressed_minus = abs(drv->axis(joy_idx, axis_minus));
|
||||
int16_t pressed_plus = abs(drv->axis(joy_idx, axis_plus));
|
||||
|
||||
int16_t res = pressed_plus - pressed_minus;
|
||||
|
||||
|
@ -234,9 +234,9 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
|
|||
if (key_plus == NO_BTN)
|
||||
key_plus = auto_binds[id_plus].joykey;
|
||||
|
||||
int16_t digital_left = drv->button(joy_index,
|
||||
int16_t digital_left = drv->button(joy_idx,
|
||||
(uint16_t)key_minus) ? -0x7fff : 0;
|
||||
int16_t digital_right = drv->button(joy_index,
|
||||
int16_t digital_right = drv->button(joy_idx,
|
||||
(uint16_t)key_plus) ? 0x7fff : 0;
|
||||
return digital_right + digital_left;
|
||||
}
|
||||
|
|
|
@ -138,11 +138,11 @@ static bool linuxraw_is_pressed(linuxraw_input_t *linuxraw,
|
|||
}
|
||||
|
||||
static int16_t linuxraw_analog_pressed(linuxraw_input_t *linuxraw,
|
||||
const struct retro_keybind *binds, unsigned index, unsigned id)
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);
|
||||
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
|
||||
|
||||
int16_t pressed_minus = linuxraw_is_pressed(linuxraw,
|
||||
binds, id_minus) ? -0x7fff : 0;
|
||||
|
@ -160,7 +160,7 @@ static bool linuxraw_bind_button_pressed(void *data, int key)
|
|||
|
||||
static int16_t linuxraw_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port,
|
||||
unsigned device, unsigned index, unsigned id)
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
|
||||
int16_t ret;
|
||||
|
@ -172,9 +172,9 @@ static int16_t linuxraw_input_state(void *data,
|
|||
input_joypad_pressed(linuxraw->joypad, port, binds[port], id);
|
||||
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = linuxraw_analog_pressed(linuxraw, binds[port], index, id);
|
||||
ret = linuxraw_analog_pressed(linuxraw, binds[port], idx, id);
|
||||
if (!ret)
|
||||
ret = input_joypad_analog(linuxraw->joypad, port, index, id, binds[port]);
|
||||
ret = input_joypad_analog(linuxraw->joypad, port, idx, id, binds[port]);
|
||||
return ret;
|
||||
|
||||
default:
|
||||
|
|
|
@ -132,32 +132,32 @@ static void handle_plugged_pad(void)
|
|||
if (strstr(event->name, "js") != event->name)
|
||||
continue;
|
||||
|
||||
unsigned index = strtoul(event->name + 2, NULL, 0);
|
||||
if (index >= MAX_PLAYERS)
|
||||
unsigned idx = strtoul(event->name + 2, NULL, 0);
|
||||
if (idx >= MAX_PLAYERS)
|
||||
continue;
|
||||
|
||||
if (event->mask & IN_DELETE)
|
||||
{
|
||||
if (g_pads[index].fd >= 0)
|
||||
if (g_pads[idx].fd >= 0)
|
||||
{
|
||||
#ifndef IS_JOYCONFIG
|
||||
if (g_hotplug)
|
||||
{
|
||||
char msg[512];
|
||||
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", index, g_pads[index].ident);
|
||||
snprintf(msg, sizeof(msg), "Joypad #%u (%s) disconnected.", idx, g_pads[idx].ident);
|
||||
msg_queue_push(g_extern.msg_queue, msg, 0, 60);
|
||||
}
|
||||
#endif
|
||||
|
||||
RARCH_LOG("[Joypad]: Joypad %s disconnected.\n", g_pads[index].ident);
|
||||
close(g_pads[index].fd);
|
||||
g_pads[index].buttons = 0;
|
||||
memset(g_pads[index].axes, 0, sizeof(g_pads[index].axes));
|
||||
g_pads[index].fd = -1;
|
||||
*g_pads[index].ident = '\0';
|
||||
RARCH_LOG("[Joypad]: Joypad %s disconnected.\n", g_pads[idx].ident);
|
||||
close(g_pads[idx].fd);
|
||||
g_pads[idx].buttons = 0;
|
||||
memset(g_pads[idx].axes, 0, sizeof(g_pads[idx].axes));
|
||||
g_pads[idx].fd = -1;
|
||||
*g_pads[idx].ident = '\0';
|
||||
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(index, NULL, 0, 0, NULL);
|
||||
input_config_autoconfigure_joypad(idx, NULL, 0, 0, NULL);
|
||||
}
|
||||
}
|
||||
// Sometimes, device will be created before acess to it is established.
|
||||
|
@ -165,11 +165,11 @@ static void handle_plugged_pad(void)
|
|||
{
|
||||
char path[PATH_MAX];
|
||||
snprintf(path, sizeof(path), "/dev/input/%s", event->name);
|
||||
bool ret = linuxraw_joypad_init_pad(path, &g_pads[index]);
|
||||
bool ret = linuxraw_joypad_init_pad(path, &g_pads[idx]);
|
||||
|
||||
if (*g_pads[index].ident && ret)
|
||||
if (*g_pads[idx].ident && ret)
|
||||
/* TODO - implement VID/PID? */
|
||||
input_config_autoconfigure_joypad(index, g_pads[index].ident, 0, 0, "linuxraw");
|
||||
input_config_autoconfigure_joypad(idx, g_pads[idx].ident, 0, 0, "linuxraw");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ static void nullinput_input_poll(void *data)
|
|||
|
||||
static int16_t nullinput_input_state(void *data,
|
||||
const struct retro_keybind **retro_keybinds, unsigned port,
|
||||
unsigned device, unsigned index, unsigned id)
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
(void)data;
|
||||
(void)retro_keybinds;
|
||||
(void)port;
|
||||
(void)device;
|
||||
(void)index;
|
||||
(void)idx;
|
||||
(void)id;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -196,18 +196,18 @@ static void input_overlay_free_overlays(input_overlay_t *ol)
|
|||
|
||||
static bool input_overlay_load_desc(input_overlay_t *ol,
|
||||
config_file_t *conf, struct overlay_desc *desc,
|
||||
unsigned ol_index, unsigned desc_index,
|
||||
unsigned ol_idx, unsigned desc_idx,
|
||||
unsigned width, unsigned height,
|
||||
bool normalized, float alpha_mod, float range_mod)
|
||||
{
|
||||
bool ret = true;
|
||||
char overlay_desc_key[64];
|
||||
snprintf(overlay_desc_key, sizeof(overlay_desc_key),
|
||||
"overlay%u_desc%u", ol_index, desc_index);
|
||||
"overlay%u_desc%u", ol_idx, desc_idx);
|
||||
|
||||
char overlay_desc_image_key[64];
|
||||
snprintf(overlay_desc_image_key, sizeof(overlay_desc_image_key),
|
||||
"overlay%u_desc%u_overlay", ol_index, desc_index);
|
||||
"overlay%u_desc%u_overlay", ol_idx, desc_idx);
|
||||
|
||||
char image_path[PATH_MAX];
|
||||
if (config_get_path(conf, overlay_desc_image_key,
|
||||
|
@ -224,7 +224,7 @@ static bool input_overlay_load_desc(input_overlay_t *ol,
|
|||
|
||||
char overlay_desc_normalized_key[64];
|
||||
snprintf(overlay_desc_normalized_key, sizeof(overlay_desc_normalized_key),
|
||||
"overlay%u_desc%u_normalized", ol_index, desc_index);
|
||||
"overlay%u_desc%u_normalized", ol_idx, desc_idx);
|
||||
config_get_bool(conf, overlay_desc_normalized_key, &normalized);
|
||||
bool by_pixel = !normalized;
|
||||
|
||||
|
@ -286,7 +286,7 @@ static bool input_overlay_load_desc(input_overlay_t *ol,
|
|||
{
|
||||
char overlay_target_key[64];
|
||||
snprintf(overlay_target_key, sizeof(overlay_target_key),
|
||||
"overlay%u_desc%u_next_target", ol_index, desc_index);
|
||||
"overlay%u_desc%u_next_target", ol_idx, desc_idx);
|
||||
config_get_array(conf, overlay_target_key,
|
||||
desc->next_index_name, sizeof(desc->next_index_name));
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ static bool input_overlay_load_desc(input_overlay_t *ol,
|
|||
|
||||
char overlay_analog_saturate_key[64];
|
||||
snprintf(overlay_analog_saturate_key, sizeof(overlay_analog_saturate_key),
|
||||
"overlay%u_desc%u_saturate_pct", ol_index, desc_index);
|
||||
"overlay%u_desc%u_saturate_pct", ol_idx, desc_idx);
|
||||
if (!config_get_float(conf, overlay_analog_saturate_key,
|
||||
&desc->analog_saturate_pct))
|
||||
desc->analog_saturate_pct = 1.0f;
|
||||
|
@ -338,17 +338,17 @@ static bool input_overlay_load_desc(input_overlay_t *ol,
|
|||
|
||||
char conf_key[64];
|
||||
snprintf(conf_key, sizeof(conf_key),
|
||||
"overlay%u_desc%u_alpha_mod", ol_index, desc_index);
|
||||
"overlay%u_desc%u_alpha_mod", ol_idx, desc_idx);
|
||||
desc->alpha_mod = alpha_mod;
|
||||
config_get_float(conf, conf_key, &desc->alpha_mod);
|
||||
|
||||
snprintf(conf_key, sizeof(conf_key),
|
||||
"overlay%u_desc%u_range_mod", ol_index, desc_index);
|
||||
"overlay%u_desc%u_range_mod", ol_idx, desc_idx);
|
||||
desc->range_mod = range_mod;
|
||||
config_get_float(conf, conf_key, &desc->range_mod);
|
||||
|
||||
snprintf(conf_key, sizeof(conf_key),
|
||||
"overlay%u_desc%u_movable", ol_index, desc_index);
|
||||
"overlay%u_desc%u_movable", ol_idx, desc_idx);
|
||||
desc->movable = false;
|
||||
desc->delta_x = 0.0f;
|
||||
desc->delta_y = 0.0f;
|
||||
|
@ -365,7 +365,7 @@ end:
|
|||
|
||||
static bool input_overlay_load_overlay(input_overlay_t *ol,
|
||||
config_file_t *conf, const char *config_path,
|
||||
struct overlay *overlay, unsigned index)
|
||||
struct overlay *overlay, unsigned idx)
|
||||
{
|
||||
size_t i;
|
||||
char overlay_path_key[64];
|
||||
|
@ -374,7 +374,7 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
|
|||
char overlay_resolved_path[PATH_MAX];
|
||||
|
||||
snprintf(overlay_path_key, sizeof(overlay_path_key),
|
||||
"overlay%u_overlay", index);
|
||||
"overlay%u_overlay", idx);
|
||||
|
||||
if (config_get_path(conf, overlay_path_key,
|
||||
overlay_path, sizeof(overlay_path)))
|
||||
|
@ -395,7 +395,7 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
|
|||
}
|
||||
|
||||
snprintf(overlay_name_key, sizeof(overlay_name_key),
|
||||
"overlay%u_name", index);
|
||||
"overlay%u_name", idx);
|
||||
config_get_array(conf, overlay_name_key,
|
||||
overlay->name, sizeof(overlay->name));
|
||||
|
||||
|
@ -405,7 +405,7 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
|
|||
|
||||
char overlay_rect_key[64];
|
||||
snprintf(overlay_rect_key, sizeof(overlay_rect_key),
|
||||
"overlay%u_rect", index);
|
||||
"overlay%u_rect", idx);
|
||||
char overlay_rect[256];
|
||||
|
||||
if (config_get_array(conf, overlay_rect_key,
|
||||
|
@ -428,12 +428,12 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
|
|||
|
||||
char overlay_full_screen_key[64];
|
||||
snprintf(overlay_full_screen_key, sizeof(overlay_full_screen_key),
|
||||
"overlay%u_full_screen", index);
|
||||
"overlay%u_full_screen", idx);
|
||||
overlay->full_screen = false;
|
||||
config_get_bool(conf, overlay_full_screen_key, &overlay->full_screen);
|
||||
|
||||
char overlay_descs_key[64];
|
||||
snprintf(overlay_descs_key, sizeof(overlay_descs_key), "overlay%u_descs", index);
|
||||
snprintf(overlay_descs_key, sizeof(overlay_descs_key), "overlay%u_descs", idx);
|
||||
|
||||
unsigned descs = 0;
|
||||
if (!config_get_uint(conf, overlay_descs_key, &descs))
|
||||
|
@ -457,20 +457,20 @@ static bool input_overlay_load_overlay(input_overlay_t *ol,
|
|||
char conf_key[64];
|
||||
bool normalized = false;
|
||||
snprintf(conf_key, sizeof(conf_key),
|
||||
"overlay%u_normalized", index);
|
||||
"overlay%u_normalized", idx);
|
||||
config_get_bool(conf, conf_key, &normalized);
|
||||
|
||||
float alpha_mod = 1.0f;
|
||||
snprintf(conf_key, sizeof(conf_key), "overlay%u_alpha_mod", index);
|
||||
snprintf(conf_key, sizeof(conf_key), "overlay%u_alpha_mod", idx);
|
||||
config_get_float(conf, conf_key, &alpha_mod);
|
||||
|
||||
float range_mod = 1.0f;
|
||||
snprintf(conf_key, sizeof(conf_key), "overlay%u_range_mod", index);
|
||||
snprintf(conf_key, sizeof(conf_key), "overlay%u_range_mod", idx);
|
||||
config_get_float(conf, conf_key, &range_mod);
|
||||
|
||||
for (i = 0; i < overlay->size; i++)
|
||||
{
|
||||
if (!input_overlay_load_desc(ol, conf, &overlay->descs[i], index, i,
|
||||
if (!input_overlay_load_desc(ol, conf, &overlay->descs[i], idx, i,
|
||||
overlay->image.width, overlay->image.height,
|
||||
normalized, alpha_mod, range_mod))
|
||||
{
|
||||
|
@ -525,10 +525,10 @@ static ssize_t input_overlay_find_index(const struct overlay *ol,
|
|||
}
|
||||
|
||||
static bool input_overlay_resolve_targets(struct overlay *ol,
|
||||
size_t index, size_t size)
|
||||
size_t idx, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
struct overlay *current = (struct overlay*)&ol[index];
|
||||
struct overlay *current = (struct overlay*)&ol[idx];
|
||||
|
||||
for (i = 0; i < current->size; i++)
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ static bool input_overlay_resolve_targets(struct overlay *ol,
|
|||
current->descs[i].next_index = idx;
|
||||
}
|
||||
else
|
||||
current->descs[i].next_index = (index + 1) % size;
|
||||
current->descs[i].next_index = (idx + 1) % size;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -96,7 +96,7 @@ static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
|||
static int16_t ps3_input_state(void *data,
|
||||
const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||
|
||||
|
@ -108,7 +108,7 @@ static int16_t ps3_input_state(void *data,
|
|||
case RETRO_DEVICE_JOYPAD:
|
||||
return input_joypad_pressed(ps3->joypad, port, binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(ps3->joypad, port, index, id, binds[port]);
|
||||
return input_joypad_analog(ps3->joypad, port, idx, id, binds[port]);
|
||||
#if 0
|
||||
case RETRO_DEVICE_SENSOR_ACCELEROMETER:
|
||||
switch (id)
|
||||
|
|
|
@ -51,7 +51,7 @@ static void psp_input_poll(void *data)
|
|||
|
||||
static int16_t psp_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
psp_input_t *psp = (psp_input_t*)data;
|
||||
|
||||
|
@ -63,7 +63,7 @@ static int16_t psp_input_state(void *data, const struct retro_keybind **binds,
|
|||
case RETRO_DEVICE_JOYPAD:
|
||||
return input_joypad_pressed(psp->joypad, port, binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return input_joypad_analog(psp->joypad, port, index, id, binds[port]);
|
||||
return input_joypad_analog(psp->joypad, port, idx, id, binds[port]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -704,12 +704,12 @@ static void qnx_input_poll(void *data)
|
|||
*/
|
||||
|
||||
static int16_t qnx_analog_input_state(qnx_input_t *qnx,
|
||||
unsigned port, unsigned index, unsigned id)
|
||||
unsigned port, unsigned idx, unsigned id)
|
||||
{
|
||||
#ifdef HAVE_BB10
|
||||
if(qnx->port_device[port])
|
||||
{
|
||||
switch ((index << 1) | id)
|
||||
switch ((idx << 1) | id)
|
||||
{
|
||||
case (RETRO_DEVICE_INDEX_ANALOG_LEFT << 1) | RETRO_DEVICE_ID_ANALOG_X:
|
||||
return qnx->port_device[port]->analog0[0] * 256;
|
||||
|
@ -727,38 +727,38 @@ static int16_t qnx_analog_input_state(qnx_input_t *qnx,
|
|||
}
|
||||
|
||||
static int16_t qnx_pointer_screen_input_state(qnx_input_t *qnx,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
return qnx->pointer[qnx->touch_map[index]].full_x;
|
||||
return qnx->pointer[qnx->touch_map[idx]].full_x;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
return qnx->pointer[qnx->touch_map[index]].full_y;
|
||||
return qnx->pointer[qnx->touch_map[idx]].full_y;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return (
|
||||
index < qnx->pointer_count)
|
||||
&& (qnx->pointer[index].full_x != -0x8000)
|
||||
&& (qnx->pointer[index].full_y != -0x8000);
|
||||
idx < qnx->pointer_count)
|
||||
&& (qnx->pointer[idx].full_x != -0x8000)
|
||||
&& (qnx->pointer[idx].full_y != -0x8000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int16_t qnx_pointer_input_state(qnx_input_t *qnx,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case RETRO_DEVICE_ID_POINTER_X:
|
||||
return qnx->pointer[qnx->touch_map[index]].x;
|
||||
return qnx->pointer[qnx->touch_map[idx]].x;
|
||||
case RETRO_DEVICE_ID_POINTER_Y:
|
||||
return qnx->pointer[qnx->touch_map[index]].y;
|
||||
return qnx->pointer[qnx->touch_map[idx]].y;
|
||||
case RETRO_DEVICE_ID_POINTER_PRESSED:
|
||||
return (
|
||||
index < qnx->pointer_count)
|
||||
&& (qnx->pointer[index].x != -0x8000)
|
||||
&& (qnx->pointer[index].y != -0x8000);
|
||||
idx < qnx->pointer_count)
|
||||
&& (qnx->pointer[idx].x != -0x8000)
|
||||
&& (qnx->pointer[idx].y != -0x8000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -766,7 +766,7 @@ static int16_t qnx_pointer_input_state(qnx_input_t *qnx,
|
|||
|
||||
static int16_t qnx_input_state(void *data,
|
||||
const struct retro_keybind **retro_keybinds,
|
||||
unsigned port, unsigned device, unsigned index, unsigned id)
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
qnx_input_t *qnx = (qnx_input_t*)data;
|
||||
|
||||
|
@ -776,11 +776,11 @@ static int16_t qnx_input_state(void *data,
|
|||
return input_joypad_pressed(qnx->joypad, port,
|
||||
(unsigned int)g_settings.input.binds[port], id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return qnx_analog_input_state(qnx, port, index, id);
|
||||
return qnx_analog_input_state(qnx, port, idx, id);
|
||||
case RARCH_DEVICE_POINTER_SCREEN:
|
||||
return qnx_pointer_screen_input_state(qnx, index, id);
|
||||
return qnx_pointer_screen_input_state(qnx, idx, id);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
return qnx_pointer_input_state(qnx, index, id);
|
||||
return qnx_pointer_input_state(qnx, idx, id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -93,18 +93,20 @@ static int16_t rwebinput_mouse_state(rwebinput_input_t *rwebinput, unsigned id)
|
|||
}
|
||||
}
|
||||
|
||||
static int16_t rwebinput_analog_pressed(rwebinput_input_t *rwebinput, const struct retro_keybind *binds, unsigned index, unsigned id)
|
||||
static int16_t rwebinput_analog_pressed(rwebinput_input_t *rwebinput,
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);
|
||||
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
|
||||
|
||||
int16_t pressed_minus = rwebinput_is_pressed(rwebinput, binds, id_minus) ? -0x7fff : 0;
|
||||
int16_t pressed_plus = rwebinput_is_pressed(rwebinput, binds, id_plus) ? 0x7fff : 0;
|
||||
return pressed_plus + pressed_minus;
|
||||
}
|
||||
|
||||
static int16_t rwebinput_input_state(void *data, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id)
|
||||
static int16_t rwebinput_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
||||
|
||||
|
@ -114,7 +116,7 @@ static int16_t rwebinput_input_state(void *data, const struct retro_keybind **bi
|
|||
return rwebinput_is_pressed(rwebinput, binds[port], id);
|
||||
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return rwebinput_analog_pressed(rwebinput, binds[port], index, id);
|
||||
return rwebinput_analog_pressed(rwebinput, binds[port], idx, id);
|
||||
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return rwebinput_key_pressed(rwebinput, id);
|
||||
|
|
|
@ -77,11 +77,11 @@ static bool sdl_is_pressed(sdl_input_t *sdl, unsigned port_num, const struct ret
|
|||
}
|
||||
|
||||
static int16_t sdl_analog_pressed(sdl_input_t *sdl, const struct retro_keybind *binds,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);
|
||||
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
|
||||
|
||||
int16_t pressed_minus = sdl_key_pressed(binds[id_minus].key) ? -0x7fff : 0;
|
||||
int16_t pressed_plus = sdl_key_pressed(binds[id_plus].key) ? 0x7fff : 0;
|
||||
|
@ -106,11 +106,11 @@ static int16_t sdl_joypad_device_state(sdl_input_t *sdl, const struct retro_keyb
|
|||
}
|
||||
|
||||
static int16_t sdl_analog_device_state(sdl_input_t *sdl, const struct retro_keybind **binds,
|
||||
unsigned port_num, unsigned index, unsigned id)
|
||||
unsigned port_num, unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t ret = sdl_analog_pressed(sdl, binds[port_num], index, id);
|
||||
int16_t ret = sdl_analog_pressed(sdl, binds[port_num], idx, id);
|
||||
if (!ret)
|
||||
ret = input_joypad_analog(sdl->joypad, port_num, index, id, binds[port_num]);
|
||||
ret = input_joypad_analog(sdl->joypad, port_num, idx, id, binds[port_num]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -142,9 +142,10 @@ static int16_t sdl_mouse_device_state(sdl_input_t *sdl, unsigned id)
|
|||
}
|
||||
}
|
||||
|
||||
static int16_t sdl_pointer_device_state(sdl_input_t *sdl, unsigned index, unsigned id, bool screen)
|
||||
static int16_t sdl_pointer_device_state(sdl_input_t *sdl,
|
||||
unsigned idx, unsigned id, bool screen)
|
||||
{
|
||||
if (index != 0)
|
||||
if (idx != 0)
|
||||
return 0;
|
||||
|
||||
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
|
||||
|
@ -201,7 +202,8 @@ static int16_t sdl_lightgun_device_state(sdl_input_t *sdl, unsigned id)
|
|||
}
|
||||
}
|
||||
|
||||
static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned index, unsigned id)
|
||||
static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
sdl_input_t *data = (sdl_input_t*)data_;
|
||||
switch (device)
|
||||
|
@ -209,20 +211,19 @@ static int16_t sdl_input_state(void *data_, const struct retro_keybind **binds,
|
|||
case RETRO_DEVICE_JOYPAD:
|
||||
return sdl_joypad_device_state(data, binds, port, id);
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
return sdl_analog_device_state(data, binds, port, index, id);
|
||||
return sdl_analog_device_state(data, binds, port, idx, id);
|
||||
case RETRO_DEVICE_MOUSE:
|
||||
return sdl_mouse_device_state(data, id);
|
||||
case RETRO_DEVICE_POINTER:
|
||||
case RARCH_DEVICE_POINTER_SCREEN:
|
||||
return sdl_pointer_device_state(data, index, id, device == RARCH_DEVICE_POINTER_SCREEN);
|
||||
return sdl_pointer_device_state(data, idx, id, device == RARCH_DEVICE_POINTER_SCREEN);
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
return sdl_keyboard_device_state(data, id);
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
return sdl_lightgun_device_state(data, id);
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sdl_input_free(void *data)
|
||||
|
@ -263,7 +264,8 @@ static void sdl_grab_mouse(void *data, bool state)
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool sdl_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength)
|
||||
static bool sdl_set_rumble(void *data, unsigned port,
|
||||
enum retro_rumble_effect effect, uint16_t strength)
|
||||
{
|
||||
sdl_input_t *sdl = (sdl_input_t*)data;
|
||||
return input_joypad_set_rumble(sdl->joypad, port, effect, strength);
|
||||
|
|
|
@ -511,11 +511,11 @@ static bool udev_input_is_pressed(udev_input_t *udev, const struct retro_keybind
|
|||
}
|
||||
|
||||
static int16_t udev_analog_pressed(udev_input_t *udev,
|
||||
const struct retro_keybind *binds, unsigned index, unsigned id)
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);
|
||||
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
|
||||
|
||||
int16_t pressed_minus = udev_input_is_pressed(udev,
|
||||
binds, id_minus) ? -0x7fff : 0;
|
||||
|
@ -525,7 +525,7 @@ static int16_t udev_analog_pressed(udev_input_t *udev,
|
|||
}
|
||||
|
||||
static int16_t udev_input_state(void *data, const struct retro_keybind **binds,
|
||||
unsigned port, unsigned device, unsigned index, unsigned id)
|
||||
unsigned port, unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
int16_t ret;
|
||||
|
@ -537,9 +537,9 @@ static int16_t udev_input_state(void *data, const struct retro_keybind **binds,
|
|||
input_joypad_pressed(udev->joypad, port, binds[port], id);
|
||||
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = udev_analog_pressed(udev, binds[port], index, id);
|
||||
ret = udev_analog_pressed(udev, binds[port], idx, id);
|
||||
if (!ret)
|
||||
ret = input_joypad_analog(udev->joypad, port, index, id, binds[port]);
|
||||
ret = input_joypad_analog(udev->joypad, port, idx, id, binds[port]);
|
||||
return ret;
|
||||
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
|
|
|
@ -86,11 +86,11 @@ static bool x_is_pressed(x11_input_t *x11,
|
|||
}
|
||||
|
||||
static int16_t x_pressed_analog(x11_input_t *x11,
|
||||
const struct retro_keybind *binds, unsigned index, unsigned id)
|
||||
const struct retro_keybind *binds, unsigned idx, unsigned id)
|
||||
{
|
||||
unsigned id_minus = 0;
|
||||
unsigned id_plus = 0;
|
||||
input_conv_analog_id_to_bind_id(index, id, &id_minus, &id_plus);
|
||||
input_conv_analog_id_to_bind_id(idx, id, &id_minus, &id_plus);
|
||||
|
||||
int16_t pressed_minus = x_is_pressed(x11, binds, id_minus) ? -0x7fff : 0;
|
||||
int16_t pressed_plus = x_is_pressed(x11, binds, id_plus) ? 0x7fff : 0;
|
||||
|
@ -128,9 +128,9 @@ static int16_t x_mouse_state(x11_input_t *x11, unsigned id)
|
|||
}
|
||||
|
||||
static int16_t x_pointer_state(x11_input_t *x11,
|
||||
unsigned index, unsigned id, bool screen)
|
||||
unsigned idx, unsigned id, bool screen)
|
||||
{
|
||||
if (index != 0)
|
||||
if (idx != 0)
|
||||
return 0;
|
||||
|
||||
int16_t res_x = 0, res_y = 0, res_screen_x = 0, res_screen_y = 0;
|
||||
|
@ -189,7 +189,7 @@ static int16_t x_lightgun_state(x11_input_t *x11, unsigned id)
|
|||
|
||||
static int16_t x_input_state(void *data,
|
||||
const struct retro_keybind **binds, unsigned port,
|
||||
unsigned device, unsigned index, unsigned id)
|
||||
unsigned device, unsigned idx, unsigned id)
|
||||
{
|
||||
x11_input_t *x11 = (x11_input_t*)data;
|
||||
int16_t ret;
|
||||
|
@ -204,9 +204,9 @@ static int16_t x_input_state(void *data,
|
|||
return x_key_pressed(x11, id);
|
||||
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
ret = x_pressed_analog(x11, binds[port], index, id);
|
||||
ret = x_pressed_analog(x11, binds[port], idx, id);
|
||||
if (!ret)
|
||||
ret = input_joypad_analog(x11->joypad, port, index,
|
||||
ret = input_joypad_analog(x11->joypad, port, idx,
|
||||
id, binds[port]);
|
||||
return ret;
|
||||
|
||||
|
@ -215,7 +215,7 @@ static int16_t x_input_state(void *data,
|
|||
|
||||
case RETRO_DEVICE_POINTER:
|
||||
case RARCH_DEVICE_POINTER_SCREEN:
|
||||
return x_pointer_state(x11, index, id,
|
||||
return x_pointer_state(x11, idx, id,
|
||||
device == RARCH_DEVICE_POINTER_SCREEN);
|
||||
|
||||
case RETRO_DEVICE_LIGHTGUN:
|
||||
|
|
|
@ -56,10 +56,10 @@ static void xenon360_input_poll(void *data)
|
|||
|
||||
static int16_t xenon360_input_state(void *data, const struct retro_keybind **binds,
|
||||
bool port, unsigned device,
|
||||
unsigned index, unsigned id)
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
(void)data;
|
||||
(void)index;
|
||||
(void)idx;
|
||||
unsigned player = port;
|
||||
uint64_t button = binds[player][id].joykey;
|
||||
int16_t retval = 0;
|
||||
|
|
Loading…
Reference in New Issue