mirror of
https://github.com/Pecusx/libretro-atari800.git
synced 2026-05-21 06:39:36 +02:00
add keyboard typecore option (input poll or input callback)
This commit is contained in:
@@ -72,6 +72,8 @@ unsigned char MXjoy[2]; // joy
|
|||||||
|
|
||||||
extern int a5200_joyhack;
|
extern int a5200_joyhack;
|
||||||
|
|
||||||
|
extern int keyboard_type;
|
||||||
|
|
||||||
//MOUSE
|
//MOUSE
|
||||||
extern int pushi; // gui mouse btn
|
extern int pushi; // gui mouse btn
|
||||||
int gmx,gmy; //gui mouse
|
int gmx,gmy; //gui mouse
|
||||||
@@ -372,6 +374,8 @@ void Process_key()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if(keyboard_type==1)return;
|
||||||
|
|
||||||
for(i=0;i<320;i++)
|
for(i=0;i<320;i++)
|
||||||
Key_Sate[i]=input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0,i) ? 0x80: 0;
|
Key_Sate[i]=input_state_cb(0, RETRO_DEVICE_KEYBOARD, 0,i) ? 0x80: 0;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ int retroh=300;
|
|||||||
|
|
||||||
unsigned atari_devices[ 2 ];
|
unsigned atari_devices[ 2 ];
|
||||||
|
|
||||||
|
int keyboard_type=0;
|
||||||
int autorun5200=0;
|
int autorun5200=0;
|
||||||
int a5200_joyhack=0;
|
int a5200_joyhack=0;
|
||||||
|
|
||||||
@@ -118,7 +119,10 @@ void retro_set_environment(retro_environment_t cb)
|
|||||||
"atari800_resolution",
|
"atari800_resolution",
|
||||||
"Internal resolution; 336x240|320x240|384x240|384x272|384x288|400x300",
|
"Internal resolution; 336x240|320x240|384x240|384x272|384x288|400x300",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"atari800_keyboard",
|
||||||
|
"Retroarch Keyboard type; poll|callback",
|
||||||
|
},
|
||||||
|
|
||||||
{ NULL, NULL },
|
{ NULL, NULL },
|
||||||
};
|
};
|
||||||
@@ -328,6 +332,20 @@ static void update_variables(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var.key = "atari800_keyboard";
|
||||||
|
var.value = NULL;
|
||||||
|
|
||||||
|
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||||
|
{
|
||||||
|
if (strcmp(var.value, "poll") == 0)
|
||||||
|
{
|
||||||
|
keyboard_type=0;
|
||||||
|
}
|
||||||
|
else if (strcmp(var.value, "callback") == 0)
|
||||||
|
{
|
||||||
|
keyboard_type=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void retro_wrap_emulator()
|
static void retro_wrap_emulator()
|
||||||
@@ -622,11 +640,14 @@ void retro_run(void)
|
|||||||
|
|
||||||
co_switch(emuThread);
|
co_switch(emuThread);
|
||||||
}
|
}
|
||||||
|
extern char Key_Sate[512];
|
||||||
unsigned int lastdown,lastup,lastchar;
|
unsigned int lastdown,lastup,lastchar;
|
||||||
static void keyboard_cb(bool down, unsigned keycode,
|
static void keyboard_cb(bool down, unsigned keycode,
|
||||||
uint32_t character, uint16_t mod)
|
uint32_t character, uint16_t mod)
|
||||||
{
|
{
|
||||||
|
if(keyboard_type==0)return;
|
||||||
|
Key_Sate[keycode]= down ? 1 : 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
printf( "Down: %s, Code: %d, Char: %u, Mod: %u.\n",
|
printf( "Down: %s, Code: %d, Char: %u, Mod: %u.\n",
|
||||||
down ? "yes" : "no", keycode, character, mod);
|
down ? "yes" : "no", keycode, character, mod);
|
||||||
|
|||||||
Reference in New Issue
Block a user