mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
start implementing keymapper gui
This commit is contained in:
parent
503658b446
commit
b93417fbed
@ -1567,6 +1567,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_UPDATE_SLANG_SHADERS,
|
||||
"Update Slang Shaders")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_USER,
|
||||
"User")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_KEYBOARD,
|
||||
"Kbd")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_INTERFACE_SETTINGS,
|
||||
"User Interface")
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_USER_LANGUAGE,
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "../../performance_counters.h"
|
||||
#include "../../paths.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../../wifi/wifi_driver.h"
|
||||
|
||||
#ifndef BIND_ACTION_GET_VALUE
|
||||
@ -47,6 +48,8 @@
|
||||
cbs->action_get_value_ident = #name;
|
||||
#endif
|
||||
|
||||
extern struct key_desc key_descriptors[192];
|
||||
|
||||
static void menu_action_setting_disp_set_label_cheat_num_passes(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
@ -485,6 +488,89 @@ static void menu_action_setting_disp_set_label_input_desc(
|
||||
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_input_desc_kbd(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
const char *label,
|
||||
char *s, size_t len,
|
||||
const char *entry_label,
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
RARCH_LOG("%d %s\n", key_descriptors[10].id, key_descriptors[10].desc);
|
||||
char descriptor[255];
|
||||
const struct retro_keybind *auto_bind = NULL;
|
||||
const struct retro_keybind *keybind = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned inp_desc_index_offset =
|
||||
type - MENU_SETTINGS_INPUT_DESC_BEGIN;
|
||||
unsigned inp_desc_user = inp_desc_index_offset /
|
||||
(RARCH_FIRST_CUSTOM_BIND + 4);
|
||||
unsigned inp_desc_button_index_offset = inp_desc_index_offset -
|
||||
(inp_desc_user * (RARCH_FIRST_CUSTOM_BIND + 4));
|
||||
unsigned remap_id = 0;
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
descriptor[0] = '\0';
|
||||
|
||||
remap_id = settings->uints.input_remap_ids
|
||||
[inp_desc_user][inp_desc_button_index_offset];
|
||||
|
||||
keybind = &input_config_binds[inp_desc_user][remap_id];
|
||||
auto_bind = (const struct retro_keybind*)
|
||||
input_config_get_bind_auto(inp_desc_user, remap_id);
|
||||
|
||||
input_config_get_bind_string(descriptor,
|
||||
keybind, auto_bind, sizeof(descriptor));
|
||||
|
||||
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
|
||||
{
|
||||
if(strstr(descriptor, "Auto") && !strstr(descriptor,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)))
|
||||
strlcpy(s,
|
||||
descriptor,
|
||||
len);
|
||||
else
|
||||
{
|
||||
const struct retro_keybind *keyptr = &input_config_binds[inp_desc_user]
|
||||
[remap_id];
|
||||
|
||||
strlcpy(s, msg_hash_to_str(keyptr->enum_idx), len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
const char *str = NULL;
|
||||
switch (remap_id)
|
||||
{
|
||||
case 0:
|
||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_X);
|
||||
break;
|
||||
case 1:
|
||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_LEFT_Y);
|
||||
break;
|
||||
case 2:
|
||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_X);
|
||||
break;
|
||||
case 3:
|
||||
str = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_ANALOG_RIGHT_Y);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!string_is_empty(str))
|
||||
strlcpy(s, str, len);
|
||||
}
|
||||
|
||||
*w = 19;
|
||||
strlcpy(s2, path, len2);
|
||||
}
|
||||
|
||||
|
||||
static void menu_action_setting_disp_set_label_cheat(
|
||||
file_list_t* list,
|
||||
unsigned *w, unsigned type, unsigned i,
|
||||
@ -1726,6 +1812,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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
|
145
menu/menu_cbs.c
145
menu/menu_cbs.c
@ -32,6 +32,151 @@ static void menu_cbs_init_log(const char *entry_label, const char *bind_label, c
|
||||
#endif
|
||||
}
|
||||
|
||||
struct key_desc key_descriptors[192] =
|
||||
{
|
||||
{RETROK_FIRST , 0, "Unmapped"},
|
||||
{RETROK_BACKSPACE , 8, "Backspace"},
|
||||
{RETROK_TAB , 9, "Tab"},
|
||||
{RETROK_CLEAR , 12, "Clear"},
|
||||
{RETROK_RETURN , 13, "Return"},
|
||||
{RETROK_PAUSE , 19, "Pause"},
|
||||
{RETROK_ESCAPE , 27, "Escape"},
|
||||
{RETROK_SPACE , 32, "Space"},
|
||||
{RETROK_EXCLAIM , 33, "!"},
|
||||
{RETROK_QUOTEDBL , 34, "\""},
|
||||
{RETROK_HASH , 35, "#"},
|
||||
{RETROK_DOLLAR , 36, "$"},
|
||||
{RETROK_AMPERSAND , 38, "&"},
|
||||
{RETROK_QUOTE , 39, "\'"},
|
||||
{RETROK_LEFTPAREN , 40, ")"},
|
||||
{RETROK_RIGHTPAREN , 41, ")"},
|
||||
{RETROK_ASTERISK , 42, "*"},
|
||||
{RETROK_PLUS , 43, "+"},
|
||||
{RETROK_COMMA , 44, ","},
|
||||
{RETROK_MINUS , 45, "-"},
|
||||
{RETROK_PERIOD , 46, "."},
|
||||
{RETROK_SLASH , 47, "/"},
|
||||
{RETROK_0 , 48, "0"},
|
||||
{RETROK_1 , 49, "1"},
|
||||
{RETROK_2 , 50, "2"},
|
||||
{RETROK_3 , 51, "3"},
|
||||
{RETROK_4 , 52, "4"},
|
||||
{RETROK_5 , 53, "5"},
|
||||
{RETROK_6 , 54, "6"},
|
||||
{RETROK_7 , 55, "7"},
|
||||
{RETROK_8 , 56, "8"},
|
||||
{RETROK_9 , 57, "9"},
|
||||
{RETROK_COLON , 58, ":"},
|
||||
{RETROK_SEMICOLON , 59, ";"},
|
||||
{RETROK_LESS , 60, "-"},
|
||||
{RETROK_EQUALS , 61, "="},
|
||||
{RETROK_GREATER , 62, ">"},
|
||||
{RETROK_QUESTION , 63, "?"},
|
||||
{RETROK_AT , 64, "@"},
|
||||
{RETROK_LEFTBRACKET , 91, "["},
|
||||
{RETROK_BACKSLASH , 92, "\\"},
|
||||
{RETROK_RIGHTBRACKET , 93, "]"},
|
||||
{RETROK_CARET , 94, "^"},
|
||||
{RETROK_UNDERSCORE , 95, "_"},
|
||||
{RETROK_BACKQUOTE , 96, "`"},
|
||||
{RETROK_a , 97, "a"},
|
||||
{RETROK_b , 98, "b"},
|
||||
{RETROK_c , 99, "c"},
|
||||
{RETROK_d , 100, "d"},
|
||||
{RETROK_e , 101, "e"},
|
||||
{RETROK_f , 102, "f"},
|
||||
{RETROK_g , 103, "g"},
|
||||
{RETROK_h , 104, "h"},
|
||||
{RETROK_i , 105, "i"},
|
||||
{RETROK_j , 106, "j"},
|
||||
{RETROK_k , 107, "k"},
|
||||
{RETROK_l , 108, "l"},
|
||||
{RETROK_m , 109, "m"},
|
||||
{RETROK_n , 110, "n"},
|
||||
{RETROK_o , 111, "o"},
|
||||
{RETROK_p , 112, "p"},
|
||||
{RETROK_q , 113, "q"},
|
||||
{RETROK_r , 114, "r"},
|
||||
{RETROK_s , 115, "s"},
|
||||
{RETROK_t , 116, "t"},
|
||||
{RETROK_u , 117, "u"},
|
||||
{RETROK_v , 118, "v"},
|
||||
{RETROK_w , 119, "w"},
|
||||
{RETROK_x , 120, "x"},
|
||||
{RETROK_y , 121, "y"},
|
||||
{RETROK_z , 122, "z"},
|
||||
{RETROK_DELETE , 127, "Delete"},
|
||||
|
||||
{RETROK_KP0 , 256, "Numpad 0"},
|
||||
{RETROK_KP1 , 257, "Numpad 1"},
|
||||
{RETROK_KP2 , 258, "Numpad 2"},
|
||||
{RETROK_KP3 , 259, "Numpad 3"},
|
||||
{RETROK_KP4 , 260, "Numpad 4"},
|
||||
{RETROK_KP5 , 261, "Numpad 5"},
|
||||
{RETROK_KP6 , 262, "Numpad 6"},
|
||||
{RETROK_KP7 , 263, "Numpad 7"},
|
||||
{RETROK_KP8 , 264, "Numpad 8"},
|
||||
{RETROK_KP9 , 265, "Numpad 9"},
|
||||
{RETROK_KP_PERIOD , 266, "Numpad ."},
|
||||
{RETROK_KP_DIVIDE , 267, "Numpad /"},
|
||||
{RETROK_KP_MULTIPLY , 268, "Numpad *"},
|
||||
{RETROK_KP_MINUS , 269, "Numpad -"},
|
||||
{RETROK_KP_PLUS , 270, "Numpad +"},
|
||||
{RETROK_KP_ENTER , 271, "Numpad Enter"},
|
||||
{RETROK_KP_EQUALS , 272, "Numpad ="},
|
||||
|
||||
{RETROK_UP , 273, "Up"},
|
||||
{RETROK_DOWN , 274, "Down"},
|
||||
{RETROK_RIGHT , 275, "Right"},
|
||||
{RETROK_LEFT , 276, "Left"},
|
||||
{RETROK_INSERT , 277, "Insert"},
|
||||
{RETROK_HOME , 278, "Home"},
|
||||
{RETROK_END , 279, "End"},
|
||||
{RETROK_PAGEUP , 280, "Page Up"},
|
||||
{RETROK_PAGEDOWN , 281, "Page Down"},
|
||||
|
||||
{RETROK_F1 , 282, "F1"},
|
||||
{RETROK_F2 , 283, "F2"},
|
||||
{RETROK_F3 , 284, "F3"},
|
||||
{RETROK_F4 , 285, "F4"},
|
||||
{RETROK_F5 , 286, "F5"},
|
||||
{RETROK_F6 , 287, "F6"},
|
||||
{RETROK_F7 , 288, "F7"},
|
||||
{RETROK_F8 , 289, "F8"},
|
||||
{RETROK_F9 , 290, "F9"},
|
||||
{RETROK_F10 , 291, "F10"},
|
||||
{RETROK_F11 , 292, "F11"},
|
||||
{RETROK_F12 , 293, "F12"},
|
||||
{RETROK_F13 , 294, "F13"},
|
||||
{RETROK_F14 , 295, "F14"},
|
||||
{RETROK_F15 , 296, "F15"},
|
||||
|
||||
{RETROK_NUMLOCK , 300, "Num Lock"},
|
||||
{RETROK_CAPSLOCK , 301, "Caps Lock"},
|
||||
{RETROK_SCROLLOCK , 302, "Scroll Lock"},
|
||||
{RETROK_RSHIFT , 303, "Right Shift"},
|
||||
{RETROK_LSHIFT , 304, "Left Shift"},
|
||||
{RETROK_RCTRL , 305, "Right Control"},
|
||||
{RETROK_LCTRL , 306, "Left Control"},
|
||||
{RETROK_RALT , 307, "Right Alt"},
|
||||
{RETROK_LALT , 308, "Left Alt"},
|
||||
{RETROK_RMETA , 309, "Right Meta"},
|
||||
{RETROK_LMETA , 310, "Left Meta"},
|
||||
{RETROK_LSUPER , 311, "Right Super"},
|
||||
{RETROK_RSUPER , 312, "Left Super"},
|
||||
{RETROK_MODE , 313, "Mode"},
|
||||
{RETROK_COMPOSE , 314, "Compose"},
|
||||
|
||||
{RETROK_HELP , 315, "Help"},
|
||||
{RETROK_PRINT , 316, "Print"},
|
||||
{RETROK_SYSREQ , 317, "Sys Req"},
|
||||
{RETROK_BREAK , 318, "Break"},
|
||||
{RETROK_MENU , 319, "Menu"},
|
||||
{RETROK_POWER , 320, "Power"},
|
||||
{RETROK_EURO , 321, "€"},
|
||||
{RETROK_UNDO , 322, "Undo"}
|
||||
};
|
||||
|
||||
/* This sets up all the callback functions for a menu entry.
|
||||
*
|
||||
* OK : When we press the 'OK' button on an entry.
|
||||
|
@ -27,6 +27,16 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
typedef struct key_desc
|
||||
{
|
||||
/* key id */
|
||||
unsigned id;
|
||||
/* libretro key id */
|
||||
unsigned key;
|
||||
/* description */
|
||||
char desc[32];
|
||||
} key_desc_t;
|
||||
|
||||
enum
|
||||
{
|
||||
ACTION_OK_DL_DEFAULT = 0,
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include "../configuration.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../defaults.h"
|
||||
#include "../verbosity.h"
|
||||
#include "../managers/cheat_manager.h"
|
||||
#include "../managers/core_option_manager.h"
|
||||
#include "../paths.h"
|
||||
@ -3503,6 +3504,25 @@ static int menu_displaylist_parse_options_remappings(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (system)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
|
||||
{
|
||||
char desc_label[64];
|
||||
unsigned user = settings->uints.keyboard_mapper_port + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
const char *description = NULL;
|
||||
|
||||
desc_label[0] = '\0';
|
||||
|
||||
snprintf(desc_label, sizeof(desc_label),
|
||||
"%s: ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B + retro_id));
|
||||
menu_entries_append_enum(info->list, desc_label, "",
|
||||
MSG_UNKNOWN,
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -206,6 +206,8 @@ enum menu_settings_type
|
||||
MENU_SETTINGS_CHEAT_END = MENU_SETTINGS_CHEAT_BEGIN + (MAX_CHEAT_COUNTERS - 1),
|
||||
MENU_SETTINGS_INPUT_DESC_BEGIN,
|
||||
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * (RARCH_FIRST_CUSTOM_BIND + 4)),
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_END = MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + 191,
|
||||
MENU_SETTINGS_LAST
|
||||
};
|
||||
|
||||
|
@ -927,6 +927,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_NEAREST,
|
||||
MENU_ENUM_LABEL_VALUE_UNKNOWN,
|
||||
MENU_ENUM_LABEL_VALUE_USER,
|
||||
MENU_ENUM_LABEL_VALUE_KEYBOARD,
|
||||
MENU_ENUM_LABEL_VALUE_CHEAT,
|
||||
MENU_ENUM_LABEL_VALUE_SHADER,
|
||||
MENU_ENUM_LABEL_VALUE_DIRECTORY_CONTENT,
|
||||
|
Loading…
Reference in New Issue
Block a user