From: phaseIV Date: Tue, 17 Nov 2015 09:27:27 +0000 (+0100) Subject: fix for buttons I and II values X-Git-Tag: r24l~864^2~2 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1c2fa8ffcf66a37aa7e5bf2704689018c2fb533;p=pcsx_rearmed.git fix for buttons I and II values --- diff --git a/frontend/libretro.c b/frontend/libretro.c index 9bada99b..e73135b5 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1257,30 +1257,54 @@ void retro_run(void) if (in_type1 == PSE_PAD_TYPE_NEGCON) { - in_a1[0] = 0; - - if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 12)) // left brake + /* left brake */ + if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 12)) in_a1[1] = 255; else in_a1[1] = 0; - - in_a2[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; //steer - in_a2[1] = 255 - ((input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128); //thrust + /* steer */ + in_a2[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; + + /* thrust and fire */ + val = ((input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 127)); + if(val < -2) { + in_a1[0] = 256 - val; + } + if (val > 2) { + in_a2[1] = val; + } + if(val >= -2 && val <= 2) + { + in_a2[1] = 0; + in_a1[0] = 0; + } } if (in_type2 == PSE_PAD_TYPE_NEGCON) { - in_a3[0] = 0; - - if(input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, 12)) // left brake + /* left brake */ + if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 12)) in_a3[1] = 255; else in_a3[1] = 0; - - in_a4[0] = (input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; //steer - in_a4[1] = 255 - ((input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128); //thrust + /* steer */ + in_a4[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; + + /* thrust and fire */ + val = ((input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 127)); + if(val < -2) { + in_a3[0] = 256 - val; + } + if (val > 2) { + in_a4[1] = val; + } + if(val >= -2 && val <= 2) + { + in_a4[1] = 0; + in_a3[0] = 0; + } }