From 89d06c7468d12f4315347709867cca63dd3c2013 Mon Sep 17 00:00:00 2001 From: Stephanie Gawroriski Date: Sat, 23 Dec 2023 18:46:52 -0500 Subject: [PATCH] Bleh. --- Makefile | 7 +++++-- configuration.c | 3 +++ input/input_defines.h | 1 + input/input_driver.c | 4 ++-- input/input_driver.h | 4 ++-- input/input_types.h | 10 ++++++---- menu/menu_setting.c | 14 +++++++++----- 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 1c9b12e46fe7..bfa45b8794d2 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,11 @@ endif ifeq ($(DEBUG), 1) OBJDIR := $(OBJDIR_BASE)/debug - CFLAGS ?= -O0 -g - CXXFLAGS ?= -O0 -g + # TODO: Temporary revert back + CFLAGS=-O0 -g3 -ggdb + CXXFLAGS=-O0 -g3 -ggdb + #CFLAGS ?= -O0 -g + #CXXFLAGS ?= -O0 -g DEFINES += -DDEBUG -D_DEBUG else OBJDIR := $(OBJDIR_BASE)/release diff --git a/configuration.c b/configuration.c index 9a03dc4e15e5..c8c5d2bd2fcc 100644 --- a/configuration.c +++ b/configuration.c @@ -282,6 +282,8 @@ enum midi_driver_enum #define DECLARE_BIND(base, bind, desc) { #base, desc, 0, bind, true } #define DECLARE_META_BIND(level, base, bind, desc) { #base, desc, level, bind, true } +#define DECLARE_EXTRA_BIND(id + const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = { DECLARE_BIND(b, RETRO_DEVICE_ID_JOYPAD_B, MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B), DECLARE_BIND(y, RETRO_DEVICE_ID_JOYPAD_Y, MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_Y), @@ -399,6 +401,7 @@ const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL] = { * These binds cannot be bound at all and are entirely virtualized. * These are respectively @c RARCH_BIND_ID_EXTRA_BUTTON_START and * the end point is @c RARCH_BIND_ID_EXTRA_BUTTON_END... */ + #if 0 /* Deprecated */ DECLARE_META_BIND(2, send_debug_info, RARCH_SEND_DEBUG_INFO, MENU_ENUM_LABEL_VALUE_INPUT_META_SEND_DEBUG_INFO), diff --git a/input/input_defines.h b/input/input_defines.h index 2aae40061acb..5aa27df16eb9 100644 --- a/input/input_defines.h +++ b/input/input_defines.h @@ -39,6 +39,7 @@ #define RARCH_MAX_EXTRA_BUTTON (RETRO_DEVICE_ID_JOYPAD_MASK - RETRO_DEVICE_ID_JOYPAD_MAX_BUTTONS) #define RARCH_EXTRA_BUTTON_ID(id) (RETRO_DEVICE_ID_JOYPAD_MAX_BUTTONS + (id)) +#define RARCH_EXTRA_TOTAL_BUTTONS (RETRO_DEVICE_ID_JOYPAD_MAX_BUTTONS + RARCH_STATIC_MAX_EXTRA_BUTTON) #define RARCH_EXTRA_BUTTON_ID_END (RARCH_FIRST_META_KEY + RARCH_MAX_EXTRA_BUTTON) diff --git a/input/input_driver.c b/input/input_driver.c index a14ba6fa468f..8baf945baf35 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -121,8 +121,8 @@ const unsigned input_config_bind_order[RETRO_DEVICE_ID_JOYPAD_MAX_BUTTONS] = { /**************************************/ /* TODO/FIXME - turn these into static global variable */ -retro_keybind_set input_config_binds[MAX_USERS]; -retro_keybind_set input_autoconf_binds[MAX_USERS]; +retro_keybind_set input_config_binds[RARCH_EXTRA_TOTAL_BUTTONS]; +retro_keybind_set input_autoconf_binds[RARCH_EXTRA_TOTAL_BUTTONS]; uint64_t lifecycle_state = 0; static void *input_null_init(const char *joypad_driver) { return (void*)-1; } diff --git a/input/input_driver.h b/input/input_driver.h index 0ef51d51bc28..e322a7508f92 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -1122,8 +1122,8 @@ extern hid_driver_t wiiusb_hid; extern hid_driver_t wiiu_hid; #endif /* HAVE_HID */ -extern retro_keybind_set input_config_binds[MAX_USERS]; -extern retro_keybind_set input_autoconf_binds[MAX_USERS]; +extern retro_keybind_set input_config_binds[RARCH_EXTRA_TOTAL_BUTTONS]; +extern retro_keybind_set input_autoconf_binds[RARCH_EXTRA_TOTAL_BUTTONS]; RETRO_END_DECLS diff --git a/input/input_types.h b/input/input_types.h index 301d6d684258..9d7c5c59a29a 100644 --- a/input/input_types.h +++ b/input/input_types.h @@ -55,11 +55,11 @@ struct input_bind_map /* Turbo support. */ struct turbo_buttons { - int32_t turbo_pressed[MAX_USERS]; + int32_t turbo_pressed[RARCH_EXTRA_TOTAL_BUTTONS]; unsigned count; - uint16_t enable[MAX_USERS]; - bool frame_enable[MAX_USERS]; - bool mode1_enable[MAX_USERS]; + uint16_t enable[RARCH_EXTRA_TOTAL_BUTTONS]; + bool frame_enable[RARCH_EXTRA_TOTAL_BUTTONS]; + bool mode1_enable[RARCH_EXTRA_TOTAL_BUTTONS]; }; struct retro_keybind @@ -122,6 +122,8 @@ typedef struct input_game_focus_state extern const struct input_bind_map input_config_bind_map[RARCH_BIND_LIST_END_NULL]; +void rarch_fill_extra_button_input_config_bind_map(void); + typedef struct rarch_joypad_driver input_device_driver_t; typedef struct input_keyboard_line input_keyboard_line_t; typedef struct rarch_joypad_info rarch_joypad_info_t; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a67386661e24..37a10fc8c6a5 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -9290,10 +9290,6 @@ static bool setting_append_list_input_player_options( if (isExtraKey) { logicalIndex = RETRO_DEVICE_ID_JOYPAD_MAX_BUTTONS + (bindIndex - RARCH_BIND_ID_EXTRA_BUTTON_START); - - /* Debug. */ - RARCH_LOG("Reassigned bindIndex %d to logicalIndex %d\n", - bindIndex, logicalIndex); } /* Debug. */ @@ -9317,13 +9313,21 @@ static bool setting_append_list_input_player_options( } } else if (!isExtraKey) + { strlcpy(label + _len, input_config_bind_map_get_desc(logicalIndex), sizeof(label) - _len); + } - /* Not a valid controller key. */ + /* Not a valid controller bind. */ else + { + /* Debug. */ + RARCH_LOG("Invalid controller bind: bind = %d, logical = %d\n", + bindIndex, logicalIndex); + continue; + } snprintf(name, sizeof(name), "p%u_%s", user + 1, input_config_bind_map_get_base(logicalIndex));