Skip to content

Commit 309f9a8

Browse files
committed
LIBRETRO: add uae4all_joystick opt
1 parent 37d7957 commit 309f9a8

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

libretro/core/core-mapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int pauseg=0; //enter_gui
4444

4545

4646
//JOY
47-
47+
int JOYSTICK_EMULATED=-1;
4848
//MOUSE
4949
int gmx,gmy; //gui mouse
5050
int mouse_wu=0,mouse_wd=0;
@@ -105,7 +105,7 @@ void read_joystick(int nr, unsigned int *dir, int *button)
105105
*dir = 0;
106106
*button = 0;
107107

108-
if ((nr == 0) && (SHOWKEY==1) || (pauseg==1) || (MOUSE_EMULATED==1))
108+
if ((nr == 0) && (SHOWKEY==1) || (pauseg==1) || (MOUSE_EMULATED==1) || !(JOYSTICK_EMULATED))
109109
return;
110110

111111
if ((nr == 1) && (!second_joystick_enable))
@@ -459,7 +459,7 @@ int Retro_PollEvent()
459459
if(SHOWKEY==-1 && pauseg==0)
460460
{
461461
// if emulation running
462-
if(!input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK))
462+
if(!(input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK)) || !(JOYSTICK_EMULATED) && (MOUSE_EMULATED==-1))
463463
Process_keyboard();
464464

465465
if(second_joystick_enable)

libretro/core/libretro-core.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ extern int mainMenu_throttle;
3535
extern int mainMenu_vpos;
3636
extern int mainMenu_frameskip;
3737

38+
extern int JOYSTICK_EMULATED;
39+
3840
extern void DISK_GUI_change (void);
3941

4042
static unsigned msg_interface_version = 0;
@@ -161,6 +163,7 @@ void retro_set_environment(retro_environment_t cb)
161163
{ "uae4all_frameskip", "Frameskip; 0|1|2|3|4|5|auto", },
162164
{ "uae4all_memchip", "Chip RAM; default|512 KB|1 MB|1.5 MB|2 MB", },
163165
{ "uae4all_vpos", "Adjust screen Vertically; default|0|8|16|24|32|40", },
166+
{ "uae4all_joystick", "Joystick emulation; on|off", },
164167
{ NULL, NULL },
165168
};
166169

@@ -307,6 +310,14 @@ void update_prefs_retrocfg(void)
307310
}
308311
}
309312

313+
var.key = "uae4all_joystick";
314+
var.value = NULL;
315+
316+
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
317+
{
318+
if (strcmp(var.value, "on") == 0) JOYSTICK_EMULATED = 1;
319+
if (strcmp(var.value, "off") == 0) JOYSTICK_EMULATED = 0;
320+
}
310321
#if 0
311322

312323
var.key = "uae4all_resolution";

0 commit comments

Comments
 (0)