Fix more 'player' variables to 'user'

This commit is contained in:
twinaphex 2014-12-05 13:53:49 +01:00
parent 181d163b36
commit 57918c0c24
6 changed files with 42 additions and 42 deletions

View File

@ -243,7 +243,7 @@ static int android_input_get_id_port(android_input_t *android, int id,
unsigned i; unsigned i;
if (source & (AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_MOUSE | if (source & (AINPUT_SOURCE_TOUCHSCREEN | AINPUT_SOURCE_MOUSE |
AINPUT_SOURCE_TOUCHPAD)) 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++) for (i = 0; i < android->pads_connected; i++)
if (android->pad_states[i].id == id) 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) //and Xperia Play. We need to keep 'count' of the amount of similar (grouped)
//devices. //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 //port
// //
//For nVidia Shield - see above //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)); strlcpy(name_buf, "Defender Game Racer Classic", sizeof(name_buf));
else if (strstr(device_name, "NVIDIA Controller")) 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 * We really need to find a way to detect useless input devices
* like gpio-keys in a general way. * like gpio-keys in a general way.
*/ */

View File

@ -55,7 +55,7 @@ static bool input_joypad_is_pressed(
if (joy_idx >= MAX_PLAYERS) if (joy_idx >= MAX_PLAYERS)
return false; return false;
/* Auto-binds are per joypad, not per player. */ /* Auto-binds are per joypad, not per user. */
const struct retro_keybind *auto_binds = const struct retro_keybind *auto_binds =
g_settings.input.autoconf_binds[joy_idx]; 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) if (joy_idx >= MAX_PLAYERS)
return 0; return 0;
/* Auto-binds are per joypad, not per player. */ /* Auto-binds are per joypad, not per user. */
const struct retro_keybind *auto_binds = const struct retro_keybind *auto_binds =
g_settings.input.autoconf_binds[joy_idx]; g_settings.input.autoconf_binds[joy_idx];
@ -206,7 +206,7 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
return true; return true;
} }
static const char *bind_player_prefix[MAX_PLAYERS] = { static const char *bind_user_prefix[MAX_PLAYERS] = {
"input_player1", "input_player1",
"input_player2", "input_player2",
"input_player3", "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, cheat_toggle, RARCH_CHEAT_TOGGLE, "Cheat toggle"),
DECLARE_META_BIND(2, screenshot, RARCH_SCREENSHOT, "Take screenshot"), DECLARE_META_BIND(2, screenshot, RARCH_SCREENSHOT, "Take screenshot"),
DECLARE_META_BIND(2, audio_mute, RARCH_MUTE, "Audio mute toggle"), 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, slowmotion, RARCH_SLOWMOTION, "Slow motion"),
DECLARE_META_BIND(2, enable_hotkey, RARCH_ENABLE_HOTKEY, "Enable hotkeys"), DECLARE_META_BIND(2, enable_hotkey, RARCH_ENABLE_HOTKEY, "Enable hotkeys"),
DECLARE_META_BIND(2, volume_up, RARCH_VOLUME_UP, "Volume +"), 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); 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) if (user == 0)
return meta ? "input" : bind_player_prefix[player]; return meta ? "input" : bind_user_prefix[user];
else if (player != 0 && !meta) else if (user != 0 && !meta)
return bind_player_prefix[player]; return bind_user_prefix[user];
/* Don't bother with meta bind for anyone else than first player. */ /* Don't bother with meta bind for anyone else than first user. */
return NULL; return NULL;
} }

View File

