From 0bf43eba813e696a7b613bd80e7948367d1bf825 Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Fri, 12 Apr 2024 18:22:30 +0200 Subject: [PATCH 1/6] Test input driver, wireframe --- Makefile.common | 1 + configuration.c | 1 + configuration.h | 1 + griffin/griffin.c | 1 + input/drivers/test_input.c | 368 +++++++++++++++++++++++++++++ input/drivers_joypad/test_joypad.c | 26 +- input/input_driver.c | 3 + input/input_driver.h | 1 + input/input_keymaps.c | 16 ++ input/input_keymaps.h | 1 + 10 files changed, 406 insertions(+), 13 deletions(-) create mode 100644 input/drivers/test_input.c diff --git a/Makefile.common b/Makefile.common index ba4135de054a..b18a204dda03 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2434,6 +2434,7 @@ endif ifeq ($(HAVE_TEST_DRIVERS), 1) DEFINES += -DHAVE_TEST_DRIVERS OBJ += input/drivers_joypad/test_joypad.o + OBJ += input/drivers/test_input.o endif diff --git a/configuration.c b/configuration.c index c3613d87023b..52a8c46bb457 100644 --- a/configuration.c +++ b/configuration.c @@ -1647,6 +1647,7 @@ static struct config_path_setting *populate_settings_path( #ifdef HAVE_TEST_DRIVERS SETTING_PATH("test_input_file_joypad", settings->paths.test_input_file_joypad, false, NULL, true); + SETTING_PATH("test_input_file_general", settings->paths.test_input_file_joypad, false, NULL, true); #endif SETTING_ARRAY("log_dir", settings->paths.log_dir, true, NULL, true); diff --git a/configuration.h b/configuration.h index 01285d01c33a..ac58aa3a33b5 100644 --- a/configuration.h +++ b/configuration.h @@ -577,6 +577,7 @@ typedef struct settings #endif #ifdef HAVE_TEST_DRIVERS char test_input_file_joypad[PATH_MAX_LENGTH]; + char test_input_file_general[PATH_MAX_LENGTH]; #endif char log_dir[PATH_MAX_LENGTH]; char app_icon[PATH_MAX_LENGTH]; diff --git a/griffin/griffin.c b/griffin/griffin.c index e1bb908f5888..d1986ea63801 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -733,6 +733,7 @@ INPUT #ifdef HAVE_TEST_DRIVERS #include "../input/drivers_joypad/test_joypad.c" +#include "../input/drivers/test_input.c" #endif /*============================================================ diff --git a/input/drivers/test_input.c b/input/drivers/test_input.c new file mode 100644 index 000000000000..eac8f247d324 --- /dev/null +++ b/input/drivers/test_input.c @@ -0,0 +1,368 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2017 - Daniel De Matteis + * Copyright (C) 2016-2019 - Brad Parker + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include "../input_driver.h" +#include "../input_keymaps.h" +#include "../../verbosity.h" + +#define MAX_TEST_STEPS 200 + +#define INPUT_TEST_COMMAND_PRESS_KEY 1 +#define INPUT_TEST_COMMAND_RELEASE_KEY 1 + +/* TODO/FIXME - static globals */ +static uint16_t test_key_state[DEFAULT_MAX_PADS+1][RETROK_LAST]; + + +typedef struct +{ + unsigned frame; + unsigned action; + unsigned param_num; + char param_str[255]; + bool handled; +} input_test_step_t; + +static input_test_step_t input_test_steps[MAX_TEST_STEPS]; + +static unsigned current_frame = 0; +static unsigned next_teststep_frame = 0; +static unsigned current_test_step = 0; +static unsigned last_test_step = MAX_TEST_STEPS + 1; +static uint32_t input_state_validated = 0; +static uint32_t combo_state_validated = 0; +static bool dump_state_blocked = false; + +/************************************/ +/* JSON Helpers for test input file */ +/************************************/ + +typedef struct +{ + unsigned *current_entry_uint_val; + char **current_entry_str_val; + unsigned frame; + unsigned action; + unsigned param_num; + char *param_str; +} KTifJSONContext; + +static bool KTifJSONObjectEndHandler(void* context) +{ + KTifJSONContext *pCtx = (KTifJSONContext*)context; + + /* Too long input is handled elsewhere, it should not lead to parse error */ + if (current_test_step >= MAX_TEST_STEPS) + return true; + + /* Copy values read from JSON file + fill defaults */ + if (pCtx->frame == 0xffff) + input_test_steps[current_test_step].frame = input_test_steps[current_test_step-1].frame + 60; + else + input_test_steps[current_test_step].frame = pCtx->frame; + + input_test_steps[current_test_step].action = pCtx->action; + input_test_steps[current_test_step].param_num = pCtx->param_num; + input_test_steps[current_test_step].handled = false; + + if (!string_is_empty(pCtx->param_str)) + strlcpy( + input_test_steps[current_test_step].param_str, pCtx->param_str, + sizeof(input_test_steps[current_test_step].param_str)); + else + input_test_steps[current_test_step].param_str[0] = '\0'; + + current_test_step++; + last_test_step = current_test_step; + pCtx->frame = 0xffff; + return true; +} + +static bool KTifJSONObjectMemberHandler(void* context, const char *pValue, size_t length) +{ + KTifJSONContext *pCtx = (KTifJSONContext*)context; + + /* something went wrong */ + if (pCtx->current_entry_str_val) + return false; + + if (length) + { + if (string_is_equal(pValue, "frame")) + pCtx->current_entry_uint_val = &pCtx->frame; + else if (string_is_equal(pValue, "action")) + pCtx->current_entry_uint_val = &pCtx->action; + else if (string_is_equal(pValue, "param_num")) + pCtx->current_entry_uint_val = &pCtx->param_num; + else if (string_is_equal(pValue, "param_str")) + pCtx->current_entry_str_val = &pCtx->param_str; + /* ignore unknown members */ + } + + return true; +} + +static bool KTifJSONNumberHandler(void* context, const char *pValue, size_t length) +{ + KTifJSONContext *pCtx = (KTifJSONContext*)context; + + if (pCtx->current_entry_uint_val && length && !string_is_empty(pValue)) + *pCtx->current_entry_uint_val = string_to_unsigned(pValue); + /* ignore unknown members */ + + pCtx->current_entry_uint_val = NULL; + + return true; +} + +static bool KTifJSONStringHandler(void* context, const char *pValue, size_t length) +{ + KTifJSONContext *pCtx = (KTifJSONContext*)context; + + if (pCtx->current_entry_str_val && length && !string_is_empty(pValue)) + { + if (*pCtx->current_entry_str_val) + free(*pCtx->current_entry_str_val); + + *pCtx->current_entry_str_val = strdup(pValue); + } + /* ignore unknown members */ + + pCtx->current_entry_str_val = NULL; + + return true; +} + +/* Parses test input file referenced by file_path. + * Does nothing if test input file does not exist. */ +static bool input_test_file_read(const char* file_path) +{ + bool success = false; + KTifJSONContext context = {0}; + RFILE *file = NULL; + rjson_t* parser; + + /* Sanity check */ + if ( string_is_empty(file_path) + || !path_is_valid(file_path) + ) + { + RARCH_DBG("[Test input driver]: No test input file supplied.\n"); + return false; + } + + /* Attempt to open test input file */ + file = filestream_open( + file_path, + RETRO_VFS_FILE_ACCESS_READ, + RETRO_VFS_FILE_ACCESS_HINT_NONE); + + if (!file) + { + RARCH_ERR("[Test input driver]: Failed to open test input file: \"%s\".\n", + file_path); + return false; + } + + /* Initialise JSON parser */ + if (!(parser = rjson_open_rfile(file))) + { + RARCH_ERR("[Test input driver]: Failed to create JSON parser.\n"); + goto end; + } + + /* Configure parser */ + rjson_set_options(parser, RJSON_OPTION_ALLOW_UTF8BOM); + + /* Read file */ + if (rjson_parse(parser, &context, + KTifJSONObjectMemberHandler, + KTifJSONStringHandler, + KTifJSONNumberHandler, + NULL, KTifJSONObjectEndHandler, NULL, NULL, /* object/array handlers */ + NULL, NULL) /* unused boolean/null handlers */ + != RJSON_DONE) + { + if (rjson_get_source_context_len(parser)) + { + RARCH_ERR( + "[Test input driver]: Error parsing chunk of test input file: %s\n---snip---\n%.*s\n---snip---\n", + file_path, + rjson_get_source_context_len(parser), + rjson_get_source_context_buf(parser)); + } + RARCH_WARN( + "[Test input driver]: Error parsing test input file: %s\n", + file_path); + RARCH_ERR( + "[Test input driver]: Error: Invalid JSON at line %d, column %d - %s.\n", + (int)rjson_get_source_line(parser), + (int)rjson_get_source_column(parser), + (*rjson_get_error(parser) ? rjson_get_error(parser) : "format error")); + } + + /* Free parser */ + rjson_free(parser); + + success = true; +end: + /* Clean up leftover strings */ + if (context.param_str) + free(context.param_str); + + /* Close log file */ + filestream_close(file); + + if (last_test_step >= MAX_TEST_STEPS) + { + RARCH_WARN("[Test input driver]: too long test input json, maximum size: %d\n",MAX_TEST_STEPS); + } + for (current_test_step = 0; current_test_step < last_test_step; current_test_step++) + { + RARCH_DBG( + "[Test input driver]: test step %02d read from file: frame %d, action %x, num %x, str %s\n", + current_test_step, + input_test_steps[current_test_step].frame, + input_test_steps[current_test_step].action, + input_test_steps[current_test_step].param_num, + input_test_steps[current_test_step].param_str); + } + current_test_step = 0; + return success; +} + +/********************************/ +/* Test input file handling end */ +/********************************/ + + +uint16_t *test_keyboard_state_get(unsigned port) +{ + return test_key_state[port]; +} + +static void test_keyboard_free(void) +{ + unsigned i, j; + + for (i = 0; i < DEFAULT_MAX_PADS; i++) + for (j = 0; j < RETROK_LAST; j++) + test_key_state[i][j] = 0; +} + +static int16_t test_input_state( + void *data, + const input_device_driver_t *joypad, + const input_device_driver_t *sec_joypad, + rarch_joypad_info_t *joypad_info, + const retro_keybind_set *binds, + bool keyboard_mapping_blocked, + unsigned port, + unsigned device, + unsigned idx, + unsigned id) +{ + if (port <= 0) + { + switch (device) + { + 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 (binds[port][i].valid) + { + if (id < RARCH_BIND_LIST_END) + if (test_key_state[DEFAULT_MAX_PADS] + [rarch_keysym_lut[binds[port][i].key]]) + ret |= (1 << i); + } + } + + return ret; + } + + if (binds[port][id].valid) + { + if ( + (id < RARCH_BIND_LIST_END + && test_key_state[DEFAULT_MAX_PADS] + [rarch_keysym_lut[binds[port][id].key]]) + ) + return 1; + } + break; + case RETRO_DEVICE_KEYBOARD: + if (id < RARCH_BIND_LIST_END) + return (test_key_state[DEFAULT_MAX_PADS] + [rarch_keysym_lut[binds[port][id].key]]); + break; + } + } + + return 0; +} + +static void test_input_free_input(void *data) +{ + test_keyboard_free(); +} + +static void* test_input_init(const char *joypad_driver) +{ + settings_t *settings = config_get_ptr(); + unsigned i; + + input_test_file_read(settings->paths.test_input_file_general); + if (last_test_step > MAX_TEST_STEPS) + last_test_step = 0; + + input_keymaps_init_keyboard_lut(rarch_key_map_test); + return (void*)-1; +} + +static uint64_t test_input_get_capabilities(void *data) +{ + return UINT64_C(1) << RETRO_DEVICE_JOYPAD; +} + +input_driver_t input_test = { + test_input_init, + NULL, /* poll */ + test_input_state, + test_input_free_input, + NULL, + NULL, + test_input_get_capabilities, + "test", + NULL, /* grab_mouse */ + NULL, + NULL +}; diff --git a/input/drivers_joypad/test_joypad.c b/input/drivers_joypad/test_joypad.c index 2c3433b53817..f966eee5fda3 100644 --- a/input/drivers_joypad/test_joypad.c +++ b/input/drivers_joypad/test_joypad.c @@ -193,7 +193,7 @@ static bool input_test_file_read(const char* file_path) || !path_is_valid(file_path) ) { - RARCH_DBG("[Test input driver]: No test input file supplied.\n"); + RARCH_DBG("[Test joypad driver]: No test input file supplied.\n"); return false; } @@ -205,7 +205,7 @@ static bool input_test_file_read(const char* file_path) if (!file) { - RARCH_ERR("[Test input driver]: Failed to open test input file: \"%s\".\n", + RARCH_ERR("[Test joypad driver]: Failed to open test input file: \"%s\".\n", file_path); return false; } @@ -213,7 +213,7 @@ static bool input_test_file_read(const char* file_path) /* Initialise JSON parser */ if (!(parser = rjson_open_rfile(file))) { - RARCH_ERR("[Test input driver]: Failed to create JSON parser.\n"); + RARCH_ERR("[Test joypad driver]: Failed to create JSON parser.\n"); goto end; } @@ -232,16 +232,16 @@ static bool input_test_file_read(const char* file_path) if (rjson_get_source_context_len(parser)) { RARCH_ERR( - "[Test input driver]: Error parsing chunk of test input file: %s\n---snip---\n%.*s\n---snip---\n", + "[Test joypad driver]: Error parsing chunk of test input file: %s\n---snip---\n%.*s\n---snip---\n", file_path, rjson_get_source_context_len(parser), rjson_get_source_context_buf(parser)); } RARCH_WARN( - "[Test input driver]: Error parsing test input file: %s\n", + "[Test joypad driver]: Error parsing test input file: %s\n", file_path); RARCH_ERR( - "[Test input driver]: Error: Invalid JSON at line %d, column %d - %s.\n", + "[Test joypad driver]: Error: Invalid JSON at line %d, column %d - %s.\n", (int)rjson_get_source_line(parser), (int)rjson_get_source_column(parser), (*rjson_get_error(parser) ? rjson_get_error(parser) : "format error")); @@ -261,12 +261,12 @@ static bool input_test_file_read(const char* file_path) if (last_test_step >= MAX_TEST_STEPS) { - RARCH_WARN("[Test input driver]: too long test input json, maximum size: %d\n",MAX_TEST_STEPS); + RARCH_WARN("[Test joypad driver]: too long test input json, maximum size: %d\n",MAX_TEST_STEPS); } for (current_test_step = 0; current_test_step < last_test_step; current_test_step++) { RARCH_DBG( - "[Test input driver]: test step %02d read from file: frame %d, action %x, num %x, str %s\n", + "[Test joypad driver]: test step %02d read from file: frame %d, action %x, num %x, str %s\n", current_test_step, input_test_steps[current_test_step].frame, input_test_steps[current_test_step].action, @@ -412,7 +412,7 @@ static void test_joypad_poll(void) test_joypads[targetpad].button_state |= input_test_steps[i].param_num; input_test_steps[i].handled = true; RARCH_DBG( - "[Test input driver]: Pressing device %d buttons %x, new state %x.\n", + "[Test joypad driver]: Pressing device %d buttons %x, new state %x.\n", targetpad,input_test_steps[i].param_num,test_joypads[targetpad].button_state); } else if( input_test_steps[i].action >= JOYPAD_TEST_COMMAND_BUTTON_RELEASE_FIRST && @@ -422,7 +422,7 @@ static void test_joypad_poll(void) test_joypads[targetpad].button_state &= ~input_test_steps[i].param_num; input_test_steps[i].handled = true; RARCH_DBG( - "[Test input driver]: Releasing device %d buttons %x, new state %x.\n", + "[Test joypad driver]: Releasing device %d buttons %x, new state %x.\n", targetpad,input_test_steps[i].param_num,test_joypads[targetpad].button_state); } else if( input_test_steps[i].action >= JOYPAD_TEST_COMMAND_BUTTON_AXIS_FIRST && @@ -436,19 +436,19 @@ static void test_joypad_poll(void) test_joypads[targetpad].axis_state[targetaxis] = (int16_t) input_test_steps[i].param_num; else RARCH_WARN( - "[Test input driver]: Decoded axis outside target range: action %d pad %d axis %d.\n", + "[Test joypad driver]: Decoded axis outside target range: action %d pad %d axis %d.\n", input_test_steps[i].action, targetpad, targetaxis); input_test_steps[i].handled = true; RARCH_DBG( - "[Test input driver]: Setting axis device %d axis %d value %d.\n", + "[Test joypad driver]: Setting axis device %d axis %d value %d.\n", targetpad, targetaxis, (int16_t)input_test_steps[i].param_num); } else { input_test_steps[i].handled = true; RARCH_WARN( - "[Test input driver]: Unrecognized action %d in step %d, skipping\n", + "[Test joypad driver]: Unrecognized action %d in step %d, skipping\n", input_test_steps[i].action,i); } diff --git a/input/input_driver.c b/input/input_driver.c index dc524d3037ea..abac0f6b219f 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -363,6 +363,9 @@ input_driver_t *input_drivers[] = { #endif #ifdef DJGPP &input_dos, +#endif +#ifdef HAVE_TEST_DRIVERS + &input_test, #endif &input_null, NULL, diff --git a/input/input_driver.h b/input/input_driver.h index 99f5abf9bc17..d3a724c71f3b 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -1090,6 +1090,7 @@ extern input_driver_t input_rwebinput; extern input_driver_t input_dos; extern input_driver_t input_winraw; extern input_driver_t input_wayland; +extern input_driver_t input_test; extern input_device_driver_t dinput_joypad; extern input_device_driver_t linuxraw_joypad; diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 758de553c62e..63df1ccea0d0 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -1961,6 +1961,22 @@ const struct rarch_key_map rarch_key_map_winraw[] = { * so they can't be placed in a C source file */ #endif +#ifdef HAVE_TEST_DRIVERS +const struct rarch_key_map rarch_key_map_test[] = { + { RETROK_ESCAPE, RETROK_ESCAPE }, + { RETROK_F1, RETROK_F1 }, + { RETROK_F2, RETROK_F2 }, + { RETROK_F3, RETROK_F3 }, + { RETROK_F4, RETROK_F4 }, + { RETROK_F5, RETROK_F5 }, + { RETROK_F6, RETROK_F6 }, + { RETROK_F7, RETROK_F7 }, + { RETROK_F8, RETROK_F8 }, + { RETROK_F9, RETROK_F9 }, + { RETROK_F10, RETROK_F10 } +}; +#endif // HAVE_TEST_DRIVERS + /* TODO/FIXME - global */ enum retro_key rarch_keysym_lut[RETROK_LAST]; diff --git a/input/input_keymaps.h b/input/input_keymaps.h index 2ffee2b67ffc..661ee4582883 100644 --- a/input/input_keymaps.h +++ b/input/input_keymaps.h @@ -257,6 +257,7 @@ extern const struct rarch_key_map rarch_key_map_apple_hid[]; extern const struct rarch_key_map rarch_key_map_android[]; extern const struct rarch_key_map rarch_key_map_qnx[]; extern const struct rarch_key_map rarch_key_map_dos[]; +extern const struct rarch_key_map rarch_key_map_test[]; extern const struct rarch_key_map rarch_key_map_wiiu[]; extern const struct rarch_key_map rarch_key_map_winraw[]; #ifdef HAVE_LIBNX From 1bcfdfc978645fe92a9c8c8cb85ac81200b63564 Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Sat, 13 Apr 2024 11:57:41 +0200 Subject: [PATCH 2/6] Updates to first working version. --- configuration.c | 4 +- input/drivers/test_input.c | 54 ++++++++++++++++++++++++--- input/input_driver.c | 18 +++++++-- tests-other/test_input_keyboard.ratst | 19 ++++++++++ 4 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 tests-other/test_input_keyboard.ratst diff --git a/configuration.c b/configuration.c index 52a8c46bb457..94eb3124846a 100644 --- a/configuration.c +++ b/configuration.c @@ -1646,8 +1646,8 @@ static struct config_path_setting *populate_settings_path( #endif #ifdef HAVE_TEST_DRIVERS - SETTING_PATH("test_input_file_joypad", settings->paths.test_input_file_joypad, false, NULL, true); - SETTING_PATH("test_input_file_general", settings->paths.test_input_file_joypad, false, NULL, true); + SETTING_PATH("test_input_file_joypad", settings->paths.test_input_file_joypad, false, NULL, true); + SETTING_PATH("test_input_file_general", settings->paths.test_input_file_general, false, NULL, true); #endif SETTING_ARRAY("log_dir", settings->paths.log_dir, true, NULL, true); diff --git a/input/drivers/test_input.c b/input/drivers/test_input.c index eac8f247d324..7809547d4f1f 100644 --- a/input/drivers/test_input.c +++ b/input/drivers/test_input.c @@ -27,11 +27,12 @@ #include "../input_driver.h" #include "../input_keymaps.h" #include "../../verbosity.h" +#include "../../gfx/video_driver.h" #define MAX_TEST_STEPS 200 #define INPUT_TEST_COMMAND_PRESS_KEY 1 -#define INPUT_TEST_COMMAND_RELEASE_KEY 1 +#define INPUT_TEST_COMMAND_RELEASE_KEY 2 /* TODO/FIXME - static globals */ static uint16_t test_key_state[DEFAULT_MAX_PADS+1][RETROK_LAST]; @@ -259,10 +260,10 @@ static bool input_test_file_read(const char* file_path) /********************************/ -uint16_t *test_keyboard_state_get(unsigned port) +/*uint16_t *test_keyboard_state_get(unsigned port) { return test_key_state[port]; -} +}*/ static void test_keyboard_free(void) { @@ -339,7 +340,9 @@ static void* test_input_init(const char *joypad_driver) { settings_t *settings = config_get_ptr(); unsigned i; - + + RARCH_DBG("[Test input driver]: start\n"); + input_test_file_read(settings->paths.test_input_file_general); if (last_test_step > MAX_TEST_STEPS) last_test_step = 0; @@ -348,6 +351,47 @@ static void* test_input_init(const char *joypad_driver) return (void*)-1; } +static void test_input_poll(void *data) +{ + video_driver_state_t *video_st = video_state_get_ptr(); + uint64_t curr_frame = video_st->frame_count; + unsigned i; + + for (i=0; i input_test_steps[i].frame) + { + 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_test_steps[i].handled = true; + RARCH_DBG( + "[Test input driver]: Pressing keyboard button %d\n", + input_test_steps[i].param_num); + } + 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_test_steps[i].handled = true; + RARCH_DBG( + "[Test input driver]: Releasing keyboard button %d\n", + input_test_steps[i].param_num); + } + else + { + input_test_steps[i].handled = true; + RARCH_WARN( + "[Test joypad driver]: Unrecognized action %d in step %d, skipping\n", + input_test_steps[i].action,i); + } + + } + } +} + + static uint64_t test_input_get_capabilities(void *data) { return UINT64_C(1) << RETRO_DEVICE_JOYPAD; @@ -355,7 +399,7 @@ static uint64_t test_input_get_capabilities(void *data) input_driver_t input_test = { test_input_init, - NULL, /* poll */ + test_input_poll, test_input_state, test_input_free_input, NULL, diff --git a/input/input_driver.c b/input/input_driver.c index abac0f6b219f..371629809f7c 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -4423,11 +4423,21 @@ bool video_driver_init_input( void *new_data = NULL; input_driver_t **input = &input_driver_st.current_driver; if (*input) +#if HAVE_TEST_DRIVERS + if (strcmp(settings->arrays.input_driver,"test") != 0 || + string_is_empty(settings->paths.test_input_file_general)) + /* Video driver did provide an input driver, + * and test driver is not in use or has no input file. */ + return true; + else + RARCH_LOG("[Video]: Graphics driver initialized an input driver, but ignoring it as test input driver is in use.\n"); +#else return true; - - /* Video driver didn't provide an input driver, - * so we use configured one. */ - RARCH_LOG("[Video]: Graphics driver did not initialize an input driver." +#endif + else + /* Video driver didn't provide an input driver, + * so we use configured one. */ + RARCH_LOG("[Video]: Graphics driver did not initialize an input driver." " Attempting to pick a suitable driver.\n"); if (tmp) diff --git a/tests-other/test_input_keyboard.ratst b/tests-other/test_input_keyboard.ratst new file mode 100644 index 000000000000..d9c383edf8de --- /dev/null +++ b/tests-other/test_input_keyboard.ratst @@ -0,0 +1,19 @@ +[ +{ + "action": 1, + "param_num": 27, + "frame": 330 +}, +{ + "action": 2, + "param_num": 27 +}, +{ + "action": 1, + "param_num": 27 +}, +{ + "action": 2, + "param_num": 27 +} +] \ No newline at end of file From 0c67c49f8f02b3dad486b41f4bf9fafd77d3f71b Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Sat, 13 Apr 2024 13:11:38 +0200 Subject: [PATCH 3/6] update keymap --- input/drivers/test_input.c | 8 +- input/input_keymaps.c | 154 ++++++++++++++++++++++++++++++++++--- 2 files changed, 147 insertions(+), 15 deletions(-) diff --git a/input/drivers/test_input.c b/input/drivers/test_input.c index 7809547d4f1f..0c575a61d2c1 100644 --- a/input/drivers/test_input.c +++ b/input/drivers/test_input.c @@ -367,8 +367,8 @@ static void test_input_poll(void *data) test_key_state[DEFAULT_MAX_PADS][input_test_steps[i].param_num] = 1; input_test_steps[i].handled = true; RARCH_DBG( - "[Test input driver]: Pressing keyboard button %d\n", - input_test_steps[i].param_num); + "[Test input driver]: Pressing keyboard button %d at frame %d\n", + input_test_steps[i].param_num, curr_frame); } else if( input_test_steps[i].action == INPUT_TEST_COMMAND_RELEASE_KEY) { @@ -376,8 +376,8 @@ static void test_input_poll(void *data) test_key_state[DEFAULT_MAX_PADS][input_test_steps[i].param_num] = 0; input_test_steps[i].handled = true; RARCH_DBG( - "[Test input driver]: Releasing keyboard button %d\n", - input_test_steps[i].param_num); + "[Test input driver]: Releasing keyboard button %d at frame %d\n", + input_test_steps[i].param_num, curr_frame); } else { diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 63df1ccea0d0..a51c9bfbd12b 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -1963,17 +1963,149 @@ const struct rarch_key_map rarch_key_map_winraw[] = { #ifdef HAVE_TEST_DRIVERS const struct rarch_key_map rarch_key_map_test[] = { - { RETROK_ESCAPE, RETROK_ESCAPE }, - { RETROK_F1, RETROK_F1 }, - { RETROK_F2, RETROK_F2 }, - { RETROK_F3, RETROK_F3 }, - { RETROK_F4, RETROK_F4 }, - { RETROK_F5, RETROK_F5 }, - { RETROK_F6, RETROK_F6 }, - { RETROK_F7, RETROK_F7 }, - { RETROK_F8, RETROK_F8 }, - { RETROK_F9, RETROK_F9 }, - { RETROK_F10, RETROK_F10 } +/* { RETROK_UNKNOWN ,RETROK_UNKNOWN },*/ + { RETROK_BACKSPACE ,RETROK_BACKSPACE }, + { RETROK_TAB ,RETROK_TAB }, + { RETROK_CLEAR ,RETROK_CLEAR }, + { RETROK_RETURN ,RETROK_RETURN }, + { RETROK_PAUSE ,RETROK_PAUSE }, + { RETROK_ESCAPE ,RETROK_ESCAPE }, + { RETROK_SPACE ,RETROK_SPACE }, + { RETROK_EXCLAIM ,RETROK_EXCLAIM }, + { RETROK_QUOTEDBL ,RETROK_QUOTEDBL }, + { RETROK_HASH ,RETROK_HASH }, + { RETROK_DOLLAR ,RETROK_DOLLAR }, + { RETROK_AMPERSAND ,RETROK_AMPERSAND }, + { RETROK_QUOTE ,RETROK_QUOTE }, + { RETROK_LEFTPAREN ,RETROK_LEFTPAREN }, + { RETROK_RIGHTPAREN ,RETROK_RIGHTPAREN }, + { RETROK_ASTERISK ,RETROK_ASTERISK }, + { RETROK_PLUS ,RETROK_PLUS }, + { RETROK_COMMA ,RETROK_COMMA }, + { RETROK_MINUS ,RETROK_MINUS }, + { RETROK_PERIOD ,RETROK_PERIOD }, + { RETROK_SLASH ,RETROK_SLASH }, + { RETROK_0 ,RETROK_0 }, + { RETROK_1 ,RETROK_1 }, + { RETROK_2 ,RETROK_2 }, + { RETROK_3 ,RETROK_3 }, + { RETROK_4 ,RETROK_4 }, + { RETROK_5 ,RETROK_5 }, + { RETROK_6 ,RETROK_6 }, + { RETROK_7 ,RETROK_7 }, + { RETROK_8 ,RETROK_8 }, + { RETROK_9 ,RETROK_9 }, + { RETROK_COLON ,RETROK_COLON }, + { RETROK_SEMICOLON ,RETROK_SEMICOLON }, + { RETROK_LESS ,RETROK_LESS }, + { RETROK_EQUALS ,RETROK_EQUALS }, + { RETROK_GREATER ,RETROK_GREATER }, + { RETROK_QUESTION ,RETROK_QUESTION }, + { RETROK_AT ,RETROK_AT }, + { RETROK_LEFTBRACKET ,RETROK_LEFTBRACKET }, + { RETROK_BACKSLASH ,RETROK_BACKSLASH }, + { RETROK_RIGHTBRACKET ,RETROK_RIGHTBRACKET }, + { RETROK_CARET ,RETROK_CARET }, + { RETROK_UNDERSCORE ,RETROK_UNDERSCORE }, + { RETROK_BACKQUOTE ,RETROK_BACKQUOTE }, + { RETROK_a ,RETROK_a }, + { RETROK_b ,RETROK_b }, + { RETROK_c ,RETROK_c }, + { RETROK_d ,RETROK_d }, + { RETROK_e ,RETROK_e }, + { RETROK_f ,RETROK_f }, + { RETROK_g ,RETROK_g }, + { RETROK_h ,RETROK_h }, + { RETROK_i ,RETROK_i }, + { RETROK_j ,RETROK_j }, + { RETROK_k ,RETROK_k }, + { RETROK_l ,RETROK_l }, + { RETROK_m ,RETROK_m }, + { RETROK_n ,RETROK_n }, + { RETROK_o ,RETROK_o }, + { RETROK_p ,RETROK_p }, + { RETROK_q ,RETROK_q }, + { RETROK_r ,RETROK_r }, + { RETROK_s ,RETROK_s }, + { RETROK_t ,RETROK_t }, + { RETROK_u ,RETROK_u }, + { RETROK_v ,RETROK_v }, + { RETROK_w ,RETROK_w }, + { RETROK_x ,RETROK_x }, + { RETROK_y ,RETROK_y }, + { RETROK_z ,RETROK_z }, + { RETROK_LEFTBRACE ,RETROK_LEFTBRACE }, + { RETROK_BAR ,RETROK_BAR }, + { RETROK_RIGHTBRACE ,RETROK_RIGHTBRACE }, + { RETROK_TILDE ,RETROK_TILDE }, + { RETROK_DELETE ,RETROK_DELETE }, + { RETROK_KP0 ,RETROK_KP0 }, + { RETROK_KP1 ,RETROK_KP1 }, + { RETROK_KP2 ,RETROK_KP2 }, + { RETROK_KP3 ,RETROK_KP3 }, + { RETROK_KP4 ,RETROK_KP4 }, + { RETROK_KP5 ,RETROK_KP5 }, + { RETROK_KP6 ,RETROK_KP6 }, + { RETROK_KP7 ,RETROK_KP7 }, + { RETROK_KP8 ,RETROK_KP8 }, + { RETROK_KP9 ,RETROK_KP9 }, + { RETROK_KP_PERIOD ,RETROK_KP_PERIOD }, + { RETROK_KP_DIVIDE ,RETROK_KP_DIVIDE }, + { RETROK_KP_MULTIPLY ,RETROK_KP_MULTIPLY }, + { RETROK_KP_MINUS ,RETROK_KP_MINUS }, + { RETROK_KP_PLUS ,RETROK_KP_PLUS }, + { RETROK_KP_ENTER ,RETROK_KP_ENTER }, + { RETROK_KP_EQUALS ,RETROK_KP_EQUALS }, + { RETROK_UP ,RETROK_UP }, + { RETROK_DOWN ,RETROK_DOWN }, + { RETROK_RIGHT ,RETROK_RIGHT }, + { RETROK_LEFT ,RETROK_LEFT }, + { RETROK_INSERT ,RETROK_INSERT }, + { RETROK_HOME ,RETROK_HOME }, + { RETROK_END ,RETROK_END }, + { RETROK_PAGEUP ,RETROK_PAGEUP }, + { RETROK_PAGEDOWN ,RETROK_PAGEDOWN }, + { RETROK_F1 ,RETROK_F1 }, + { RETROK_F2 ,RETROK_F2 }, + { RETROK_F3 ,RETROK_F3 }, + { RETROK_F4 ,RETROK_F4 }, + { RETROK_F5 ,RETROK_F5 }, + { RETROK_F6 ,RETROK_F6 }, + { RETROK_F7 ,RETROK_F7 }, + { RETROK_F8 ,RETROK_F8 }, + { RETROK_F9 ,RETROK_F9 }, + { RETROK_F10 ,RETROK_F10 }, + { RETROK_F11 ,RETROK_F11 }, + { RETROK_F12 ,RETROK_F12 }, + { RETROK_F13 ,RETROK_F13 }, + { RETROK_F14 ,RETROK_F14 }, + { RETROK_F15 ,RETROK_F15 }, + { RETROK_NUMLOCK ,RETROK_NUMLOCK }, + { RETROK_CAPSLOCK ,RETROK_CAPSLOCK }, + { RETROK_SCROLLOCK ,RETROK_SCROLLOCK }, + { RETROK_RSHIFT ,RETROK_RSHIFT }, + { RETROK_LSHIFT ,RETROK_LSHIFT }, + { RETROK_RCTRL ,RETROK_RCTRL }, + { RETROK_LCTRL ,RETROK_LCTRL }, + { RETROK_RALT ,RETROK_RALT }, + { RETROK_LALT ,RETROK_LALT }, + { RETROK_RMETA ,RETROK_RMETA }, + { RETROK_LMETA ,RETROK_LMETA }, + { RETROK_LSUPER ,RETROK_LSUPER }, + { RETROK_RSUPER ,RETROK_RSUPER }, + { RETROK_MODE ,RETROK_MODE }, + { RETROK_COMPOSE ,RETROK_COMPOSE }, + { RETROK_HELP ,RETROK_HELP }, + { RETROK_PRINT ,RETROK_PRINT }, + { RETROK_SYSREQ ,RETROK_SYSREQ }, + { RETROK_BREAK ,RETROK_BREAK }, + { RETROK_MENU ,RETROK_MENU }, + { RETROK_POWER ,RETROK_POWER }, + { RETROK_EURO ,RETROK_EURO }, + { RETROK_UNDO ,RETROK_UNDO }, + { RETROK_OEM_102 ,RETROK_OEM_102 }, + { RETROK_LAST ,RETROK_LAST }, + { 0, RETROK_UNKNOWN } }; #endif // HAVE_TEST_DRIVERS From 50281aa28307d728fab3235fed5a00d3f182f624 Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Sun, 14 Apr 2024 14:11:26 +0200 Subject: [PATCH 4/6] remove lut --- input/drivers/test_input.c | 22 ++++++++++++++-------- input/input_keymaps.c | 8 ++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/input/drivers/test_input.c b/input/drivers/test_input.c index 0c575a61d2c1..05480511a825 100644 --- a/input/drivers/test_input.c +++ b/input/drivers/test_input.c @@ -302,7 +302,7 @@ static int16_t test_input_state( { if (id < RARCH_BIND_LIST_END) if (test_key_state[DEFAULT_MAX_PADS] - [rarch_keysym_lut[binds[port][i].key]]) + [binds[port][i].key]) ret |= (1 << i); } } @@ -315,15 +315,14 @@ static int16_t test_input_state( if ( (id < RARCH_BIND_LIST_END && test_key_state[DEFAULT_MAX_PADS] - [rarch_keysym_lut[binds[port][id].key]]) + [binds[port][id].key]) ) return 1; } break; case RETRO_DEVICE_KEYBOARD: - if (id < RARCH_BIND_LIST_END) - return (test_key_state[DEFAULT_MAX_PADS] - [rarch_keysym_lut[binds[port][id].key]]); + if (id && id < RETROK_LAST) + return (test_key_state[DEFAULT_MAX_PADS][id]); break; } } @@ -347,7 +346,8 @@ static void* test_input_init(const char *joypad_driver) if (last_test_step > MAX_TEST_STEPS) last_test_step = 0; - input_keymaps_init_keyboard_lut(rarch_key_map_test); + /* No need for keyboard mapping look-up table */ + /* input_keymaps_init_keyboard_lut(rarch_key_map_test);*/ return (void*)-1; } @@ -383,7 +383,7 @@ static void test_input_poll(void *data) { input_test_steps[i].handled = true; RARCH_WARN( - "[Test joypad driver]: Unrecognized action %d in step %d, skipping\n", + "[Test input driver]: Unrecognized action %d in step %d, skipping\n", input_test_steps[i].action,i); } @@ -394,7 +394,13 @@ static void test_input_poll(void *data) static uint64_t test_input_get_capabilities(void *data) { - return UINT64_C(1) << RETRO_DEVICE_JOYPAD; + return + (1 << RETRO_DEVICE_JOYPAD) + | (1 << RETRO_DEVICE_ANALOG) + | (1 << RETRO_DEVICE_KEYBOARD) +/* | (1 << RETRO_DEVICE_MOUSE) + | (1 << RETRO_DEVICE_POINTER) + | (1 << RETRO_DEVICE_LIGHTGUN)*/; } input_driver_t input_test = { diff --git a/input/input_keymaps.c b/input/input_keymaps.c index a51c9bfbd12b..510671532631 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -1961,7 +1961,7 @@ const struct rarch_key_map rarch_key_map_winraw[] = { * so they can't be placed in a C source file */ #endif -#ifdef HAVE_TEST_DRIVERS +#if 0 const struct rarch_key_map rarch_key_map_test[] = { /* { RETROK_UNKNOWN ,RETROK_UNKNOWN },*/ { RETROK_BACKSPACE ,RETROK_BACKSPACE }, @@ -2002,9 +2002,9 @@ const struct rarch_key_map rarch_key_map_test[] = { { RETROK_GREATER ,RETROK_GREATER }, { RETROK_QUESTION ,RETROK_QUESTION }, { RETROK_AT ,RETROK_AT }, - { RETROK_LEFTBRACKET ,RETROK_LEFTBRACKET }, + { RETROK_LEFTBRACKET,RETROK_LEFTBRACKET }, { RETROK_BACKSLASH ,RETROK_BACKSLASH }, - { RETROK_RIGHTBRACKET ,RETROK_RIGHTBRACKET }, + { RETROK_RIGHTBRACKET,RETROK_RIGHTBRACKET }, { RETROK_CARET ,RETROK_CARET }, { RETROK_UNDERSCORE ,RETROK_UNDERSCORE }, { RETROK_BACKQUOTE ,RETROK_BACKQUOTE }, @@ -2051,7 +2051,7 @@ const struct rarch_key_map rarch_key_map_test[] = { { RETROK_KP9 ,RETROK_KP9 }, { RETROK_KP_PERIOD ,RETROK_KP_PERIOD }, { RETROK_KP_DIVIDE ,RETROK_KP_DIVIDE }, - { RETROK_KP_MULTIPLY ,RETROK_KP_MULTIPLY }, + { RETROK_KP_MULTIPLY,RETROK_KP_MULTIPLY }, { RETROK_KP_MINUS ,RETROK_KP_MINUS }, { RETROK_KP_PLUS ,RETROK_KP_PLUS }, { RETROK_KP_ENTER ,RETROK_KP_ENTER }, From befc952d633948ebf57886229f9508811e613bcd Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Sun, 5 May 2024 09:20:20 +0200 Subject: [PATCH 5/6] updates --- input/drivers/test_input.c | 39 ++++++++++++++++++--------- tests-other/all_binds_empty.cfg | 3 ++- tests-other/test_input_keyboard.ratst | 29 ++++++++++++-------- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/input/drivers/test_input.c b/input/drivers/test_input.c index 05480511a825..cd45862007c4 100644 --- a/input/drivers/test_input.c +++ b/input/drivers/test_input.c @@ -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]); @@ -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", @@ -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", diff --git a/tests-other/all_binds_empty.cfg b/tests-other/all_binds_empty.cfg index 82d867584fed..b672d927a123 100644 --- a/tests-other/all_binds_empty.cfg +++ b/tests-other/all_binds_empty.cfg @@ -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" @@ -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" diff --git a/tests-other/test_input_keyboard.ratst b/tests-other/test_input_keyboard.ratst index d9c383edf8de..fffbec732791 100644 --- a/tests-other/test_input_keyboard.ratst +++ b/tests-other/test_input_keyboard.ratst @@ -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 -} -] \ No newline at end of file +}] From c23f69bd78aecc28ccd5a66df8b021e9f9cf72c6 Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Mon, 6 May 2024 21:10:51 +0200 Subject: [PATCH 6/6] updates --- input/input_driver.c | 11 ++-- input/input_keymaps.c | 148 ------------------------------------------ input/input_keymaps.h | 1 - 3 files changed, 7 insertions(+), 153 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index 357290e23973..14aa78d45a54 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -4428,11 +4428,14 @@ bool video_driver_init_input( input_driver_t **input = &input_driver_st.current_driver; if (*input) #if HAVE_TEST_DRIVERS - if (strcmp(settings->arrays.input_driver,"test") != 0 || - string_is_empty(settings->paths.test_input_file_general)) - /* Video driver did provide an input driver, - * and test driver is not in use or has no input file. */ + if (strcmp(settings->arrays.input_driver,"test") != 0) + /* Test driver not in use, keep selected driver */ return true; + else if (string_is_empty(settings->paths.test_input_file_general)) + { + RARCH_LOG("[Input]: Test input driver selected, but no input file provided - falling back.\n"); + return true; + } else RARCH_LOG("[Video]: Graphics driver initialized an input driver, but ignoring it as test input driver is in use.\n"); #else diff --git a/input/input_keymaps.c b/input/input_keymaps.c index 510671532631..758de553c62e 100644 --- a/input/input_keymaps.c +++ b/input/input_keymaps.c @@ -1961,154 +1961,6 @@ const struct rarch_key_map rarch_key_map_winraw[] = { * so they can't be placed in a C source file */ #endif -#if 0 -const struct rarch_key_map rarch_key_map_test[] = { -/* { RETROK_UNKNOWN ,RETROK_UNKNOWN },*/ - { RETROK_BACKSPACE ,RETROK_BACKSPACE }, - { RETROK_TAB ,RETROK_TAB }, - { RETROK_CLEAR ,RETROK_CLEAR }, - { RETROK_RETURN ,RETROK_RETURN }, - { RETROK_PAUSE ,RETROK_PAUSE }, - { RETROK_ESCAPE ,RETROK_ESCAPE }, - { RETROK_SPACE ,RETROK_SPACE }, - { RETROK_EXCLAIM ,RETROK_EXCLAIM }, - { RETROK_QUOTEDBL ,RETROK_QUOTEDBL }, - { RETROK_HASH ,RETROK_HASH }, - { RETROK_DOLLAR ,RETROK_DOLLAR }, - { RETROK_AMPERSAND ,RETROK_AMPERSAND }, - { RETROK_QUOTE ,RETROK_QUOTE }, - { RETROK_LEFTPAREN ,RETROK_LEFTPAREN }, - { RETROK_RIGHTPAREN ,RETROK_RIGHTPAREN }, - { RETROK_ASTERISK ,RETROK_ASTERISK }, - { RETROK_PLUS ,RETROK_PLUS }, - { RETROK_COMMA ,RETROK_COMMA }, - { RETROK_MINUS ,RETROK_MINUS }, - { RETROK_PERIOD ,RETROK_PERIOD }, - { RETROK_SLASH ,RETROK_SLASH }, - { RETROK_0 ,RETROK_0 }, - { RETROK_1 ,RETROK_1 }, - { RETROK_2 ,RETROK_2 }, - { RETROK_3 ,RETROK_3 }, - { RETROK_4 ,RETROK_4 }, - { RETROK_5 ,RETROK_5 }, - { RETROK_6 ,RETROK_6 }, - { RETROK_7 ,RETROK_7 }, - { RETROK_8 ,RETROK_8 }, - { RETROK_9 ,RETROK_9 }, - { RETROK_COLON ,RETROK_COLON }, - { RETROK_SEMICOLON ,RETROK_SEMICOLON }, - { RETROK_LESS ,RETROK_LESS }, - { RETROK_EQUALS ,RETROK_EQUALS }, - { RETROK_GREATER ,RETROK_GREATER }, - { RETROK_QUESTION ,RETROK_QUESTION }, - { RETROK_AT ,RETROK_AT }, - { RETROK_LEFTBRACKET,RETROK_LEFTBRACKET }, - { RETROK_BACKSLASH ,RETROK_BACKSLASH }, - { RETROK_RIGHTBRACKET,RETROK_RIGHTBRACKET }, - { RETROK_CARET ,RETROK_CARET }, - { RETROK_UNDERSCORE ,RETROK_UNDERSCORE }, - { RETROK_BACKQUOTE ,RETROK_BACKQUOTE }, - { RETROK_a ,RETROK_a }, - { RETROK_b ,RETROK_b }, - { RETROK_c ,RETROK_c }, - { RETROK_d ,RETROK_d }, - { RETROK_e ,RETROK_e }, - { RETROK_f ,RETROK_f }, - { RETROK_g ,RETROK_g }, - { RETROK_h ,RETROK_h }, - { RETROK_i ,RETROK_i }, - { RETROK_j ,RETROK_j }, - { RETROK_k ,RETROK_k }, - { RETROK_l ,RETROK_l }, - { RETROK_m ,RETROK_m }, - { RETROK_n ,RETROK_n }, - { RETROK_o ,RETROK_o }, - { RETROK_p ,RETROK_p }, - { RETROK_q ,RETROK_q }, - { RETROK_r ,RETROK_r }, - { RETROK_s ,RETROK_s }, - { RETROK_t ,RETROK_t }, - { RETROK_u ,RETROK_u }, - { RETROK_v ,RETROK_v }, - { RETROK_w ,RETROK_w }, - { RETROK_x ,RETROK_x }, - { RETROK_y ,RETROK_y }, - { RETROK_z ,RETROK_z }, - { RETROK_LEFTBRACE ,RETROK_LEFTBRACE }, - { RETROK_BAR ,RETROK_BAR }, - { RETROK_RIGHTBRACE ,RETROK_RIGHTBRACE }, - { RETROK_TILDE ,RETROK_TILDE }, - { RETROK_DELETE ,RETROK_DELETE }, - { RETROK_KP0 ,RETROK_KP0 }, - { RETROK_KP1 ,RETROK_KP1 }, - { RETROK_KP2 ,RETROK_KP2 }, - { RETROK_KP3 ,RETROK_KP3 }, - { RETROK_KP4 ,RETROK_KP4 }, - { RETROK_KP5 ,RETROK_KP5 }, - { RETROK_KP6 ,RETROK_KP6 }, - { RETROK_KP7 ,RETROK_KP7 }, - { RETROK_KP8 ,RETROK_KP8 }, - { RETROK_KP9 ,RETROK_KP9 }, - { RETROK_KP_PERIOD ,RETROK_KP_PERIOD }, - { RETROK_KP_DIVIDE ,RETROK_KP_DIVIDE }, - { RETROK_KP_MULTIPLY,RETROK_KP_MULTIPLY }, - { RETROK_KP_MINUS ,RETROK_KP_MINUS }, - { RETROK_KP_PLUS ,RETROK_KP_PLUS }, - { RETROK_KP_ENTER ,RETROK_KP_ENTER }, - { RETROK_KP_EQUALS ,RETROK_KP_EQUALS }, - { RETROK_UP ,RETROK_UP }, - { RETROK_DOWN ,RETROK_DOWN }, - { RETROK_RIGHT ,RETROK_RIGHT }, - { RETROK_LEFT ,RETROK_LEFT }, - { RETROK_INSERT ,RETROK_INSERT }, - { RETROK_HOME ,RETROK_HOME }, - { RETROK_END ,RETROK_END }, - { RETROK_PAGEUP ,RETROK_PAGEUP }, - { RETROK_PAGEDOWN ,RETROK_PAGEDOWN }, - { RETROK_F1 ,RETROK_F1 }, - { RETROK_F2 ,RETROK_F2 }, - { RETROK_F3 ,RETROK_F3 }, - { RETROK_F4 ,RETROK_F4 }, - { RETROK_F5 ,RETROK_F5 }, - { RETROK_F6 ,RETROK_F6 }, - { RETROK_F7 ,RETROK_F7 }, - { RETROK_F8 ,RETROK_F8 }, - { RETROK_F9 ,RETROK_F9 }, - { RETROK_F10 ,RETROK_F10 }, - { RETROK_F11 ,RETROK_F11 }, - { RETROK_F12 ,RETROK_F12 }, - { RETROK_F13 ,RETROK_F13 }, - { RETROK_F14 ,RETROK_F14 }, - { RETROK_F15 ,RETROK_F15 }, - { RETROK_NUMLOCK ,RETROK_NUMLOCK }, - { RETROK_CAPSLOCK ,RETROK_CAPSLOCK }, - { RETROK_SCROLLOCK ,RETROK_SCROLLOCK }, - { RETROK_RSHIFT ,RETROK_RSHIFT }, - { RETROK_LSHIFT ,RETROK_LSHIFT }, - { RETROK_RCTRL ,RETROK_RCTRL }, - { RETROK_LCTRL ,RETROK_LCTRL }, - { RETROK_RALT ,RETROK_RALT }, - { RETROK_LALT ,RETROK_LALT }, - { RETROK_RMETA ,RETROK_RMETA }, - { RETROK_LMETA ,RETROK_LMETA }, - { RETROK_LSUPER ,RETROK_LSUPER }, - { RETROK_RSUPER ,RETROK_RSUPER }, - { RETROK_MODE ,RETROK_MODE }, - { RETROK_COMPOSE ,RETROK_COMPOSE }, - { RETROK_HELP ,RETROK_HELP }, - { RETROK_PRINT ,RETROK_PRINT }, - { RETROK_SYSREQ ,RETROK_SYSREQ }, - { RETROK_BREAK ,RETROK_BREAK }, - { RETROK_MENU ,RETROK_MENU }, - { RETROK_POWER ,RETROK_POWER }, - { RETROK_EURO ,RETROK_EURO }, - { RETROK_UNDO ,RETROK_UNDO }, - { RETROK_OEM_102 ,RETROK_OEM_102 }, - { RETROK_LAST ,RETROK_LAST }, - { 0, RETROK_UNKNOWN } -}; -#endif // HAVE_TEST_DRIVERS - /* TODO/FIXME - global */ enum retro_key rarch_keysym_lut[RETROK_LAST]; diff --git a/input/input_keymaps.h b/input/input_keymaps.h index 661ee4582883..2ffee2b67ffc 100644 --- a/input/input_keymaps.h +++ b/input/input_keymaps.h @@ -257,7 +257,6 @@ extern const struct rarch_key_map rarch_key_map_apple_hid[]; extern const struct rarch_key_map rarch_key_map_android[]; extern const struct rarch_key_map rarch_key_map_qnx[]; extern const struct rarch_key_map rarch_key_map_dos[]; -extern const struct rarch_key_map rarch_key_map_test[]; extern const struct rarch_key_map rarch_key_map_wiiu[]; extern const struct rarch_key_map rarch_key_map_winraw[]; #ifdef HAVE_LIBNX