remap-redux part2: cleanup

This commit is contained in:
radius 2018-04-04 21:33:03 -05:00
parent fa3dfd5f63
commit 3792a5e502
17 changed files with 12 additions and 61 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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;
}

View File

@ -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(

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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
{

View File

@ -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)

View File

@ -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;
}

View File

@ -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'

View File

@ -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)