Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanvb committed May 5, 2024
1 parent 50281aa commit befc952
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
39 changes: 26 additions & 13 deletions input/drivers/test_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,36 +290,43 @@ static int16_t test_input_state(
{
switch (device)
{
/* TODO: something clear here */
case RETRO_DEVICE_JOYPAD:
if (id == RETRO_DEVICE_ID_JOYPAD_MASK)
{
unsigned i;
int16_t ret = 0;

for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
if (!keyboard_mapping_blocked && id < RARCH_BIND_LIST_END)
{
if (binds[port][i].valid)
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
{
if (id < RARCH_BIND_LIST_END)
if (test_key_state[DEFAULT_MAX_PADS]
[binds[port][i].key])
if (binds[port][i].valid)
{
if ( (binds[port][i].key && binds[port][i].key < RETROK_LAST)
&& test_key_state[DEFAULT_MAX_PADS][binds[port][id].key])
ret |= (1 << i);
}
}
}

return ret;
}

if (binds[port][id].valid)
if (id < RARCH_BIND_LIST_END)
{
if (
(id < RARCH_BIND_LIST_END
&& test_key_state[DEFAULT_MAX_PADS]
[binds[port][id].key])
)
return 1;
if (binds[port][id].valid)
{
if ( (binds[port][id].key && binds[port][id].key < RETROK_LAST)
&& test_key_state[DEFAULT_MAX_PADS][binds[port][id].key]
&& (id == RARCH_GAME_FOCUS_TOGGLE || !keyboard_mapping_blocked)
)
return 1;

}
}
break;


case RETRO_DEVICE_KEYBOARD:
if (id && id < RETROK_LAST)
return (test_key_state[DEFAULT_MAX_PADS][id]);
Expand Down Expand Up @@ -364,7 +371,10 @@ static void test_input_poll(void *data)
if( input_test_steps[i].action == INPUT_TEST_COMMAND_PRESS_KEY)
{
if(input_test_steps[i].param_num < RETROK_LAST)
{
test_key_state[DEFAULT_MAX_PADS][input_test_steps[i].param_num] = 1;
input_keyboard_event(true, input_test_steps[i].param_num, 0, 0, RETRO_DEVICE_KEYBOARD);
}
input_test_steps[i].handled = true;
RARCH_DBG(
"[Test input driver]: Pressing keyboard button %d at frame %d\n",
Expand All @@ -373,7 +383,10 @@ static void test_input_poll(void *data)
else if( input_test_steps[i].action == INPUT_TEST_COMMAND_RELEASE_KEY)
{
if(input_test_steps[i].param_num < RETROK_LAST)
{
test_key_state[DEFAULT_MAX_PADS][input_test_steps[i].param_num] = 0;
input_keyboard_event(false, input_test_steps[i].param_num, 0, 0, RETRO_DEVICE_KEYBOARD);
}
input_test_steps[i].handled = true;
RARCH_DBG(
"[Test input driver]: Releasing keyboard button %d at frame %d\n",
Expand Down
3 changes: 2 additions & 1 deletion tests-other/all_binds_empty.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

input_exit_emulator = "escape"
input_max_users = "10"
input_fps_toggle = "f3"

input_ai_service = "nul"
input_ai_service_axis = "nul"
Expand Down Expand Up @@ -62,7 +63,7 @@ input_enable_hotkey_mbtn = "nul"
input_exit_emulator_axis = "nul"
input_exit_emulator_btn = "nul"
input_exit_emulator_mbtn = "nul"
input_fps_toggle = "nul"
# input_fps_toggle = "nul"
input_fps_toggle_axis = "nul"
input_fps_toggle_btn = "nul"
input_fps_toggle_mbtn = "nul"
Expand Down
29 changes: 18 additions & 11 deletions tests-other/test_input_keyboard.ratst
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
[
{
[{
"action": 1,
"param_num": 27,
"param_num": 284,
"frame": 330
},
{
},{
"action": 2,
"param_num": 284
},{
"action": 1,
"param_num": 284
},{
"action": 2,
"param_num": 284
},{
"action": 1,
"param_num": 27
},{
"action": 2,
"param_num": 27
},
{
},{
"action": 1,
"param_num": 27
},
{
},{
"action": 2,
"param_num": 27
}
]
}]

0 comments on commit befc952

Please sign in to comment.