mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 12:39:54 +00:00
commit
be1bca4ce4
250
.vscode/c_cpp_properties.json
vendored
250
.vscode/c_cpp_properties.json
vendored
@ -1,125 +1,127 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"macFrameworkPath": [
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw32",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw64",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 3
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"macFrameworkPath": [
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [],
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
"includePath": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/um",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/ucrt",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/shared",
|
||||
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.15063.0/winrt",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
},
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw32",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw32/include",
|
||||
"C:/msys64/mingw32/i686-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw64",
|
||||
"includePath": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
"_DEBUG",
|
||||
"UNICODE"
|
||||
],
|
||||
"intelliSenseMode": "msvc-x64",
|
||||
"browse": {
|
||||
"path": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"${workspaceRoot}/libretro-common/include",
|
||||
"${workspaceRoot}/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
"databaseFilename": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"version": 3
|
||||
}
|
43
.vscode/launch.json
vendored
43
.vscode/launch.json
vendored
@ -5,44 +5,41 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "msys2-mingw64 debug",
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/retroarch.exe",
|
||||
"args": [],
|
||||
"args": ["-v"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "msys2-mingw32 debug",
|
||||
{
|
||||
"name": "(gdb) Attach",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"request": "attach",
|
||||
"program": "${workspaceFolder}/retroarch.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"processId": "${command:pickProcess}",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw32\\bin\\gdb.exe",
|
||||
"miDebuggerPath": "c:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
}
|
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -14,4 +14,5 @@
|
||||
"*.in": "c",
|
||||
"*.rh": "c"
|
||||
},
|
||||
"C_Cpp.dimInactiveRegions": false,
|
||||
}
|
@ -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 \
|
||||
|
@ -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
|
||||
|
||||
|
@ -16,7 +16,7 @@ DEFINES :=
|
||||
ifeq ($(GRIFFIN_BUILD), 1)
|
||||
OBJ += griffin/griffin.o
|
||||
DEFINES += -DHAVE_GRIFFIN=1
|
||||
DEFINES += -DHAVE_NEON -DHAVE_MENU -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB
|
||||
DEFINES += -DHAVE_NEON -DHAVE_MENU -DHAVE_XMB -DHAVE_MATERIALUI -DHAVE_LIBRETRODB DEFINES -DHAVE_KEYMAPPER
|
||||
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
|
||||
ifeq ($(DEBUG), 1)
|
||||
DEFINES += -DHAVE_NETLOGGER
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -379,7 +379,7 @@ typedef struct settings
|
||||
unsigned input_libretro_device[MAX_USERS];
|
||||
unsigned input_analog_dpad_mode[MAX_USERS];
|
||||
|
||||
unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END];
|
||||
unsigned input_keymapper_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
|
||||
|
||||
unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END];
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -28,11 +28,15 @@ RETRO_BEGIN_DECLS
|
||||
|
||||
#define MAX_INPUT_DEVICES 16
|
||||
|
||||
#define RARCH_MAX_KEYS 136
|
||||
|
||||
#define RARCH_FIRST_CUSTOM_BIND 16
|
||||
#define RARCH_FIRST_LIGHTGUN_BIND RARCH_ANALOG_BIND_LIST_END
|
||||
#define RARCH_FIRST_MISC_CUSTOM_BIND RARCH_LIGHTGUN_BIND_LIST_END
|
||||
#define RARCH_FIRST_META_KEY RARCH_CUSTOM_BIND_LIST_END
|
||||
|
||||
#define RARCH_UNMAPPED 1024
|
||||
|
||||
/* RetroArch specific bind IDs. */
|
||||
enum
|
||||
{
|
||||
|
@ -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;
|
||||
@ -579,6 +575,8 @@ void input_poll(void)
|
||||
if (input_driver_block_libretro_input)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < max_users; i++)
|
||||
{
|
||||
if (libretro_input_binds[i][RARCH_TURBO_ENABLE].valid)
|
||||
@ -603,6 +601,9 @@ void input_poll(void)
|
||||
input_driver_axis_threshold);
|
||||
#endif
|
||||
|
||||
if (settings->bools.input_remap_binds_enable && input_driver_mapper)
|
||||
input_mapper_poll(input_driver_mapper);
|
||||
|
||||
#ifdef HAVE_COMMAND
|
||||
if (input_driver_command)
|
||||
command_poll(input_driver_command);
|
||||
@ -612,11 +613,6 @@ void input_poll(void)
|
||||
if (input_driver_remote)
|
||||
input_remote_poll(input_driver_remote, max_users);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KEYMAPPER
|
||||
if (input_driver_mapper)
|
||||
input_mapper_poll(input_driver_mapper);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -634,7 +630,11 @@ void input_poll(void)
|
||||
int16_t input_state(unsigned port, unsigned device,
|
||||
unsigned idx, unsigned id)
|
||||
{
|
||||
int16_t res = 0;
|
||||
int16_t res = 0;
|
||||
|
||||
/* used to reset input state of a button when the gamepad mapper
|
||||
is in action for that button*/
|
||||
bool reset_state = false;
|
||||
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
@ -657,17 +657,35 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (id < RARCH_FIRST_CUSTOM_BIND)
|
||||
id = settings->uints.input_remap_ids[port][id];
|
||||
if (id != settings->uints.input_remap_ids[port][id])
|
||||
reset_state = true;
|
||||
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
if (idx < 2 && id < 2)
|
||||
{
|
||||
unsigned new_id = RARCH_FIRST_CUSTOM_BIND + (idx * 2 + id);
|
||||
|
||||
new_id = settings->uints.input_remap_ids[port][new_id];
|
||||
idx = (new_id & 2) >> 1;
|
||||
id = new_id & 1;
|
||||
if (idx == 0)
|
||||
{
|
||||
if (id == 0 && settings->uints.input_remap_ids[port][16] != 16)
|
||||
reset_state = true;
|
||||
if (id == 0 && settings->uints.input_remap_ids[port][17] != 17)
|
||||
reset_state = true;
|
||||
if (id == 1 && settings->uints.input_remap_ids[port][18] != 18)
|
||||
reset_state = true;
|
||||
if (id == 1 && settings->uints.input_remap_ids[port][19] != 19)
|
||||
reset_state = true;
|
||||
}
|
||||
if (idx == 1)
|
||||
{
|
||||
if (id == 0 && settings->uints.input_remap_ids[port][20] != 20)
|
||||
reset_state = true;
|
||||
if (id == 0 && settings->uints.input_remap_ids[port][21] != 21)
|
||||
reset_state = true;
|
||||
if (id == 1 && settings->uints.input_remap_ids[port][22] != 22)
|
||||
reset_state = true;
|
||||
if (id == 1 && settings->uints.input_remap_ids[port][23] != 23)
|
||||
reset_state = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -680,16 +698,22 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
if (bind_valid || device == RETRO_DEVICE_KEYBOARD)
|
||||
{
|
||||
rarch_joypad_info_t joypad_info;
|
||||
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
|
||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||
|
||||
res = current_input->input_state(
|
||||
current_input_data, joypad_info, libretro_input_binds, port, device, idx, id);
|
||||
if (!reset_state)
|
||||
res = current_input->input_state(
|
||||
current_input_data, joypad_info, libretro_input_binds, port, device, idx, id);
|
||||
else
|
||||
res = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->bools.input_remap_binds_enable && input_driver_mapper)
|
||||
input_mapper_state(input_driver_mapper,
|
||||
&res, port, device, idx, id);
|
||||
|
||||
#ifdef HAVE_OVERLAY
|
||||
if (overlay_ptr)
|
||||
input_state_overlay(overlay_ptr, &res, port, device, idx, id);
|
||||
@ -700,12 +724,6 @@ int16_t input_state(unsigned port, unsigned device,
|
||||
input_remote_state(&res, port, device, idx, id);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KEYMAPPER
|
||||
if (input_driver_mapper)
|
||||
input_mapper_state(input_driver_mapper,
|
||||
&res, port, device, idx, id);
|
||||
#endif
|
||||
|
||||
/* Don't allow turbo for D-pad. */
|
||||
if (device == RETRO_DEVICE_JOYPAD && (id < RETRO_DEVICE_ID_JOYPAD_UP ||
|
||||
id > RETRO_DEVICE_ID_JOYPAD_RIGHT))
|
||||
@ -1125,6 +1143,59 @@ void input_keys_pressed(void *data, retro_bits_t* p_new_state)
|
||||
}
|
||||
}
|
||||
|
||||
void input_get_state_for_port(void *data, unsigned port, retro_bits_t* p_new_state)
|
||||
{
|
||||
unsigned i, j;
|
||||
int16_t val;
|
||||
rarch_joypad_info_t joypad_info;
|
||||
settings_t *settings = (settings_t*)data;
|
||||
BIT256_CLEAR_ALL_PTR(p_new_state);
|
||||
|
||||
joypad_info.joy_idx = settings->uints.input_joypad_map[port];
|
||||
joypad_info.auto_binds = input_autoconf_binds[joypad_info.joy_idx];
|
||||
joypad_info.axis_threshold = input_driver_axis_threshold;
|
||||
|
||||
for (i = 0; i < RARCH_FIRST_CUSTOM_BIND; i++)
|
||||
{
|
||||
bool bit_pressed = false;
|
||||
|
||||
if (input_driver_input_state(joypad_info, libretro_input_binds, port, RETRO_DEVICE_JOYPAD, 0, i) != 0)
|
||||
bit_pressed = true;
|
||||
|
||||
if (bit_pressed)
|
||||
BIT256_SET_PTR(p_new_state, i);
|
||||
}
|
||||
|
||||
/* left-stick x */
|
||||
val = input_joypad_analog(input_driver_get_joypad_driver(), joypad_info, port, 0, 0, libretro_input_binds[port]);
|
||||
if (val >= 0)
|
||||
p_new_state->analogs[0] = val;
|
||||
else
|
||||
p_new_state->analogs[1] = val;
|
||||
|
||||
/* left-stick y */
|
||||
val = input_joypad_analog(input_driver_get_joypad_driver(), joypad_info, port, 0, 1, libretro_input_binds[port]);
|
||||
if (val >= 0)
|
||||
p_new_state->analogs[2] = val;
|
||||
else
|
||||
p_new_state->analogs[3] = val;
|
||||
|
||||
/* right-stick x */
|
||||
val = input_joypad_analog(input_driver_get_joypad_driver(), joypad_info, port, 1, 0, libretro_input_binds[port]);
|
||||
if (val >= 0)
|
||||
p_new_state->analogs[4] = val;
|
||||
else
|
||||
p_new_state->analogs[5] = val;
|
||||
|
||||
/* right-stick y */
|
||||
val = input_joypad_analog(input_driver_get_joypad_driver(), joypad_info, port, 1, 1, libretro_input_binds[port]);
|
||||
if (val >= 0)
|
||||
p_new_state->analogs[6] = val;
|
||||
else
|
||||
p_new_state->analogs[7] = val;
|
||||
|
||||
}
|
||||
|
||||
void *input_driver_get_data(void)
|
||||
{
|
||||
return current_input_data;
|
||||
@ -1343,11 +1414,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)
|
||||
@ -1372,20 +1441,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;
|
||||
}
|
||||
|
||||
|
@ -343,6 +343,8 @@ void input_menu_keys_pressed(void *data, retro_bits_t* new_state);
|
||||
|
||||
void *input_driver_get_data(void);
|
||||
|
||||
void input_get_state_for_port(void *data, unsigned port, retro_bits_t* p_new_state);
|
||||
|
||||
const input_driver_t *input_get_ptr(void);
|
||||
|
||||
void *input_get_data(void);
|
||||
|
@ -50,17 +50,15 @@
|
||||
|
||||
struct input_mapper
|
||||
{
|
||||
/* The controller port that will be polled*/
|
||||
uint8_t port;
|
||||
/* Left X, Left Y, Right X, Right Y */
|
||||
int16_t analog[4];
|
||||
int16_t analog_value[MAX_USERS][8];
|
||||
/* the whole keyboard state */
|
||||
uint32_t keys[RETROK_LAST / 32 + 1];
|
||||
/* This is a bitmask of (1 << key_bind_id). */
|
||||
uint64_t buttons;
|
||||
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));
|
||||
@ -68,8 +66,6 @@ input_mapper_t *input_mapper_new(uint16_t port)
|
||||
if (!handle)
|
||||
return NULL;
|
||||
|
||||
handle->port = port;
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
@ -80,20 +76,26 @@ void input_mapper_free(input_mapper_t *handle)
|
||||
free (handle);
|
||||
}
|
||||
|
||||
bool input_mapper_button_pressed(input_mapper_t *handle, unsigned port, unsigned id)
|
||||
{
|
||||
return BIT256_GET(handle->buttons[port], id);
|
||||
}
|
||||
|
||||
void input_mapper_poll(input_mapper_t *handle)
|
||||
{
|
||||
int i;
|
||||
int i, j, k;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned device = settings->uints.input_libretro_device[handle->port];
|
||||
retro_bits_t current_input;
|
||||
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
||||
unsigned device = 0;
|
||||
unsigned current_button_value;
|
||||
int16_t current_axis_value;
|
||||
unsigned remap_button, remap_axis;
|
||||
bool key_event[RARCH_CUSTOM_BIND_LIST_END];
|
||||
#ifdef HAVE_MENU
|
||||
bool menu_is_alive = menu_driver_is_alive();
|
||||
#endif
|
||||
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
/* for now we only handle keyboard inputs */
|
||||
if (device != RETRO_DEVICE_KEYBOARD)
|
||||
return;
|
||||
#ifdef HAVE_MENU
|
||||
if (menu_is_alive)
|
||||
return;
|
||||
@ -101,22 +103,106 @@ void input_mapper_poll(input_mapper_t *handle)
|
||||
|
||||
memset(handle->keys, 0, sizeof(handle->keys));
|
||||
|
||||
for (i = 0; i < RARCH_CUSTOM_BIND_LIST_END; i++)
|
||||
for (i = 0; i < max_users; i++)
|
||||
{
|
||||
if (i < RETROK_LAST)
|
||||
device = settings->uints.input_libretro_device[i];
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
/* keyboard to gamepad remapping */
|
||||
if (device == RETRO_DEVICE_KEYBOARD)
|
||||
{
|
||||
if (input_state(handle->port, RETRO_DEVICE_JOYPAD, 0, i))
|
||||
input_get_state_for_port(settings, i, ¤t_input);
|
||||
for (j = 0; j < RARCH_CUSTOM_BIND_LIST_END; j++)
|
||||
{
|
||||
MAPPER_SET_KEY (handle,
|
||||
settings->uints.input_keymapper_ids[i]);
|
||||
input_keyboard_event(true,
|
||||
settings->uints.input_keymapper_ids[i],
|
||||
0, 0, RETRO_DEVICE_KEYBOARD);
|
||||
{
|
||||
current_button_value = BIT256_GET(current_input, j);
|
||||
remap_button = settings->uints.input_keymapper_ids[i][j];
|
||||
if (current_button_value == 1 && j != remap_button &&
|
||||
remap_button != RETROK_UNKNOWN)
|
||||
{
|
||||
MAPPER_SET_KEY (handle,
|
||||
remap_button);
|
||||
input_keyboard_event(true,
|
||||
remap_button,
|
||||
0, 0, RETRO_DEVICE_KEYBOARD);
|
||||
key_event[j] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key_event[j] == false &&
|
||||
remap_button != RETROK_UNKNOWN)
|
||||
{
|
||||
input_keyboard_event(false,
|
||||
remap_button,
|
||||
0, 0, RETRO_DEVICE_KEYBOARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
mapper input bitmap, later on the original input is cleared in input_state */
|
||||
BIT256_CLEAR_ALL(handle->buttons[i]);
|
||||
for (j = 0; j < 8; j++)
|
||||
handle->analog_value[i][j] = 0;
|
||||
|
||||
input_get_state_for_port(settings, i, ¤t_input);
|
||||
|
||||
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++)
|
||||
{
|
||||
current_button_value = BIT256_GET(current_input, j);
|
||||
remap_button = settings->uints.input_remap_ids[i][j];
|
||||
if (current_button_value == 1 && j != remap_button &&
|
||||
remap_button != RARCH_UNMAPPED && remap_button < RARCH_FIRST_CUSTOM_BIND)
|
||||
BIT256_SET(handle->buttons[i], remap_button);
|
||||
else if (current_button_value == 1 && j != remap_button &&
|
||||
remap_button != RARCH_UNMAPPED && remap_button >= RARCH_FIRST_CUSTOM_BIND)
|
||||
{
|
||||
int invert = 1;
|
||||
|
||||
if (remap_button % 2 != 0)
|
||||
invert = -1;
|
||||
|
||||
handle->analog_value[i][remap_button - RARCH_FIRST_CUSTOM_BIND] = 32767 * invert;
|
||||
/* RARCH_LOG("axis %d(%d) remapped to axis %d val %d\n", j, k,
|
||||
remap_button - RARCH_FIRST_CUSTOM_BIND, current_axis_value); */
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
k = j + RARCH_FIRST_CUSTOM_BIND;
|
||||
|
||||
current_axis_value = current_input.analogs[j];
|
||||
remap_axis = settings->uints.input_remap_ids[i][k];
|
||||
|
||||
if (current_axis_value != 0 && k != remap_axis && remap_axis != RARCH_UNMAPPED)
|
||||
{
|
||||
if (remap_axis < RARCH_FIRST_CUSTOM_BIND)
|
||||
{
|
||||
BIT256_SET(handle->buttons[i], remap_axis);
|
||||
/* RARCH_LOG("axis %d remapped to button %d val %d\n", j,
|
||||
remap_axis, current_axis_value); */
|
||||
}
|
||||
else
|
||||
{
|
||||
int invert = 1;
|
||||
|
||||
if ((k % 2 == 0 && remap_axis % 2 != 0) || (k % 2 != 0 && remap_axis % 2 == 0))
|
||||
invert = -1;
|
||||
|
||||
handle->analog_value[i][remap_axis - RARCH_FIRST_CUSTOM_BIND] = current_axis_value * invert;
|
||||
/* RARCH_LOG("axis %d(%d) remapped to axis %d val %d\n", j, k,
|
||||
remap_axis - RARCH_FIRST_CUSTOM_BIND, current_axis_value); */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
input_keyboard_event(false,
|
||||
settings->uints.input_keymapper_ids[i],
|
||||
0, 0, RETRO_DEVICE_KEYBOARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -134,17 +220,72 @@ void input_mapper_state(
|
||||
|
||||
switch (device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
if (input_mapper_button_pressed(handle, port, id))
|
||||
*ret = 1;
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
{
|
||||
int val = 0;
|
||||
if (idx == 0)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
if (handle->analog_value[port][0])
|
||||
val = handle->analog_value[port][0];
|
||||
else if (handle->analog_value[port][1])
|
||||
val = handle->analog_value[port][1];
|
||||
|
||||
if(handle->analog_value[port][0] || handle->analog_value[port][1])
|
||||
{
|
||||
*ret |= val;
|
||||
}
|
||||
}
|
||||
if (id == 1)
|
||||
{
|
||||
if (handle->analog_value[port][2])
|
||||
val = handle->analog_value[port][2];
|
||||
else if (handle->analog_value[port][3])
|
||||
val = handle->analog_value[port][3];
|
||||
|
||||
if(handle->analog_value[port][2] || handle->analog_value[port][3])
|
||||
{
|
||||
*ret |= val;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (idx == 1)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
if (handle->analog_value[port][4])
|
||||
val = handle->analog_value[port][4];
|
||||
else if (handle->analog_value[port][5])
|
||||
val = handle->analog_value[port][5];
|
||||
|
||||
if(handle->analog_value[port][4] || handle->analog_value[port][5])
|
||||
{
|
||||
*ret |= val;
|
||||
}
|
||||
}
|
||||
if (id == 1)
|
||||
{
|
||||
if (handle->analog_value[port][6])
|
||||
val = handle->analog_value[port][6];
|
||||
else if (handle->analog_value[port][7])
|
||||
val = handle->analog_value[port][7];
|
||||
|
||||
if(handle->analog_value[port][6] || handle->analog_value[port][7])
|
||||
{
|
||||
*ret |= val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RETRO_DEVICE_KEYBOARD:
|
||||
if (id < RETROK_LAST)
|
||||
{
|
||||
/*
|
||||
RARCH_LOG("State: UDLR %u %u %u %u\n",
|
||||
MAPPER_GET_KEY(handle, RETROK_UP),
|
||||
MAPPER_GET_KEY(handle, RETROK_DOWN),
|
||||
MAPPER_GET_KEY(handle, RETROK_LEFT),
|
||||
MAPPER_GET_KEY(handle, RETROK_RIGHT)
|
||||
);*/
|
||||
|
||||
if (MAPPER_GET_KEY(handle, id))
|
||||
*ret |= 1;
|
||||
}
|
||||
@ -152,4 +293,5 @@ void input_mapper_state(
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -31,13 +31,13 @@ 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);
|
||||
|
||||
void input_mapper_poll(input_mapper_t *handle);
|
||||
|
||||
bool input_mapper_key_pressed(int key);
|
||||
bool input_mapper_key_pressed(input_mapper_t *handle, int key);
|
||||
|
||||
void input_mapper_state(
|
||||
input_mapper_t *handle,
|
||||
|
@ -53,69 +53,77 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
|
||||
for (i = 0; i < MAX_USERS; i++)
|
||||
{
|
||||
char s1[64], s2[64];
|
||||
char s1[64], s2[64], s3[64];
|
||||
char btn_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
char keymapper_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] =
|
||||
{ "b", "y", "select", "start",
|
||||
char stk_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
|
||||
bool ret = false;
|
||||
|
||||
char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][128] = {
|
||||
"b", "y", "select", "start",
|
||||
"up", "down", "left", "right",
|
||||
"a", "x", "l", "r", "l2", "r2",
|
||||
"l3", "r3", "l_x", "l_y", "r_x", "r_y" };
|
||||
"l3", "r3", "l_x+", "l_x-", "l_y+", "l_y-", "r_x+", "r_x-", "r_y+", "r_y-" };
|
||||
|
||||
old_analog_dpad_mode[i] = settings->uints.input_analog_dpad_mode[i];
|
||||
old_libretro_device[i] = settings->uints.input_libretro_device[i];
|
||||
|
||||
s1[0] = '\0';
|
||||
s2[0] = '\0';
|
||||
s3[0] = '\0';
|
||||
|
||||
snprintf(s1, sizeof(s1), "input_player%u", i + 1);
|
||||
snprintf(s1, sizeof(s1), "input_player%u_btn", i + 1);
|
||||
snprintf(s2, sizeof(s2), "input_player%u_key", i + 1);
|
||||
snprintf(s3, sizeof(s3), "input_player%u_stk", i + 1);
|
||||
|
||||
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 4; j++)
|
||||
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND; j++)
|
||||
{
|
||||
int btn_remap = -1;
|
||||
|
||||
fill_pathname_join_delim(btn_ident[j], s1,
|
||||
key_strings[j], '_', sizeof(btn_ident[j]));
|
||||
fill_pathname_join_delim(key_ident[j], s2,
|
||||
key_strings[j], '_', sizeof(btn_ident[j]));
|
||||
|
||||
if (config_get_int(conf, btn_ident[j], &btn_remap)
|
||||
&& btn_remap != -1)
|
||||
settings->uints.input_remap_ids[i][j] = btn_remap;
|
||||
else if (config_get_int(conf, btn_ident[j], &btn_remap)
|
||||
&& btn_remap == -1)
|
||||
settings->uints.input_remap_ids[i][j] = RARCH_UNMAPPED;
|
||||
/* else do nothing, important */
|
||||
|
||||
int key_remap = -1;
|
||||
|
||||
fill_pathname_join_delim(key_ident[j], s1,
|
||||
key_strings[j], '_', sizeof(key_ident[j]));
|
||||
fill_pathname_join_delim(keymapper_ident[j], s2,
|
||||
key_strings[j], '_', sizeof(key_ident[j]));
|
||||
|
||||
if (config_get_int(conf, key_ident[j], &key_remap)
|
||||
&& key_remap < RARCH_FIRST_CUSTOM_BIND)
|
||||
settings->uints.input_remap_ids[i][j] = key_remap;
|
||||
|
||||
key_remap = -1;
|
||||
|
||||
if (settings->uints.keymapper_port == i)
|
||||
{
|
||||
if (config_get_int(conf, keymapper_ident[j], &key_remap))
|
||||
{
|
||||
settings->uints.input_keymapper_ids[j] = key_remap;
|
||||
#if 0
|
||||
RARCH_LOG ("%s: %u\n", keymapper_ident[j], settings->uints.input_keymapper_ids[j]);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
settings->uints.input_keymapper_ids[j] = RETROK_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
if (config_get_int(conf, key_ident[j], &key_remap))
|
||||
settings->uints.input_keymapper_ids[i][j] = key_remap;
|
||||
else
|
||||
settings->uints.input_keymapper_ids[i][j] = RETROK_UNKNOWN;
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
for (j = RARCH_FIRST_CUSTOM_BIND; j < RARCH_FIRST_CUSTOM_BIND + 8; j++)
|
||||
{
|
||||
int key_remap = -1;
|
||||
int stk_remap = -1;
|
||||
|
||||
snprintf(key_ident[RARCH_FIRST_CUSTOM_BIND + j],
|
||||
sizeof(key_ident[RARCH_FIRST_CUSTOM_BIND + j]),
|
||||
fill_pathname_join_delim(stk_ident[j], s3,
|
||||
key_strings[j], '$', sizeof(stk_ident[j]));
|
||||
|
||||
snprintf(stk_ident[j],
|
||||
sizeof(stk_ident[j]),
|
||||
"%s_%s",
|
||||
s1,
|
||||
key_strings[RARCH_FIRST_CUSTOM_BIND + j]);
|
||||
s3,
|
||||
key_strings[j]);
|
||||
|
||||
if (config_get_int(conf, key_ident[RARCH_FIRST_CUSTOM_BIND + j],
|
||||
&key_remap) && (key_remap < 4))
|
||||
settings->uints.input_remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] =
|
||||
key_remap;
|
||||
RARCH_LOG("pre_ident: %s:%d\n", stk_ident[j], settings->uints.input_remap_ids[i][j]);
|
||||
|
||||
if (config_get_int(conf, stk_ident[j], &stk_remap) && stk_remap != -1)
|
||||
settings->uints.input_remap_ids[i][j] = stk_remap;
|
||||
else if (config_get_int(conf, stk_ident[j], &stk_remap) && stk_remap == -1)
|
||||
settings->uints.input_remap_ids[i][j] = RARCH_UNMAPPED;
|
||||
/* else do nothing, important */
|
||||
|
||||
/*RARCH_LOG("stk_ident: %s:%d\n", stk_ident[j], settings->uints.input_remap_ids[i][j]);*/
|
||||
}
|
||||
|
||||
snprintf(s1, sizeof(s1), "input_player%u_analog_dpad_mode", i + 1);
|
||||
@ -172,46 +180,62 @@ bool input_remapping_save_file(const char *path)
|
||||
|
||||
for (i = 0; i < max_users; i++)
|
||||
{
|
||||
char s1[64], s2[64];
|
||||
char s1[64], s2[64], s3[64];
|
||||
char btn_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
char key_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
char keymapper_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
char key_strings[RARCH_FIRST_CUSTOM_BIND + 4][128] = {
|
||||
char stk_ident[RARCH_FIRST_CUSTOM_BIND + 4][128] = {{0}};
|
||||
|
||||
char key_strings[RARCH_FIRST_CUSTOM_BIND + 8][128] = {
|
||||
"b", "y", "select", "start",
|
||||
"up", "down", "left", "right",
|
||||
"a", "x", "l", "r", "l2", "r2",
|
||||
"l3", "r3", "l_x", "l_y", "r_x", "r_y" };
|
||||
"l3", "r3", "l_x+", "l_x-", "l_y+", "l_y-", "r_x+", "r_x-", "r_y+", "r_y-" };
|
||||
|
||||
s1[0] = '\0';
|
||||
s2[0] = '\0';
|
||||
|
||||
snprintf(s1, sizeof(s1), "input_player%u", i + 1);
|
||||
snprintf(s1, sizeof(s1), "input_player%u_btn", i + 1);
|
||||
snprintf(s2, sizeof(s2), "input_player%u_key", i + 1);
|
||||
snprintf(s3, sizeof(s1), "input_player%u_stk", i + 1);
|
||||
|
||||
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 4; j++)
|
||||
for (j = 0; j < RARCH_FIRST_CUSTOM_BIND + 8; j++)
|
||||
{
|
||||
fill_pathname_join_delim(key_ident[j], s1,
|
||||
key_strings[j], '_', sizeof(key_ident[j]));
|
||||
fill_pathname_join_delim(keymapper_ident[j], s2,
|
||||
key_strings[j], '_', sizeof(key_ident[j]));
|
||||
fill_pathname_join_delim(btn_ident[j], s1,
|
||||
key_strings[j], '_', sizeof(btn_ident[j]));
|
||||
fill_pathname_join_delim(key_ident[j], s2,
|
||||
key_strings[j], '_', sizeof(btn_ident[j]));
|
||||
|
||||
/* only save values that have been modified */
|
||||
if(j < RARCH_FIRST_CUSTOM_BIND)
|
||||
{
|
||||
if(settings->uints.input_remap_ids[i][j] != j)
|
||||
config_set_int(conf, key_ident[j], settings->uints.input_remap_ids[i][j]);
|
||||
if(settings->uints.input_remap_ids[i][j] != j &&
|
||||
settings->uints.input_remap_ids[i][j] != RARCH_UNMAPPED)
|
||||
config_set_int(conf, btn_ident[j], settings->uints.input_remap_ids[i][j]);
|
||||
else if (settings->uints.input_remap_ids[i][j] != j &&
|
||||
settings->uints.input_remap_ids[i][j] == RARCH_UNMAPPED)
|
||||
config_set_int(conf, btn_ident[j], -1);
|
||||
else
|
||||
config_unset(conf,key_ident[j]);
|
||||
config_unset(conf,btn_ident[j]);
|
||||
|
||||
if (settings->uints.input_keymapper_ids[i][j] != RETROK_UNKNOWN)
|
||||
config_set_int(conf, key_ident[j],
|
||||
settings->uints.input_keymapper_ids[i][j]);
|
||||
|
||||
if (settings->uints.keymapper_port == i &&
|
||||
settings->uints.input_keymapper_ids[j] != RETROK_UNKNOWN)
|
||||
config_set_int(conf, keymapper_ident[j], settings->uints.input_keymapper_ids[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(settings->uints.input_remap_ids[i][j] != j - RARCH_FIRST_CUSTOM_BIND)
|
||||
config_set_int(conf, key_ident[j], settings->uints.input_remap_ids[i][j]);
|
||||
fill_pathname_join_delim(stk_ident[j], s3,
|
||||
key_strings[j], '_', sizeof(stk_ident[j]));
|
||||
if(settings->uints.input_remap_ids[i][j] != j &&
|
||||
settings->uints.input_remap_ids[i][j] != RARCH_UNMAPPED)
|
||||
config_set_int(conf, stk_ident[j],
|
||||
settings->uints.input_remap_ids[i][j]);
|
||||
else if(settings->uints.input_remap_ids[i][j] != j &&
|
||||
settings->uints.input_remap_ids[i][j] == RARCH_UNMAPPED)
|
||||
config_set_int(conf, stk_ident[j],
|
||||
-1);
|
||||
else
|
||||
config_unset(conf,key_ident[j]);
|
||||
config_unset(conf,btn_ident[j]);
|
||||
}
|
||||
}
|
||||
snprintf(s1, sizeof(s1), "input_libretro_device_p%u", i + 1);
|
||||
@ -273,11 +297,13 @@ void input_remapping_set_defaults(bool deinit)
|
||||
const struct retro_keybind *keybind = &input_config_binds[i][j];
|
||||
if (keybind)
|
||||
settings->uints.input_remap_ids[i][j] = keybind->id;
|
||||
settings->uints.input_keymapper_ids[j] = RETROK_UNKNOWN;
|
||||
|
||||
settings->uints.input_keymapper_ids[i][j] = RETROK_UNKNOWN;
|
||||
}
|
||||
for (j = RARCH_FIRST_CUSTOM_BIND; j < RARCH_FIRST_CUSTOM_BIND + 8; j++)
|
||||
{
|
||||
RARCH_LOG("******************User: %d Val: %d\n", i, j );
|
||||
settings->uints.input_remap_ids[i][j] = j;
|
||||
}
|
||||
for (j = 0; j < 4; j++)
|
||||
settings->uints.input_remap_ids[i][RARCH_FIRST_CUSTOM_BIND + j] = j;
|
||||
|
||||
if (old_analog_dpad_mode[i])
|
||||
settings->uints.input_analog_dpad_mode[i] = old_analog_dpad_mode[i];
|
||||
|
@ -153,6 +153,8 @@ static INLINE bool bits_any_set(uint32_t* ptr, uint32_t count)
|
||||
typedef struct
|
||||
{
|
||||
uint32_t data[8];
|
||||
uint16_t analogs[8];
|
||||
} retro_bits_t;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@
|
||||
cbs->action_get_value_ident = #name;
|
||||
#endif
|
||||
|
||||
extern struct key_desc key_descriptors[MENU_SETTINGS_INPUT_DESC_KBD_END];
|
||||
extern struct key_desc key_descriptors[RARCH_MAX_KEYS];
|
||||
|
||||
static void menu_action_setting_disp_set_label_cheat_num_passes(
|
||||
file_list_t* list,
|
||||
@ -547,80 +547,50 @@ static void menu_action_setting_disp_set_label_input_desc(
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
char descriptor[255];
|
||||
const struct retro_keybind *auto_bind = NULL;
|
||||
const struct retro_keybind *keybind = NULL;
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
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;
|
||||
const char* descriptor = NULL;
|
||||
char buf[256];
|
||||
|
||||
unsigned btn_idx, user_idx, remap_idx;
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
descriptor[0] = '\0';
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
|
||||
remap_id = settings->uints.input_remap_ids
|
||||
[inp_desc_user][inp_desc_button_index_offset];
|
||||
remap_idx =
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx];
|
||||
/*
|
||||
if (remap_idx == RARCH_UNMAPPED)
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_UNMAPPED;
|
||||
*/
|
||||
if (!system)
|
||||
return;
|
||||
|
||||
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);
|
||||
descriptor = system->input_desc_btn[user_idx][remap_idx];
|
||||
|
||||
input_config_get_bind_string(descriptor,
|
||||
keybind, auto_bind, sizeof(descriptor));
|
||||
|
||||
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
|
||||
if (!string_is_empty(descriptor) && remap_idx < RARCH_FIRST_CUSTOM_BIND)
|
||||
strlcpy(s, descriptor, len);
|
||||
else if (!string_is_empty(descriptor) && remap_idx >= RARCH_FIRST_CUSTOM_BIND && remap_idx % 2 == 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s %c", descriptor, '+');
|
||||
strlcpy(s, buf, len);
|
||||
}
|
||||
else if (!string_is_empty(descriptor) && remap_idx >= RARCH_FIRST_CUSTOM_BIND && remap_idx % 2 != 0)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s %c", descriptor, '-');
|
||||
strlcpy(s, buf, 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;
|
||||
}
|
||||
strlcpy(s, "---", len);
|
||||
|
||||
if (!string_is_empty(str))
|
||||
strlcpy(s, str, len);
|
||||
}
|
||||
|
||||
*w = 19;
|
||||
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,
|
||||
@ -631,28 +601,41 @@ static void menu_action_setting_disp_set_label_input_desc_kbd(
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
char desc[PATH_MAX_LENGTH];
|
||||
unsigned key_id;
|
||||
unsigned key_id, id;
|
||||
unsigned remap_id;
|
||||
unsigned offset = 0;
|
||||
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return;
|
||||
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN];
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
id = (type / (offset + 1)) - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[offset][id];
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
{
|
||||
if(remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
}
|
||||
snprintf(desc, sizeof(desc), "Keyboard %s", key_descriptors[key_id].desc);
|
||||
strlcpy(s, desc, len);
|
||||
|
||||
if (key_descriptors[key_id].key != RETROK_FIRST)
|
||||
{
|
||||
snprintf(desc, sizeof(desc), "Keyboard %s", key_descriptors[key_id].desc);
|
||||
strlcpy(s, desc, len);
|
||||
}
|
||||
else
|
||||
strlcpy(s, "---", len);
|
||||
|
||||
*w = 19;
|
||||
strlcpy(s2, path, len2);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void menu_action_setting_disp_set_label_cheat(
|
||||
file_list_t* list,
|
||||
@ -2101,14 +2084,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)
|
||||
|
@ -46,7 +46,7 @@
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
extern struct key_desc key_descriptors[MENU_SETTINGS_INPUT_DESC_KBD_END];
|
||||
extern struct key_desc key_descriptors[RARCH_MAX_KEYS];
|
||||
|
||||
static int generic_shader_action_parameter_left(
|
||||
struct video_shader_parameter *param,
|
||||
@ -91,38 +91,61 @@ static int action_left_cheat(unsigned type, const char *label,
|
||||
}
|
||||
|
||||
static int action_left_input_desc(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
bool wraparound)
|
||||
{
|
||||
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));
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned btn_idx, user_idx, remap_idx;
|
||||
|
||||
if (settings->uints.input_remap_ids[inp_desc_user][inp_desc_button_index_offset] > 0)
|
||||
settings->uints.input_remap_ids[inp_desc_user][inp_desc_button_index_offset]--;
|
||||
if (!settings || !system)
|
||||
return 0;
|
||||
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
|
||||
if (settings->uints.input_remap_ids[user_idx][btn_idx] == RARCH_UNMAPPED)
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_CUSTOM_BIND_LIST_END - 1;
|
||||
|
||||
if (settings->uints.input_remap_ids[user_idx][btn_idx] > 0)
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx]--;
|
||||
else if (settings->uints.input_remap_ids[user_idx][btn_idx] == 0)
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_UNMAPPED;
|
||||
else
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_CUSTOM_BIND_LIST_END - 1;
|
||||
|
||||
remap_idx = settings->uints.input_remap_ids[user_idx][btn_idx];
|
||||
|
||||
/* skip the not used buttons (unless they are at the end by calling the right desc function recursively
|
||||
also skip all the axes until analog remapping is implemented */
|
||||
if ((string_is_empty(system->input_desc_btn[user_idx][remap_idx]) && remap_idx < RARCH_CUSTOM_BIND_LIST_END) /*||
|
||||
(remap_idx >= RARCH_FIRST_CUSTOM_BIND && remap_idx < RARCH_CUSTOM_BIND_LIST_END)*/)
|
||||
action_left_input_desc(type, label, wraparound);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_KEYMAPPER
|
||||
static int action_left_input_desc_kbd(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
char desc[PATH_MAX_LENGTH];
|
||||
unsigned key_id;
|
||||
unsigned key_id, id, offset;
|
||||
unsigned remap_id;
|
||||
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
remap_id = settings->uints.input_keymapper_ids[offset];
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
id = (type / (offset + 1)) - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[offset][id];
|
||||
|
||||
for (key_id = 0; key_id < RARCH_MAX_KEYS +
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
{
|
||||
if(remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
@ -131,13 +154,12 @@ static int action_left_input_desc_kbd(unsigned type, const char *label,
|
||||
if (key_id > 0)
|
||||
key_id--;
|
||||
else
|
||||
key_id = MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
key_id = RARCH_MAX_KEYS + MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
|
||||
settings->uints.input_keymapper_ids[offset] = key_descriptors[key_id].key;
|
||||
settings->uints.input_keymapper_ids[offset][id] = key_descriptors[key_id].key;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int action_left_scroll(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
@ -609,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);
|
||||
|
@ -48,7 +48,7 @@
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
extern struct key_desc key_descriptors[MENU_SETTINGS_INPUT_DESC_KBD_END];
|
||||
extern struct key_desc key_descriptors[RARCH_MAX_KEYS];
|
||||
|
||||
static int generic_shader_action_parameter_right(struct video_shader_parameter *param,
|
||||
unsigned type, const char *label, bool wraparound)
|
||||
@ -101,58 +101,81 @@ 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)
|
||||
{
|
||||
unsigned key_id;
|
||||
unsigned key_id, id, offset;
|
||||
unsigned remap_id;
|
||||
char desc[PATH_MAX_LENGTH];
|
||||
unsigned offset = type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
remap_id = settings->uints.input_keymapper_ids[offset];
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
id = (type / (offset + 1)) - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN;
|
||||
|
||||
remap_id =
|
||||
settings->uints.input_keymapper_ids[offset][id];
|
||||
|
||||
for (key_id = 0; key_id < MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN; key_id++)
|
||||
{
|
||||
if(remap_id == key_descriptors[key_id].key)
|
||||
break;
|
||||
}
|
||||
|
||||
if (key_id < MENU_SETTINGS_INPUT_DESC_KBD_END - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN)
|
||||
RARCH_LOG("o:%u t:%u i:%u r:%u\n", offset, type, id, remap_id);
|
||||
|
||||
if (key_id < RARCH_MAX_KEYS + MENU_SETTINGS_INPUT_DESC_KBD_BEGIN)
|
||||
key_id++;
|
||||
else
|
||||
key_id = 0;
|
||||
|
||||
settings->uints.input_keymapper_ids[offset] = key_descriptors[key_id].key;
|
||||
settings->uints.input_keymapper_ids[offset][id] = key_descriptors[key_id].key;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* fix-me: incomplete, lacks error checking */
|
||||
int action_right_input_desc(unsigned type, const char *label,
|
||||
bool wraparound)
|
||||
{
|
||||
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));
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = runloop_get_system_info();
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned btn_idx, user_idx, remap_idx;
|
||||
|
||||
if (inp_desc_button_index_offset < RARCH_FIRST_CUSTOM_BIND)
|
||||
{
|
||||
if (settings->uints.input_remap_ids[inp_desc_user][inp_desc_button_index_offset] < RARCH_FIRST_CUSTOM_BIND - 1)
|
||||
settings->uints.input_remap_ids[inp_desc_user][inp_desc_button_index_offset]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (settings->uints.input_remap_ids[inp_desc_user][inp_desc_button_index_offset] < 4 - 1)
|
||||
settings->uints.input_remap_ids[inp_desc_user][inp_desc_button_index_offset]++;
|
||||
}
|
||||
if (!settings || !system)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
|
||||
if (settings->uints.input_remap_ids[user_idx][btn_idx] < RARCH_CUSTOM_BIND_LIST_END - 1)
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx]++;
|
||||
else if (settings->uints.input_remap_ids[user_idx][btn_idx] == RARCH_CUSTOM_BIND_LIST_END - 1)
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_UNMAPPED;
|
||||
else
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = 0;
|
||||
|
||||
remap_idx = settings->uints.input_remap_ids[user_idx][btn_idx];
|
||||
|
||||
/* skip the not used buttons (unless they are at the end by calling the right desc function recursively
|
||||
also skip all the axes until analog remapping is implemented */
|
||||
if ((string_is_empty(system->input_desc_btn[user_idx][remap_idx]) && remap_idx < RARCH_CUSTOM_BIND_LIST_END) /*||
|
||||
(remap_idx >= RARCH_FIRST_CUSTOM_BIND && remap_idx < RARCH_CUSTOM_BIND_LIST_END)*/)
|
||||
action_right_input_desc(type, label, wraparound);
|
||||
|
||||
#if 0
|
||||
int i = 0;
|
||||
//RARCH_LOG("[remap-debug] new descriptor for %d: %s\n", remap_idx, system->input_desc_btn[user_idx][remap_idx]);
|
||||
for (i = 0; i < RARCH_ANALOG_BIND_LIST_END; i++)
|
||||
RARCH_LOG("[remap-debug]: user %d button %d new id %d\n", user_idx, i, settings->uints.input_remap_ids[user_idx][i]);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_right_scroll(unsigned type, const char *label,
|
||||
@ -478,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);
|
||||
|
@ -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
|
||||
{
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "../../retroarch.h"
|
||||
#include "../../content.h"
|
||||
#include "../../configuration.h"
|
||||
|
||||
#define default_sublabel_macro(func_name, lbl) \
|
||||
static int (func_name)(file_list_t *list, unsigned type, unsigned i, const char *label, const char *path, char *s, size_t len) \
|
||||
@ -425,7 +426,54 @@ static int action_bind_sublabel_subsystem_add(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_bind_sublabel_remap_kbd_sublabel(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
char desc[PATH_MAX_LENGTH];
|
||||
unsigned offset;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
offset = type / ((MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_END -
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN))) - 1;
|
||||
|
||||
snprintf(s, len, "User #%d: %s", offset + 1,
|
||||
input_config_get_device_display_name(offset) ?
|
||||
input_config_get_device_display_name(offset) :
|
||||
(input_config_get_device_name(offset) ?
|
||||
input_config_get_device_name(offset) : "N/A"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int action_bind_sublabel_remap_sublabel(
|
||||
file_list_t *list,
|
||||
unsigned type, unsigned i,
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
char desc[PATH_MAX_LENGTH];
|
||||
unsigned offset;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
offset = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
|
||||
snprintf(s, len, "User #%d: %s", offset + 1,
|
||||
input_config_get_device_display_name(offset) ?
|
||||
input_config_get_device_display_name(offset) :
|
||||
(input_config_get_device_name(offset) ?
|
||||
input_config_get_device_name(offset) : "N/A"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
static int action_bind_sublabel_netplay_room(
|
||||
@ -485,6 +533,18 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_generic);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (type >= MENU_SETTINGS_INPUT_DESC_BEGIN
|
||||
&& type <= MENU_SETTINGS_INPUT_DESC_END)
|
||||
{
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_remap_sublabel);
|
||||
}
|
||||
|
||||
if (cbs->enum_idx != MSG_UNKNOWN)
|
||||
{
|
||||
switch (cbs->enum_idx)
|
||||
|
@ -32,7 +32,7 @@ static void menu_cbs_init_log(const char *entry_label, const char *bind_label, c
|
||||
#endif
|
||||
}
|
||||
|
||||
struct key_desc key_descriptors[MENU_SETTINGS_INPUT_DESC_KBD_END] =
|
||||
struct key_desc key_descriptors[RARCH_MAX_KEYS] =
|
||||
{
|
||||
{RETROK_FIRST, "Unmapped"},
|
||||
{RETROK_BACKSPACE, "Backspace"},
|
||||
|
@ -3240,76 +3240,90 @@ static int menu_displaylist_parse_options_remappings(
|
||||
|
||||
if (system)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned device;
|
||||
for (p = 0; p < max_users; p++)
|
||||
{
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 4; retro_id++)
|
||||
device = settings->uints.input_libretro_device[p];
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
if (device == RETRO_DEVICE_JOYPAD || device == RETRO_DEVICE_ANALOG)
|
||||
{
|
||||
char desc_label[64];
|
||||
unsigned user = p + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
const char *description = NULL;
|
||||
/* change to RARCH_FIRST_CUSTOM_BIND + 8 once analog remapping is implemented */
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND + 8; retro_id++)
|
||||
{
|
||||
char desc_label[64];
|
||||
unsigned user = p + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
char descriptor[255];
|
||||
const struct retro_keybind *auto_bind = NULL;
|
||||
const struct retro_keybind *keybind = NULL;
|
||||
|
||||
desc_label[0] = '\0';
|
||||
keybind = &input_config_binds[p][retro_id];
|
||||
auto_bind = (const struct retro_keybind*)
|
||||
input_config_get_bind_auto(p, retro_id);
|
||||
|
||||
if (desc_offset >= RARCH_FIRST_CUSTOM_BIND)
|
||||
desc_offset = RARCH_FIRST_CUSTOM_BIND
|
||||
+ (desc_offset - RARCH_FIRST_CUSTOM_BIND) * 2;
|
||||
input_config_get_bind_string(descriptor,
|
||||
keybind, auto_bind, sizeof(descriptor));
|
||||
|
||||
description = system->input_desc_btn[p][desc_offset];
|
||||
if(!strstr(descriptor, "Auto"))
|
||||
{
|
||||
const struct retro_keybind *keyptr =
|
||||
&input_config_binds[p][retro_id];
|
||||
|
||||
if (!description)
|
||||
continue;
|
||||
strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor));
|
||||
}
|
||||
|
||||
snprintf(desc_label, sizeof(desc_label),
|
||||
"%s %u %s : ", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_USER),
|
||||
user, description);
|
||||
menu_entries_append_enum(info->list, desc_label, "",
|
||||
MSG_UNKNOWN,
|
||||
MENU_SETTINGS_INPUT_DESC_BEGIN +
|
||||
(p * (RARCH_FIRST_CUSTOM_BIND + 4)) + retro_id, 0, 0);
|
||||
menu_entries_append_enum(info->list, descriptor, "",
|
||||
MSG_UNKNOWN,
|
||||
MENU_SETTINGS_INPUT_DESC_BEGIN +
|
||||
(p * (RARCH_FIRST_CUSTOM_BIND + 8)) + retro_id, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_KEYMAPPER
|
||||
if (system)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned device;
|
||||
|
||||
unsigned device = settings->uints.input_libretro_device[settings->uints.keymapper_port];
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
if (device == RETRO_DEVICE_KEYBOARD)
|
||||
for (p = 0; p < MAX_USERS; p++)
|
||||
{
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
|
||||
device = settings->uints.input_libretro_device[p];
|
||||
device &= RETRO_DEVICE_MASK;
|
||||
|
||||
if (device == RETRO_DEVICE_KEYBOARD)
|
||||
{
|
||||
unsigned user = settings->uints.keymapper_port + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
char descriptor[255];
|
||||
const struct retro_keybind *auto_bind = NULL;
|
||||
const struct retro_keybind *keybind = NULL;
|
||||
|
||||
keybind = &input_config_binds[settings->uints.keymapper_port][retro_id];
|
||||
auto_bind = (const struct retro_keybind*)
|
||||
input_config_get_bind_auto(settings->uints.keymapper_port, retro_id);
|
||||
|
||||
input_config_get_bind_string(descriptor,
|
||||
keybind, auto_bind, sizeof(descriptor));
|
||||
|
||||
if(!strstr(descriptor, "Auto"))
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
|
||||
{
|
||||
const struct retro_keybind *keyptr =
|
||||
&input_config_binds[settings->uints.keymapper_port][retro_id];
|
||||
unsigned user = settings->uints.keymapper_port + 1;
|
||||
unsigned desc_offset = retro_id;
|
||||
char descriptor[255];
|
||||
const struct retro_keybind *auto_bind = NULL;
|
||||
const struct retro_keybind *keybind = NULL;
|
||||
|
||||
strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor));
|
||||
keybind = &input_config_binds[p][retro_id];
|
||||
auto_bind = (const struct retro_keybind*)
|
||||
input_config_get_bind_auto(p, retro_id);
|
||||
|
||||
input_config_get_bind_string(descriptor,
|
||||
keybind, auto_bind, sizeof(descriptor));
|
||||
|
||||
if(!strstr(descriptor, "Auto"))
|
||||
{
|
||||
const struct retro_keybind *keyptr =
|
||||
&input_config_binds[p][retro_id];
|
||||
|
||||
strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor));
|
||||
}
|
||||
|
||||
menu_entries_append_enum(info->list, descriptor, "",
|
||||
MSG_UNKNOWN,
|
||||
(MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id) * (p + 1), 0, 0);
|
||||
}
|
||||
|
||||
menu_entries_append_enum(info->list, descriptor, "",
|
||||
MSG_UNKNOWN,
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -206,9 +206,9 @@ enum menu_settings_type
|
||||
MENU_SETTINGS_CHEAT_BEGIN,
|
||||
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_END = MENU_SETTINGS_INPUT_DESC_BEGIN + ((RARCH_FIRST_CUSTOM_BIND + 8) * MAX_USERS),
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_BEGIN,
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_END = MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + 135,
|
||||
MENU_SETTINGS_INPUT_DESC_KBD_END = MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + (RARCH_MAX_KEYS * MAX_USERS),
|
||||
|
||||
MENU_SETTINGS_SUBSYSTEM_LOAD,
|
||||
|
||||
|
@ -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'
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user