From 5ffba915c4376bac0143d6778ec53578d854d09f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 5 Oct 2014 18:19:36 +0200 Subject: [PATCH] (PS3_ ps3_input_joypad.c - more cleanups --- input/ps3_input_joypad.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/input/ps3_input_joypad.c b/input/ps3_input_joypad.c index b97dd53ded..426d7fd3f1 100644 --- a/input/ps3_input_joypad.c +++ b/input/ps3_input_joypad.c @@ -56,9 +56,7 @@ static bool ps3_joypad_init(void) static bool ps3_joypad_button(unsigned port_num, uint16_t joykey) { - ps3_input_t *ps3 = (ps3_input_t*)driver.input_data; - - if (!ps3 || port_num >= MAX_PADS) + if (port_num >= MAX_PADS) return false; return pad_state[port_num] & (1ULL << joykey); @@ -66,17 +64,12 @@ static bool ps3_joypad_button(unsigned port_num, uint16_t joykey) static int16_t ps3_joypad_axis(unsigned port_num, uint32_t joyaxis) { - ps3_input_t *ps3 = (ps3_input_t*)driver.input_data; + int val = 0. axis = -1; + bool is_neg = false, is_pos = false; - if (!ps3 || joyaxis == AXIS_NONE || port_num >= MAX_PADS) + if (joyaxis == AXIS_NONE || port_num >= MAX_PADS) return 0; - int val = 0; - - int axis = -1; - bool is_neg = false; - bool is_pos = false; - if (AXIS_NEG_GET(joyaxis) < 4) { axis = AXIS_NEG_GET(joyaxis); @@ -120,7 +113,7 @@ static void ps3_joypad_poll(void) for (port = 0; port < MAX_PADS; port++) { - static CellPadData state_tmp; + CellPadData state_tmp; cellPadGetData(port, &state_tmp); if (state_tmp.len != 0) @@ -214,8 +207,7 @@ static void ps3_joypad_poll(void) static bool ps3_joypad_query_pad(unsigned pad) { - ps3_input_t *ps3 = (ps3_input_t*)driver.input_data; - return (ps3 && pad < MAX_PLAYERS && pad_state[pad]); + return pad < MAX_PLAYERS && pad_state[pad]; }