diff options
author | Twinaphex | 2015-04-22 22:31:01 +0200 |
---|---|---|
committer | Twinaphex | 2015-04-22 22:31:01 +0200 |
commit | 6d552c5fd9cd5115748aaf0b704aba264eab257b (patch) | |
tree | c48f081b5b5395f6387f5c9b010ae4c50df3508f /frontend | |
parent | 998ff8f6009ca7a4d8db9039baf239a1931b5e63 (diff) | |
parent | 554cc9eb7ebe48f574a6259f933d97a6862c2d72 (diff) | |
download | pcsx_rearmed-6d552c5fd9cd5115748aaf0b704aba264eab257b.tar.gz pcsx_rearmed-6d552c5fd9cd5115748aaf0b704aba264eab257b.tar.bz2 pcsx_rearmed-6d552c5fd9cd5115748aaf0b704aba264eab257b.zip |
Merge pull request #17 from jvanderneutstulen/fix-pad2-analog-input
Poll analog inputs of pad2 when it's an analog pad.
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/libretro.c | 9 | ||||
-rw-r--r-- | frontend/plugin.c | 6 | ||||
-rw-r--r-- | frontend/plugin_lib.h | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c index acc64a1..3fd5b0a 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -51,6 +51,7 @@ extern char McdDisable[2]; /* PCSX ReARMed core calls and stuff */ int in_type1, in_type2; int in_a1[2] = { 127, 127 }, in_a2[2] = { 127, 127 }; +int in_a3[2] = { 127, 127 }, in_a4[2] = { 127, 127 }; int in_keystate; int in_enable_vibration = 1; @@ -1125,6 +1126,14 @@ void retro_run(void) in_a2[1] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; } + if (in_type2 == PSE_PAD_TYPE_ANALOGPAD) + { + in_a3[0] = (input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; + in_a3[1] = (input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; + in_a4[0] = (input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128; + in_a4[1] = (input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128; + } + stop = 0; psxCpu->Execute(); diff --git a/frontend/plugin.c b/frontend/plugin.c index d9eb04a..49ae1fe 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -66,6 +66,12 @@ static long PADreadPort2(PadDataS *pad) { pad->controllerType = in_type2; pad->buttonStatus = ~in_keystate >> 16; + if (in_type2 == PSE_PAD_TYPE_ANALOGPAD) { + pad->leftJoyX = in_a3[0]; + pad->leftJoyY = in_a3[1]; + pad->rightJoyX = in_a4[0]; + pad->rightJoyY = in_a4[1]; + } return 0; } diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index 4a11002..00547fc 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -18,7 +18,7 @@ enum { DKEY_SQUARE, }; extern int in_type1, in_type2; -extern int in_keystate, in_state_gun, in_a1[2], in_a2[2]; +extern int in_keystate, in_state_gun, in_a1[2], in_a2[2], in_a3[2], in_a4[2]; extern int in_adev[2], in_adev_axis[2][2]; extern int in_adev_is_nublike[2]; extern int in_enable_vibration; |