mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
Added new function input_poll_keyboard_switches to poll for only key events.
Expanded the size of the maximum simultaneously pressed switches. Should fix editableui0120u4red and cheat0118red.
This commit is contained in:
parent
a814dc9ec5
commit
ba9782dcec
@ -964,14 +964,14 @@ static int ReadKeyAsync(int flush)
|
|||||||
|
|
||||||
if(flush) // check key input
|
if(flush) // check key input
|
||||||
{
|
{
|
||||||
while(input_code_poll_switches(TRUE) != INPUT_CODE_INVALID) ;
|
while(input_code_poll_keyboard_switches(TRUE) != INPUT_CODE_INVALID) ;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(1) // check pressed key
|
while(1) // check pressed key
|
||||||
{
|
{
|
||||||
code = input_code_poll_switches(FALSE);
|
code = input_code_poll_keyboard_switches(FALSE);
|
||||||
|
|
||||||
if(code == INPUT_CODE_INVALID)
|
if(code == INPUT_CODE_INVALID)
|
||||||
{
|
{
|
||||||
@ -4470,7 +4470,7 @@ static int EditCheatMenu(CheatEntry * entry, int index, int selection)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int code = input_code_poll_switches(FALSE);
|
int code = input_code_poll_keyboard_switches(FALSE);
|
||||||
|
|
||||||
if(code == KEYCODE_ESC)
|
if(code == KEYCODE_ESC)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#define JOYSTICK_MAP_STICKY 0x0f
|
#define JOYSTICK_MAP_STICKY 0x0f
|
||||||
|
|
||||||
/* the largest number of tracked pressed switches for memory */
|
/* the largest number of tracked pressed switches for memory */
|
||||||
#define MAX_PRESSED_SWITCHES 16
|
#define MAX_PRESSED_SWITCHES 64
|
||||||
|
|
||||||
/* invalid memory value for axis polling */
|
/* invalid memory value for axis polling */
|
||||||
#define INVALID_AXIS_VALUE 0x7fffffff
|
#define INVALID_AXIS_VALUE 0x7fffffff
|
||||||
@ -955,6 +955,44 @@ input_code input_code_poll_switches(int reset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
input_code_poll_keyboard_switches - poll for
|
||||||
|
any keyboard-specific input
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
input_code input_code_poll_keyboard_switches(int reset)
|
||||||
|
{
|
||||||
|
input_device_list *devlist = &device_list[DEVICE_CLASS_KEYBOARD];
|
||||||
|
int devnum;
|
||||||
|
|
||||||
|
/* if resetting memory, do it now */
|
||||||
|
if (reset)
|
||||||
|
code_pressed_memory_reset();
|
||||||
|
|
||||||
|
/* iterate over devices within each class */
|
||||||
|
for (devnum = 0; devnum < devlist->count; devnum++)
|
||||||
|
{
|
||||||
|
input_device *device = &devlist->list[devnum];
|
||||||
|
input_item_id itemid;
|
||||||
|
|
||||||
|
/* iterate over items within each device */
|
||||||
|
for (itemid = ITEM_ID_INVALID + 1; itemid <= device->maxitem; itemid++)
|
||||||
|
{
|
||||||
|
input_device_item *item = device->item[itemid];
|
||||||
|
if (item != NULL && item->itemclass == ITEM_CLASS_SWITCH)
|
||||||
|
{
|
||||||
|
input_code code = device_item_to_code(device, itemid);
|
||||||
|
if (input_code_pressed_once(code))
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if nothing, return an invalid code */
|
||||||
|
return INPUT_CODE_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
input_code_poll_axes - poll for any input
|
input_code_poll_axes - poll for any input
|
||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
@ -535,6 +535,9 @@ INT32 input_code_pressed_once(input_code code);
|
|||||||
/* poll for any switch input, optionally resetting internal memory */
|
/* poll for any switch input, optionally resetting internal memory */
|
||||||
input_code input_code_poll_switches(int reset);
|
input_code input_code_poll_switches(int reset);
|
||||||
|
|
||||||
|
/* poll for any keyboard switch input, optionally resetting internal memory */
|
||||||
|
input_code input_code_poll_keyboard_switches(int reset);
|
||||||
|
|
||||||
/* poll for any axis input, optionally resetting internal memory */
|
/* poll for any axis input, optionally resetting internal memory */
|
||||||
input_code input_code_poll_axes(int reset);
|
input_code input_code_poll_axes(int reset);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user