aboutsummaryrefslogtreecommitdiff
path: root/frontend/libretro.c
diff options
context:
space:
mode:
authorphaseIV2015-11-16 14:24:33 +0100
committerphaseIV2015-11-16 14:24:33 +0100
commite8d96071f1a0b34b58647372b9d9976c5e397aba (patch)
treeac0a8e73016ee57d9b492048cb0b7eaf641686d0 /frontend/libretro.c
parentce36c10b348009c13282048540d6d9c553bbcc96 (diff)
downloadpcsx_rearmed-e8d96071f1a0b34b58647372b9d9976c5e397aba.tar.gz
pcsx_rearmed-e8d96071f1a0b34b58647372b9d9976c5e397aba.tar.bz2
pcsx_rearmed-e8d96071f1a0b34b58647372b9d9976c5e397aba.zip
initial neGcon controller support
Diffstat (limited to 'frontend/libretro.c')
-rw-r--r--frontend/libretro.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c
index 2964587..9bada99 100644
--- a/frontend/libretro.c
+++ b/frontend/libretro.c
@@ -329,8 +329,8 @@ void retro_set_environment(retro_environment_t cb)
static const struct retro_variable vars[] = {
{ "pcsx_rearmed_frameskip", "Frameskip; 0|1|2|3" },
{ "pcsx_rearmed_region", "Region; Auto|NTSC|PAL" },
- { "pcsx_rearmed_pad1type", "Pad 1 Type; standard|analog" },
- { "pcsx_rearmed_pad2type", "Pad 2 Type; standard|analog" },
+ { "pcsx_rearmed_pad1type", "Pad 1 Type; standard|analog|negcon" },
+ { "pcsx_rearmed_pad2type", "Pad 2 Type; standard|analog|negcon" },
#ifndef DRC_DISABLE
{ "pcsx_rearmed_drc", "Dynamic recompiler; enabled|disabled" },
#endif
@@ -1067,6 +1067,8 @@ static void update_variables(bool in_flight)
in_type1 = PSE_PAD_TYPE_STANDARD;
if (strcmp(var.value, "analog") == 0)
in_type1 = PSE_PAD_TYPE_ANALOGPAD;
+ if (strcmp(var.value, "negcon") == 0)
+ in_type1 = PSE_PAD_TYPE_NEGCON;
}
var.value = NULL;
@@ -1077,6 +1079,9 @@ static void update_variables(bool in_flight)
in_type2 = PSE_PAD_TYPE_STANDARD;
if (strcmp(var.value, "analog") == 0)
in_type2 = PSE_PAD_TYPE_ANALOGPAD;
+ if (strcmp(var.value, "negcon") == 0)
+ in_type2 = PSE_PAD_TYPE_NEGCON;
+
}
#ifdef __ARM_NEON__
@@ -1232,6 +1237,7 @@ void retro_run(void)
if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, i))
in_keystate |= retro_psx_map[i];
+
if (in_type1 == PSE_PAD_TYPE_ANALOGPAD)
{
in_a1[0] = (input_state_cb(0, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) / 256) + 128;
@@ -1248,6 +1254,36 @@ void retro_run(void)
in_a4[1] = (input_state_cb(1, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) / 256) + 128;
}
+
+ if (in_type1 == PSE_PAD_TYPE_NEGCON)
+ {
+ in_a1[0] = 0;
+
+ if(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, 12)) // left brake
+ 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
+ }
+
+ if (in_type2 == PSE_PAD_TYPE_NEGCON)
+ {
+ in_a3[0] = 0;
+
+ if(input_state_cb(1, RETRO_DEVICE_JOYPAD, 0, 12)) // left brake
+ 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
+ }
+
+
stop = 0;
psxCpu->Execute();