Skip to content

Commit b784d43

Browse files
committed
LIBRETRO: add uae4all_keyboard opt
1 parent 7d36314 commit b784d43

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

libretro/core/core-mapper.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ int JOYSTICK_EMULATED=1;
4949
int gmx,gmy; //gui mouse
5050
int mouse_wu=0,mouse_wd=0;
5151
//KEYBOARD
52+
int KEYBOARD_EMULATED=1;
5253
char Key_State[512];
5354
static char old_Key_State[512];
5455

@@ -400,9 +401,12 @@ void Process_keyboard()
400401
{
401402
int i;
402403

403-
for(i=0;i<320;i++)
404-
Key_State[i]=input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0,i) ? 0x80: 0;
405-
404+
if (KEYBOARD_EMULATED==1)
405+
{
406+
for(i=0;i<320;i++)
407+
Key_State[i]=input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0,i) ? 0x80: 0;
408+
}
409+
406410
if(memcmp( Key_State,old_Key_State , sizeof(Key_State) ) )
407411
for(i=0;i<320;i++)
408412
if(Key_State[i] && Key_State[i]!=old_Key_State[i] )

libretro/core/libretro-core.cpp

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

3838
extern int JOYSTICK_EMULATED;
39+
extern int KEYBOARD_EMULATED;
3940

4041
extern void DISK_GUI_change (void);
4142

@@ -164,6 +165,7 @@ void retro_set_environment(retro_environment_t cb)
164165
{ "uae4all_memchip", "Chip RAM; default|512 KB|1 MB|1.5 MB|2 MB", },
165166
{ "uae4all_vpos", "Adjust screen Vertically; default|0|8|16|24|32|40", },
166167
{ "uae4all_joystick", "Joystick emulation; on|off", },
168+
{ "uae4all_keyboard", "Keyboard emulation; on|off", },
167169
{ NULL, NULL },
168170
};
169171

@@ -318,6 +320,15 @@ void update_prefs_retrocfg(void)
318320
if (strcmp(var.value, "on") == 0) JOYSTICK_EMULATED = 1;
319321
if (strcmp(var.value, "off") == 0) JOYSTICK_EMULATED = -1;
320322
}
323+
324+
var.key = "uae4all_keyboard";
325+
var.value = NULL;
326+
327+
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
328+
{
329+
if (strcmp(var.value, "on") == 0) KEYBOARD_EMULATED = 1;
330+
if (strcmp(var.value, "off") == 0) KEYBOARD_EMULATED = -1;
331+
}
321332
#if 0
322333

323334
var.key = "uae4all_resolution";

0 commit comments

Comments
 (0)