From 048d2f65e000e28aab25067bd64cfe6e6e6602f3 Mon Sep 17 00:00:00 2001 From: TwinAphex51224 Date: Thu, 12 Jan 2012 23:45:48 +0100 Subject: [PATCH] (PS3) Fixed controller 2 --- ps3/ps3_input.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ps3/ps3_input.c b/ps3/ps3_input.c index 0d4863a8fd..6560b07471 100644 --- a/ps3/ps3_input.c +++ b/ps3/ps3_input.c @@ -39,17 +39,27 @@ static int16_t ps3_input_state(void *data, const struct snes_keybind **binds, (void)binds; (void)index; + unsigned pads_connected, player; + uint64_t button; + + player = 0; + pads_connected = cell_pad_input_pads_connected(); + if (device != SNES_DEVICE_JOYPAD) return 0; - unsigned player = 0; - if (port == SNES_PORT_2 && device == SNES_DEVICE_MULTITAP) - player = index + 1; - else if (port == SNES_PORT_2) - player = 1; + if (port == SNES_PORT_2) + { + if(pads_connected < 2) + return 0; + + if(device != SNES_DEVICE_MULTITAP) + player = 1; + else + player = index + 1; + } // Hardcoded binds. - uint64_t button; switch (id) { case SNES_DEVICE_ID_JOYPAD_A: @@ -90,6 +100,7 @@ static int16_t ps3_input_state(void *data, const struct snes_keybind **binds, break; default: button = 0; + break; } return CTRL_MASK(state[player], button) ? 1 : 0;