@ -67,7 +67,7 @@ static void ps3_input_poll(void *data)
#ifdef HAVE_MOUSE #ifdef HAVE_MOUSE
static int16_t ps3_mouse_device_state(ps3_input_t *ps3, static int16_t ps3_mouse_device_state(ps3_input_t *ps3,
unsigned player, unsigned id) unsigned user, unsigned id)
{ {
CellMouseData mouse_state; CellMouseData mouse_state;
cellMouseGetData(id, &mouse_state); cellMouseGetData(id, &mouse_state);

View File

@ -129,7 +129,7 @@ static void process_gamepad_event(void *data,
screen_get_event_property_iv(screen_event, screen_get_event_property_iv(screen_event,
SCREEN_PROPERTY_ANALOG1, controller->analog1); SCREEN_PROPERTY_ANALOG1, controller->analog1);
/* Only player 1 /* Only user 1
* TODO: Am I missing something? Is there a better way? */ * TODO: Am I missing something? Is there a better way? */
if((controller->port == 0) && if((controller->port == 0) &&
(controller->buttons & (controller->buttons &

View File

@ -89,7 +89,7 @@ typedef struct
// to have to pass through unhandled joypad numbers to DI, a slightly ugly // to have to pass through unhandled joypad numbers to DI, a slightly ugly
// hack is required here. dinput_joypad_init will fill this. // 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 // 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 int g_xinput_pad_indexes[MAX_PLAYERS];
extern bool g_xinput_block_pads; 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 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]; 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) 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); return dinput_joypad.name(pad);
// TODO: Different name if disconnected? // TODO: Different name if disconnected?
return XBOX_CONTROLLER_NAMES[xplayer]; return XBOX_CONTROLLER_NAMES[xuser];
} }
static bool winxinput_joypad_init(void) 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); g_winxinput_states[i].connected = !(g_XInputGetStateEx(i, &dummy_state) == ERROR_DEVICE_NOT_CONNECTED);
if (g_winxinput_states[i].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) && 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++) 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], strlcpy(g_settings.input.device_names[autoconf_pad],
winxinput_joypad_name(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) static bool winxinput_joypad_query_pad(unsigned pad)
{ {
int xplayer = pad_index_to_xplayer_index(pad); int xuser = pad_index_to_xuser_index(pad);
if (xplayer > -1) if (xuser > -1)
return g_winxinput_states[xplayer].connected; return g_winxinput_states[xuser].connected;
return dinput_joypad.query_pad(pad); 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) if (joykey == NO_BTN)
return false; return false;
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.button(port_num, joykey); return dinput_joypad.button(port_num, joykey);
if (!(g_winxinput_states[xplayer].connected)) if (!(g_winxinput_states[xuser].connected))
return false; 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)) 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) if (joyaxis == AXIS_NONE)
return 0; 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); return dinput_joypad.axis(port_num, joyaxis);
if (!(g_winxinput_states[xplayer].connected)) if (!(g_winxinput_states[xuser].connected))
return 0; return 0;
int16_t val = 0; int16_t val = 0;
@ -358,7 +358,7 @@ static int16_t winxinput_joypad_axis (unsigned port_num, uint32_t joyaxis)
is_pos = true; is_pos = true;
} }
XINPUT_GAMEPAD* pad = &(g_winxinput_states[xplayer].xstate.Gamepad); XINPUT_GAMEPAD* pad = &(g_winxinput_states[xuser].xstate.Gamepad);
switch (axis) switch (axis)
{ {
@ -416,8 +416,8 @@ static void winxinput_joypad_poll(void)
static bool winxinput_joypad_rumble(unsigned pad, static bool winxinput_joypad_rumble(unsigned pad,
enum retro_rumble_effect effect, uint16_t strength) enum retro_rumble_effect effect, uint16_t strength)
{ {
int xplayer = pad_index_to_xplayer_index(pad); int xuser = pad_index_to_xuser_index(pad);
if (xplayer == -1) if (xuser == -1)
{ {
if (dinput_joypad.set_rumble) if (dinput_joypad.set_rumble)
return dinput_joypad.set_rumble(pad, effect, strength); 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. */ /* Consider the low frequency (left) motor the "strong" one. */
if (effect == RETRO_RUMBLE_STRONG) 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) 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; == ERROR_SUCCESS;
} }

View File

@ -60,16 +60,16 @@ static int16_t xenon360_input_state(void *data, const struct retro_keybind **bin
{ {
(void)data; (void)data;
(void)idx; (void)idx;
unsigned player = port; unsigned user = port;
uint64_t button = binds[player][id].joykey; uint64_t button = binds[user][id].joykey;
int16_t retval = 0; int16_t retval = 0;
if(player < MAX_PADS) if(user < MAX_PADS)
{ {
switch (device) switch (device)
{ {
case RETRO_DEVICE_JOYPAD: case RETRO_DEVICE_JOYPAD:
retval = (state[player] & button) ? 1 : 0; retval = (state[user] & button) ? 1 : 0;
break; break;
} }
} }