Fix more 'player' variables to 'user'
This commit is contained in:
parent
181d163b36
commit
57918c0c24
|
@ -243,7 +243,7 @@ static int android_input_get_id_port(android_input_t *android, int id,
|
|||
unsigned i;
|
||||
if (source & (AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_MOUSE |
|
||||
AINPUT_SOURCE_TOUCHPAD))
|
||||
return 0; /* touch overlay is always player 1 */
|
||||
return 0; /* touch overlay is always user 1 */
|
||||
|
||||
for (i = 0; i < android->pads_connected; i++)
|
||||
if (android->pad_states[i].id == id)
|
||||
|
@ -398,7 +398,7 @@ static void handle_hotplug(android_input_t *android,
|
|||
//and Xperia Play. We need to keep 'count' of the amount of similar (grouped)
|
||||
//devices.
|
||||
//
|
||||
//For Xperia Play - count similar devices and bind them to the same 'player'
|
||||
//For Xperia Play - count similar devices and bind them to the same 'user'
|
||||
//port
|
||||
//
|
||||
//For nVidia Shield - see above
|
||||
|
@ -489,7 +489,7 @@ static void handle_hotplug(android_input_t *android,
|
|||
strlcpy(name_buf, "Defender Game Racer Classic", sizeof(name_buf));
|
||||
else if (strstr(device_name, "NVIDIA Controller"))
|
||||
{
|
||||
/* Shield is always player 1. FIXME: This is kinda ugly.
|
||||
/* Shield is always user 1. FIXME: This is kinda ugly.
|
||||
* We really need to find a way to detect useless input devices
|
||||
* like gpio-keys in a general way.
|
||||
*/
|
||||
|
|
|
@ -55,7 +55,7 @@ static bool input_joypad_is_pressed(
|
|||
if (joy_idx >= MAX_PLAYERS)
|
||||
return false;
|
||||
|
||||
/* Auto-binds are per joypad, not per player. */
|
||||
/* Auto-binds are per joypad, not per user. */
|
||||
const struct retro_keybind *auto_binds =
|
||||
g_settings.input.autoconf_binds[joy_idx];
|
||||
|
||||
|
@ -102,7 +102,7 @@ int16_t input_joypad_analog(const rarch_joypad_driver_t *drv,
|
|||
if (joy_idx >= MAX_PLAYERS)
|
||||
return 0;
|
||||
|
||||
/* Auto-binds are per joypad, not per player. */
|
||||
/* Auto-binds are per joypad, not per user. */
|
||||
const struct retro_keybind *auto_binds =
|
||||
g_settings.input.autoconf_binds[joy_idx];
|
||||
|
||||
|
@ -206,7 +206,7 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
|||
return true;
|
||||
}
|
||||
|
||||
static const char *bind_player_prefix[MAX_PLAYERS] = {
|
||||
static const char *bind_user_prefix[MAX_PLAYERS] = {
|
||||
"input_player1",
|
||||
"input_player2",
|
||||
"input_player3",
|
||||
|
@ -276,7 +276,7 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = {
|
|||
DECLARE_META_BIND(2, cheat_toggle, RARCH_CHEAT_TOGGLE, "Cheat toggle"),
|
||||
DECLARE_META_BIND(2, screenshot, RARCH_SCREENSHOT, "Take screenshot"),
|
||||
DECLARE_META_BIND(2, audio_mute, RARCH_MUTE, "Audio mute toggle"),
|
||||
DECLARE_META_BIND(2, netplay_flip_players, RARCH_NETPLAY_FLIP, "Netplay flip players"),
|
||||
DECLARE_META_BIND(2, netplay_flip_players, RARCH_NETPLAY_FLIP, "Netplay flip users"),
|
||||
DECLARE_META_BIND(2, slowmotion, RARCH_SLOWMOTION, "Slow motion"),
|
||||
DECLARE_META_BIND(2, enable_hotkey, RARCH_ENABLE_HOTKEY, "Enable hotkeys"),
|
||||
DECLARE_META_BIND(2, volume_up, RARCH_VOLUME_UP, "Volume +"),
|
||||
|
@ -304,13 +304,13 @@ void input_config_parse_key(config_file_t *conf,
|
|||
bind->key = input_translate_str_to_rk(tmp);
|
||||
}
|
||||
|
||||
const char *input_config_get_prefix(unsigned player, bool meta)
|
||||
const char *input_config_get_prefix(unsigned user, bool meta)
|
||||
{
|
||||
if (player == 0)
|
||||
return meta ? "input" : bind_player_prefix[player];
|
||||
else if (player != 0 && !meta)
|
||||
return bind_player_prefix[player];
|
||||
/* Don't bother with meta bind for anyone else than first player. */
|
||||
if (user == 0)
|
||||
return meta ? "input" : bind_user_prefix[user];
|
||||
else if (user != 0 && !meta)
|
||||
return bind_user_prefix[user];
|
||||
/* Don't bother with meta bind for anyone else than first user. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static void ps3_input_poll(void *data)
|
|||
|
||||
#ifdef HAVE_MOUSE
|
||||
static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
|
||||
unsigned player, unsigned id)
|
||||
unsigned user, unsigned id)
|
||||
{
|
||||
CellMouseData mouse_state;
|
||||
cellMouseGetData(id, &mouse_state);
|
||||
|
|
|
@ -129,7 +129,7 @@ static void process_gamepad_event(void *data,
|
|||
screen_get_event_property_iv(screen_event,
|
||||
SCREEN_PROPERTY_ANALOG1, controller->analog1);
|
||||
|
||||
/* Only player 1
|
||||
/* Only user 1
|
||||
* TODO: Am I missing something? Is there a better way? */
|
||||
if((controller->port == 0) &&
|
||||
(controller->buttons &
|
||||
|
|
|
@ -89,7 +89,7 @@ typedef struct
|
|||
// to have to pass through unhandled joypad numbers to DI, a slightly ugly
|
||||
// hack is required here. dinput_joypad_init will fill this.
|
||||
// For each pad index, the appropriate entry will be set to -1 if it is not
|
||||
// a 360 pad, or the correct XInput player number (0..3 inclusive) if it is.
|
||||
// a 360 pad, or the correct XInput user number (0..3 inclusive) if it is.
|
||||
extern int g_xinput_pad_indexes[MAX_PLAYERS];
|
||||
extern bool g_xinput_block_pads;
|
||||
|
||||
|
@ -116,7 +116,7 @@ static XINPUT_VIBRATION g_xinput_rumble_states[4];
|
|||
|
||||
static winxinput_joypad_state g_winxinput_states[4];
|
||||
|
||||
static inline int pad_index_to_xplayer_index(unsigned pad)
|
||||
static inline int pad_index_to_xuser_index(unsigned pad)
|
||||
{
|
||||
return g_xinput_pad_indexes[pad];
|
||||
}
|
||||
|
@ -133,12 +133,12 @@ static const char* const XBOX_CONTROLLER_NAMES[4] =
|
|||
|
||||
const char* winxinput_joypad_name (unsigned pad)
|
||||
{
|
||||
int xplayer = pad_index_to_xplayer_index(pad);
|
||||
int xuser = pad_index_to_xuser_index(pad);
|
||||
|
||||
if (xplayer < 0)
|
||||
if (xuser < 0)
|
||||
return dinput_joypad.name(pad);
|
||||
// TODO: Different name if disconnected?
|
||||
return XBOX_CONTROLLER_NAMES[xplayer];
|
||||
return XBOX_CONTROLLER_NAMES[xuser];
|
||||
}
|
||||
|
||||
static bool winxinput_joypad_init(void)
|
||||
|
@ -209,7 +209,7 @@ static bool winxinput_joypad_init(void)
|
|||
{
|
||||
g_winxinput_states[i].connected = !(g_XInputGetStateEx(i, &dummy_state) == ERROR_DEVICE_NOT_CONNECTED);
|
||||
if (g_winxinput_states[i].connected)
|
||||
RARCH_LOG("Found XInput controller, player #%u\n", i);
|
||||
RARCH_LOG("Found XInput controller, user #%u\n", i);
|
||||
}
|
||||
|
||||
if ((!g_winxinput_states[0].connected) &&
|
||||
|
@ -230,7 +230,7 @@ static bool winxinput_joypad_init(void)
|
|||
|
||||
for (autoconf_pad = 0; autoconf_pad < MAX_PLAYERS; autoconf_pad++)
|
||||
{
|
||||
if (pad_index_to_xplayer_index(autoconf_pad) > -1)
|
||||
if (pad_index_to_xuser_index(autoconf_pad) > -1)
|
||||
{
|
||||
strlcpy(g_settings.input.device_names[autoconf_pad],
|
||||
winxinput_joypad_name(autoconf_pad),
|
||||
|
@ -249,9 +249,9 @@ static bool winxinput_joypad_init(void)
|
|||
|
||||
static bool winxinput_joypad_query_pad(unsigned pad)
|
||||
{
|
||||
int xplayer = pad_index_to_xplayer_index(pad);
|
||||
if (xplayer > -1)
|
||||
return g_winxinput_states[xplayer].connected;
|
||||
int xuser = pad_index_to_xuser_index(pad);
|
||||
if (xuser > -1)
|
||||
return g_winxinput_states[xuser].connected;
|
||||
return dinput_joypad.query_pad(pad);
|
||||
}
|
||||
|
||||
|
@ -292,14 +292,14 @@ static bool winxinput_joypad_button (unsigned port_num, uint16_t joykey)
|
|||
if (joykey == NO_BTN)
|
||||
return false;
|
||||
|
||||
int xplayer = pad_index_to_xplayer_index(port_num);
|
||||
if (xplayer == -1)
|
||||
int xuser = pad_index_to_xuser_index(port_num);
|
||||
if (xuser == -1)
|
||||
return dinput_joypad.button(port_num, joykey);
|
||||
|
||||
if (!(g_winxinput_states[xplayer].connected))
|
||||
if (!(g_winxinput_states[xuser].connected))
|
||||
return false;
|
||||
|
||||
uint16_t btn_word = g_winxinput_states[xplayer].xstate.Gamepad.wButtons;
|
||||
uint16_t btn_word = g_winxinput_states[xuser].xstate.Gamepad.wButtons;
|
||||
|
||||
if (GET_HAT_DIR(joykey))
|
||||
{
|
||||
|
@ -332,12 +332,12 @@ static int16_t winxinput_joypad_axis (unsigned port_num, uint32_t joyaxis)
|
|||
if (joyaxis == AXIS_NONE)
|
||||
return 0;
|
||||
|
||||
int xplayer = pad_index_to_xplayer_index(port_num);
|
||||
int xuser = pad_index_to_xuser_index(port_num);
|
||||
|
||||
if (xplayer == -1)
|
||||
if (xuser == -1)
|
||||
return dinput_joypad.axis(port_num, joyaxis);
|
||||
|
||||
if (!(g_winxinput_states[xplayer].connected))
|
||||
if (!(g_winxinput_states[xuser].connected))
|
||||
return 0;
|
||||
|
||||
int16_t val = 0;
|
||||
|
@ -358,7 +358,7 @@ static int16_t winxinput_joypad_axis (unsigned port_num, uint32_t joyaxis)
|
|||
is_pos = true;
|
||||
}
|
||||
|
||||
XINPUT_GAMEPAD* pad = &(g_winxinput_states[xplayer].xstate.Gamepad);
|
||||
XINPUT_GAMEPAD* pad = &(g_winxinput_states[xuser].xstate.Gamepad);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
|
@ -416,8 +416,8 @@ static void winxinput_joypad_poll(void)
|
|||
static bool winxinput_joypad_rumble(unsigned pad,
|
||||
enum retro_rumble_effect effect, uint16_t strength)
|
||||
{
|
||||
int xplayer = pad_index_to_xplayer_index(pad);
|
||||
if (xplayer == -1)
|
||||
int xuser = pad_index_to_xuser_index(pad);
|
||||
if (xuser == -1)
|
||||
{
|
||||
if (dinput_joypad.set_rumble)
|
||||
return dinput_joypad.set_rumble(pad, effect, strength);
|
||||
|
@ -426,11 +426,11 @@ static bool winxinput_joypad_rumble(unsigned pad,
|
|||
|
||||
/* Consider the low frequency (left) motor the "strong" one. */
|
||||
if (effect == RETRO_RUMBLE_STRONG)
|
||||
g_xinput_rumble_states[xplayer].wLeftMotorSpeed = strength;
|
||||
g_xinput_rumble_states[xuser].wLeftMotorSpeed = strength;
|
||||
else if (effect == RETRO_RUMBLE_WEAK)
|
||||
g_xinput_rumble_states[xplayer].wRightMotorSpeed = strength;
|
||||
g_xinput_rumble_states[xuser].wRightMotorSpeed = strength;
|
||||
|
||||
return g_XInputSetState(xplayer, &g_xinput_rumble_states[xplayer])
|
||||
return g_XInputSetState(xuser, &g_xinput_rumble_states[xuser])
|
||||
== ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,16 +60,16 @@ static int16_t xenon360_input_state(void *data, const struct retro_keybind **bin
|
|||
{
|
||||
(void)data;
|
||||
(void)idx;
|
||||
unsigned player = port;
|
||||
uint64_t button = binds[player][id].joykey;
|
||||
unsigned user = port;
|
||||
uint64_t button = binds[user][id].joykey;
|
||||
int16_t retval = 0;
|
||||
|
||||
if(player < MAX_PADS)
|
||||
if(user < MAX_PADS)
|
||||
{
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
retval = (state[player] & button) ? 1 : 0;
|
||||
retval = (state[user] & button) ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue