Skip to content

Commit 7215aa2

Browse files
authored
Add Joy 2B+ support (#103)
1 parent e92e6b2 commit 7215aa2

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

libretro/core-mapper.c

+11
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,17 @@ int Retro_PollEvent()
538538
else if (al[0][0] >= JOYRANGE_RIGHT_VALUE)
539539
MXjoy[1] |= 0x08;
540540
}
541+
else if (atari_joyhack == 3 && !paddle_mode) //hack for supporting Joy 2B+ games
542+
{
543+
//use paddles' potentiometers for fire 2 and fire 3
544+
POKEY_POT_input[0] = (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_A)) ? INPUT_mouse_pot_max : INPUT_mouse_pot_min;
545+
POKEY_POT_input[1] = (joypad_bits[0] & (1 << RETRO_DEVICE_ID_JOYPAD_Y)) ? INPUT_mouse_pot_max : INPUT_mouse_pot_min;
546+
POKEY_POT_input[2] = (joypad_bits[1] & (1 << RETRO_DEVICE_ID_JOYPAD_A)) ? INPUT_mouse_pot_max : INPUT_mouse_pot_min;
547+
POKEY_POT_input[3] = (joypad_bits[1] & (1 << RETRO_DEVICE_ID_JOYPAD_Y)) ? INPUT_mouse_pot_max : INPUT_mouse_pot_min;
548+
//prevent propagation of RETRO_DEVICE_ID_JOYPAD_Y that is interpreted as space key
549+
joypad_bits[0] &= ~(1 << RETRO_DEVICE_ID_JOYPAD_Y);
550+
joypad_bits[1] &= ~(1 << RETRO_DEVICE_ID_JOYPAD_Y);
551+
}
541552

542553
if ( atari_devices[0] != RETRO_DEVICE_ATARI_KEYBOARD)
543554
{

libretro/libretro-core.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int retroh = 300;
4848
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" }, \
4949
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Fire 1" }, \
5050
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Fire 2" }, \
51-
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Space" }, \
51+
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Space/Fire 3" }, \
5252
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Return" }, \
5353
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select" }, \
5454
{ _user, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" }, \
@@ -538,7 +538,7 @@ static void update_variables(void)
538538
autorunCartridge = 0;
539539
}
540540

541-
/* Controller Hack for Dual Stick or Swap Ports*/
541+
/* Controller Hack for Dual Stick, Swap Ports or Joy 2B+*/
542542
var.key = "atari800_opt2";
543543
var.value = NULL;
544544

@@ -549,6 +549,8 @@ static void update_variables(void)
549549
atari_joyhack = 1;
550550
else if ( strcmp(var.value,"Swap Ports") == 0)
551551
atari_joyhack = 2;
552+
else if ( strcmp(var.value,"Joy 2B+") == 0)
553+
atari_joyhack = 3;
552554
else
553555
atari_joyhack = 0;
554556
}

libretro/libretro_core_options.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct retro_core_option_v2_category option_cats_us[] = {
6060
{
6161
"input",
6262
"Input",
63-
"Configure 5200 Digital and Analog Joystick sensitivity and Analog deadzone. Activate Swap or Dual Joysticks. Activate Paddle mode and set Paddle speed. Set retroarch keyboard type."
63+
"Configure 5200 Digital and Analog Joystick sensitivity and Analog deadzone. Activate Swap, Dual Joysticks or Joy 2B+. Activate Paddle mode and set Paddle speed. Set retroarch keyboard type."
6464
},
6565
{ NULL, NULL, NULL },
6666
};
@@ -119,13 +119,14 @@ struct retro_core_option_v2_definition option_defs_us[] = {
119119
"atari800_opt2",
120120
"Controller Hacks",
121121
NULL,
122-
"Apply gamepad input hacks required for specific games. 'Dual Stick' maps Player 2's joystick to the right analog stick of Player 1's RetroPad, enabling dual stick control in 'Robotron 2084' and 'Space Dungeon'. 'Swap Ports' maps Player 1 to port 2 and Player 2 to port 1 of the emulated console, correcting the swapped inputs of 'Wizard of Wor', 'Apple Panic' and a few other games",
122+
"Apply gamepad input hacks required for specific games. 'Dual Stick' maps Player 2's joystick to the right analog stick of Player 1's RetroPad, enabling dual stick control in 'Robotron 2084' and 'Space Dungeon'. 'Swap Ports' maps Player 1 to port 2 and Player 2 to port 1 of the emulated console, correcting the swapped inputs of 'Wizard of Wor', 'Apple Panic' and a few other games. 'Joy 2B+' enables multibutton joysticks support.",
123123
NULL,
124124
"input",
125125
{
126126
{ "none", NULL },
127127
{ "enabled", "Dual Stick" },
128128
{ "Swap Ports", "Swap Ports" },
129+
{ "Joy 2B+", "Joy 2B+" },
129130
{ NULL, NULL },
130131
},
131132
"none"

0 commit comments

Comments
 (0)