From 3792a5e502c98cbdc7b6f40de9cc45516466df2a Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 4 Apr 2018 21:33:03 -0500 Subject: [PATCH] remap-redux part2: cleanup --- Makefile.common | 4 +--- Makefile.msvc | 1 - Makefile.vita | 1 - Makefile.wiiu | 1 - configuration.c | 6 ------ griffin/griffin.c | 2 -- input/input_driver.c | 21 ++++----------------- input/input_mapper.c | 13 ++++++------- input/input_mapper.h | 2 +- menu/cbs/menu_cbs_get_value.c | 4 ---- menu/cbs/menu_cbs_left.c | 4 ---- menu/cbs/menu_cbs_right.c | 4 ---- menu/cbs/menu_cbs_select.c | 4 ---- menu/cbs/menu_cbs_sublabel.c | 2 -- menu/menu_displaylist.c | 2 -- qb/config.libs.sh | 1 - qb/config.params.sh | 1 - 17 files changed, 12 insertions(+), 61 deletions(-) diff --git a/Makefile.common b/Makefile.common index 2e0d9b61ae2e..b12ea0150531 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1605,9 +1605,7 @@ ifeq ($(HAVE_NETWORKING), 1) $(LIBRETRO_COMM_DIR)/utils/md5.o endif - ifeq ($(HAVE_KEYMAPPER), 1) - OBJ += input/input_mapper.o - endif + OBJ += input/input_mapper.o ifeq ($(HAVE_NETWORKGAMEPAD), 1) OBJ += input/input_remote.o \ diff --git a/Makefile.msvc b/Makefile.msvc index 77d02fc9fa0c..48405fd5c286 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -53,7 +53,6 @@ HAVE_NETWORK_CMD := 1 HAVE_OVERLAY := 1 HAVE_LANGEXTRA := 1 HAVE_CHEEVOS := 1 -HAVE_KEYMAPPER := 1 HAVE_SHADERPIPELINE := 1 HAVE_IMAGEVIEWER := 1 diff --git a/Makefile.vita b/Makefile.vita index efa4646cfba1..5645c9cabd66 100644 --- a/Makefile.vita +++ b/Makefile.vita @@ -33,7 +33,6 @@ else HAVE_ZLIB := 1 HAVE_7ZIP := 1 HAVE_VITA2D := 1 - HAVE_KEYMAPPER := 1 HAVE_NETWORKING := 1 HAVE_SOCKET_LEGACY := 1 HAVE_MENU := 1 diff --git a/Makefile.wiiu b/Makefile.wiiu index 5b2d3625a9cb..bcba3cd881ed 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -133,7 +133,6 @@ endif HAVE_ZLIB = 1 HAVE_7ZIP = 1 HAVE_BUILTINZLIB = 1 - HAVE_KEYMAPPER = 1 HAVE_LIBRETRODB = 1 HAVE_ZARCH = 0 HAVE_MATERIALUI = 1 diff --git a/configuration.c b/configuration.c index 9f0eed8a04bf..beb10a34d291 100644 --- a/configuration.c +++ b/configuration.c @@ -1358,9 +1358,6 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings, #ifdef HAVE_NETWORKGAMEPAD SETTING_BOOL("network_remote_enable", &settings->bools.network_remote_enable, false, false /* TODO */, false); #endif -#ifdef HAVE_KEYMAPPER - SETTING_BOOL("keymapper_enable", &settings->bools.keymapper_enable, true, true /* TODO */, false); -#endif #ifdef HAVE_NETWORKING SETTING_BOOL("netplay_nat_traversal", &settings->bools.netplay_nat_traversal, true, true, false); #endif @@ -1465,9 +1462,6 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings, #ifdef HAVE_NETWORKGAMEPAD SETTING_UINT("network_remote_base_port", &settings->uints.network_remote_base_port, true, network_remote_base_port, false); #endif -#ifdef HAVE_KEYMAPPER - SETTING_UINT("keymapper_port", &settings->uints.keymapper_port, true, 0, false); -#endif #ifdef GEKKO SETTING_UINT("video_viwidth", &settings->uints.video_viwidth, true, video_viwidth, false); #endif diff --git a/griffin/griffin.c b/griffin/griffin.c index e92b9da7796c..b9720bfa45cf 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1242,9 +1242,7 @@ MENU #include "../cores/libretro-net-retropad/net_retropad_core.c" #endif -#ifdef HAVE_KEYMAPPER #include "../input/input_mapper.c" -#endif #include "../command.c" diff --git a/input/input_driver.c b/input/input_driver.c index defdd62c2db3..70a7d0340d73 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -34,9 +34,7 @@ #include "input_remote.h" #endif -#ifdef HAVE_KEYMAPPER #include "input_mapper.h" -#endif #include "input_driver.h" #include "input_keymaps.h" @@ -377,9 +375,7 @@ static command_t *input_driver_command = NULL; #ifdef HAVE_NETWORKGAMEPAD static input_remote_t *input_driver_remote = NULL; #endif -#ifdef HAVE_KEYMAPPER static input_mapper_t *input_driver_mapper = NULL; -#endif static const input_driver_t *current_input = NULL; static void *current_input_data = NULL; static bool input_driver_block_hotkey = false; @@ -605,10 +601,8 @@ void input_poll(void) input_driver_axis_threshold); #endif -#ifdef HAVE_KEYMAPPER - if (input_driver_mapper) + if (settings->bools.input_remap_binds_enable && input_driver_mapper) input_mapper_poll(input_driver_mapper); -#endif #ifdef HAVE_COMMAND if (input_driver_command) @@ -692,11 +686,9 @@ int16_t input_state(unsigned port, unsigned device, } } -#ifdef HAVE_KEYMAPPER - if (input_driver_mapper) + if (settings->bools.input_remap_binds_enable && input_driver_mapper) input_mapper_state(input_driver_mapper, &res, port, device, idx, id); -#endif #ifdef HAVE_OVERLAY if (overlay_ptr) @@ -1368,11 +1360,9 @@ void input_driver_deinit_remote(void) void input_driver_deinit_mapper(void) { -#ifdef HAVE_KEYMAPPER if (input_driver_mapper) input_mapper_free(input_driver_mapper); input_driver_mapper = NULL; -#endif } bool input_driver_init_remote(void) @@ -1397,20 +1387,17 @@ bool input_driver_init_remote(void) bool input_driver_init_mapper(void) { -#ifdef HAVE_KEYMAPPER settings_t *settings = config_get_ptr(); - if (!settings->bools.keymapper_enable) + if (!settings->bools.input_remap_binds_enable) return false; - input_driver_mapper = input_mapper_new( - settings->uints.keymapper_port); + input_driver_mapper = input_mapper_new(); if (input_driver_mapper) return true; RARCH_ERR("Failed to initialize input mapper.\n"); -#endif return false; } diff --git a/input/input_mapper.c b/input/input_mapper.c index 3239cf56000c..93a4295fa9c4 100644 --- a/input/input_mapper.c +++ b/input/input_mapper.c @@ -58,7 +58,7 @@ struct input_mapper retro_bits_t buttons[MAX_USERS]; }; -input_mapper_t *input_mapper_new(uint16_t port) +input_mapper_t *input_mapper_new(void) { input_mapper_t* handle = (input_mapper_t*) calloc(1, sizeof(*handle)); @@ -76,8 +76,6 @@ void input_mapper_free(input_mapper_t *handle) free (handle); } -bool flag = false; - bool input_mapper_button_pressed(input_mapper_t *handle, unsigned port, unsigned id) { return BIT256_GET(handle->buttons[port], id); @@ -108,6 +106,8 @@ void input_mapper_poll(input_mapper_t *handle) { device = settings->uints.input_libretro_device[i]; device &= RETRO_DEVICE_MASK; + + /* keyboard to gamepad remapping */ if (device == RETRO_DEVICE_KEYBOARD) { for (j = 0; j < RARCH_CUSTOM_BIND_LIST_END; j++) @@ -137,7 +137,9 @@ void input_mapper_poll(input_mapper_t *handle) } } } - if (device == RETRO_DEVICE_JOYPAD) + + /* gamepad remapping */ + if (device == RETRO_DEVICE_JOYPAD || device == RETRO_DEVICE_ANALOG) { /* this loop iterates on all users and all buttons, and checks if a pressed button is assigned to any other button than the default one, then it sets the bit on the @@ -165,9 +167,6 @@ void input_mapper_poll(input_mapper_t *handle) #endif } } - - - } void input_mapper_state( diff --git a/input/input_mapper.h b/input/input_mapper.h index 5f2b91e51ba4..21741d008ed9 100644 --- a/input/input_mapper.h +++ b/input/input_mapper.h @@ -31,7 +31,7 @@ RETRO_BEGIN_DECLS typedef struct input_mapper input_mapper_t; -input_mapper_t *input_mapper_new(uint16_t port); +input_mapper_t *input_mapper_new(void); void input_mapper_free(input_mapper_t *handle); diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index f6bcfd117ee1..54e39b2bcd5a 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -581,7 +581,6 @@ static void menu_action_setting_disp_set_label_input_desc( strlcpy(s2, path, len2); } -#ifdef HAVE_KEYMAPPER static void menu_action_setting_disp_set_label_input_desc_kbd( file_list_t* list, unsigned *w, unsigned type, unsigned i, @@ -627,7 +626,6 @@ static void menu_action_setting_disp_set_label_input_desc_kbd( *w = 19; strlcpy(s2, path, len2); } -#endif static void menu_action_setting_disp_set_label_cheat( file_list_t* list, @@ -2076,14 +2074,12 @@ static int menu_cbs_init_bind_get_string_representation_compare_type( BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_libretro_perf_counters); } -#ifdef HAVE_KEYMAPPER else if (type >= MENU_SETTINGS_INPUT_DESC_KBD_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_KBD_END) { BIND_ACTION_GET_VALUE(cbs, menu_action_setting_disp_set_label_input_desc_kbd); } -#endif else { switch (type) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 98e96b721b5c..37b0d51270e8 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -124,7 +124,6 @@ static int action_left_input_desc(unsigned type, const char *label, return 0; } -#ifdef HAVE_KEYMAPPER static int action_left_input_desc_kbd(unsigned type, const char *label, bool wraparound) { @@ -161,7 +160,6 @@ static int action_left_input_desc_kbd(unsigned type, const char *label, return 0; } -#endif static int action_left_scroll(unsigned type, const char *label, bool wraparound) @@ -633,13 +631,11 @@ static int menu_cbs_init_bind_left_compare_type(menu_file_list_cbs_t *cbs, { BIND_ACTION_LEFT(cbs, action_left_input_desc); } -#ifdef HAVE_KEYMAPPER else if (type >= MENU_SETTINGS_INPUT_DESC_KBD_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_KBD_END) { BIND_ACTION_LEFT(cbs, action_left_input_desc_kbd); } -#endif else if ((type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START)) { BIND_ACTION_LEFT(cbs, playlist_association_left); diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index ee6cbd85b25e..8451f5102916 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -101,7 +101,6 @@ int action_right_cheat(unsigned type, const char *label, wraparound); } -#ifdef HAVE_KEYMAPPER int action_right_input_desc_kbd(unsigned type, const char *label, bool wraparound) { @@ -139,7 +138,6 @@ int action_right_input_desc_kbd(unsigned type, const char *label, return 0; } -#endif /* fix-me: incomplete, lacks error checking */ int action_right_input_desc(unsigned type, const char *label, @@ -503,13 +501,11 @@ static int menu_cbs_init_bind_right_compare_type(menu_file_list_cbs_t *cbs, { BIND_ACTION_RIGHT(cbs, action_right_input_desc); } -#ifdef HAVE_KEYMAPPER else if (type >= MENU_SETTINGS_INPUT_DESC_KBD_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_KBD_END) { BIND_ACTION_RIGHT(cbs, action_right_input_desc_kbd); } -#endif else if ((type >= MENU_SETTINGS_PLAYLIST_ASSOCIATION_START)) { BIND_ACTION_RIGHT(cbs, playlist_association_right); diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 0246455d0d42..7a6bc5e04712 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -146,14 +146,12 @@ static int action_select_input_desc(const char *path, const char *label, unsigne return action_right_input_desc(type, label, true); } -#ifdef HAVE_KEYMAPPER static int action_select_input_desc_kbd(const char *path, const char *label, unsigned type, size_t idx) { return action_right_input_desc_kbd(type, label, true); } -#endif #ifdef HAVE_NETWORKING static int action_select_netplay_connect_room(const char *path, @@ -223,13 +221,11 @@ static int menu_cbs_init_bind_select_compare_type( { BIND_ACTION_SELECT(cbs, action_select_input_desc); } -#ifdef HAVE_KEYMAPPER else if (type >= MENU_SETTINGS_INPUT_DESC_KBD_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_KBD_END) { BIND_ACTION_SELECT(cbs, action_select_input_desc_kbd); } -#endif else { diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 3facf11794a0..735b2911b75d 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -533,13 +533,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_generic); -#ifdef HAVE_KEYMAPPER if (type >= MENU_SETTINGS_INPUT_DESC_KBD_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_KBD_END) { BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_remap_kbd_sublabel); } -#endif if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN && type <= MENU_SETTINGS_INPUT_DESC_END) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 106c16f44536..44df5c5cf4c7 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3282,7 +3282,6 @@ static int menu_displaylist_parse_options_remappings( } } } - #ifdef HAVE_KEYMAPPER if (system) { settings_t *settings = config_get_ptr(); @@ -3325,7 +3324,6 @@ static int menu_displaylist_parse_options_remappings( } } } - #endif return 0; } diff --git a/qb/config.libs.sh b/qb/config.libs.sh index e0c3382d5beb..701d8c162d35 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -210,7 +210,6 @@ if [ "$HAVE_NETWORKING" = 'yes' ]; then check_lib '' MINIUPNPC '-lminiupnpc' else die : 'Warning: All networking features have been disabled.' - HAVE_KEYMAPPER='no' HAVE_NETWORK_CMD='no' HAVE_NETWORKGAMEPAD='no' HAVE_CHEEVOS='no' diff --git a/qb/config.params.sh b/qb/config.params.sh index 94135f94f678..f3899a3403af 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -31,7 +31,6 @@ HAVE_SSA=auto # SSA/ASS for FFmpeg subtitle support HAVE_DYLIB=auto # Dynamic loading support HAVE_NETWORKING=auto # Networking features (recommended) HAVE_NETWORKGAMEPAD=auto # Networked game pad (plus baked-in core) -HAVE_KEYMAPPER=yes # Networked game pad (plus baked-in core) C89_NETWORKGAMEPAD=no HAVE_MINIUPNPC=auto # Mini UPnP client library (for NAT traversal) HAVE_BUILTINMINIUPNPC=yes # Bake in Mini UPnP client library (for NAT traversal)