From 72ca37f9d6d875b87dd2ab41dac0b24e937b8e7c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 17 Oct 2014 05:58:28 +0200 Subject: [PATCH] Revert "Update parport_joypad.c driver - mrob - confirm if things still" This reverts commit 04b6287d77065acc216f0f1067e9f9a26e6f9fb3. --- input/parport_joypad.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/input/parport_joypad.c b/input/parport_joypad.c index eea2429f62..80fc368416 100644 --- a/input/parport_joypad.c +++ b/input/parport_joypad.c @@ -33,7 +33,7 @@ struct parport_joypad { int fd; - uint32_t buttons; + bool buttons[NUM_BUTTONS]; bool button_enable[NUM_BUTTONS]; char saved_data; char saved_control; @@ -87,23 +87,13 @@ static void poll_pad(struct parport_joypad *pad) for (i = 0; i < 8; i++) { - if (!(data & UINT8_C(1 << i)) && pad->button_enable[i]) - BIT32_SET(pad->buttons, i); - else - BIT32_CLEAR(pad->buttons, i); + pad->buttons[i] = !(data & UINT8_C(1 << i)) && pad->button_enable[i]; } for (i = 3; i < 8; i++) { - if (!(status & UINT8_C(1 << i)) && pad->button_enable[i + 5]) - BIT32_SET(pad->buttons, i + 5); - else - BIT32_CLEAR(pad->buttons, i + 5); + pad->buttons[i + 5] = !(status & UINT8_C(1 << i)) && pad->button_enable[i + 5]; } - - if (pad->buttons[12] && pad->button_enable[12]) - BIT32_SET(pad->buttons, 12); - else - BIT32_CLEAR(pad->buttons, 12); + pad->buttons[12] = pad->buttons[12] ? false : true && pad->button_enable[12]; } static bool parport_joypad_init_pad(const char *path, struct parport_joypad *pad) @@ -259,7 +249,7 @@ static bool parport_joypad_init(void) for (j = 0; j < NUM_BUTTONS; j++) { - if (!(BIT32_GET(pad->buttons, j))) + if (!pad->buttons[j]) { pad->button_enable[j] = true; found_enabled_button = true; @@ -325,7 +315,7 @@ static bool parport_joypad_button(unsigned port, uint16_t joykey) { const struct parport_joypad *pad = &g_pads[port]; - return joykey < NUM_BUTTONS && BIT32_GET(pad->buttons, joykey); + return joykey < NUM_BUTTONS && pad->buttons[joykey]; } static int16_t parport_joypad_axis(unsigned port, uint32_t joyaxis)