mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-20 04:35:57 +00:00
The DualSense and DualShock 4 touchpad click is a bindable gamepad input named touchpad, shown and captured on the Controls tab (#482)
PAD_TOUCHPAD follows the paddles in input_map.h and reads SDL_GAMEPAD_BUTTON_TOUCHPAD in input.c pad_physical, so input_capture sees the click when a Controls cell waits for a press (#852 had no pad id to report it). It is unbound by default; pads without a touchpad never report it held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3858ad4b51
commit
0ce53aa7c7
9 files changed
+25
-9
No files matched your search
+1
-1
@@ -94,7 +94,7 @@ The *Controls* tab of the settings menu lists, under the button layout, every Sw
|
||||
|
||||
The tab writes `totk.ini` lines, one per Switch button or stick direction: `bind_<button> = <entry>, <entry>, ...`. The button is `A B X Y L R ZL ZR PLUS MINUS LEFT UP RIGHT DOWN LCLICK RCLICK`, or a stick direction `LSTICK_LEFT LSTICK_UP LSTICK_RIGHT LSTICK_DOWN` (movement, W A S D by default) and `RSTICK_...` (camera, the arrow keys), or `SHAKE` (keys only, G by default). An entry is `pad:<name>` or `key:<name>`:
|
||||
|
||||
- pad names: `south east west north l r zl zr start back lstick rstick dpad_left dpad_up dpad_right dpad_down lpaddle1 rpaddle1 lpaddle2 rpaddle2` (`zl`, `zr` are the triggers; the paddles are the back buttons of an Xbox Elite, DualSense Edge or Steam Controller, upper pair 1, lower pair 2, and no Switch button has them by default)
|
||||
- pad names: `south east west north l r zl zr start back lstick rstick dpad_left dpad_up dpad_right dpad_down lpaddle1 rpaddle1 lpaddle2 rpaddle2 touchpad` (`zl`, `zr` are the triggers; the paddles are the back buttons of an Xbox Elite, DualSense Edge or Steam Controller, upper pair 1, lower pair 2; `touchpad` is the touchpad click of a DualSense or DualShock 4; no Switch button has the paddles or the touchpad by default)
|
||||
- key names: `a` to `z`, `0` to `9`, `f2` to `f7`, `f9`, `f12`, `num0` to `num9`, `space tab enter backspace lshift rshift lctrl rctrl lalt capslock insert delete home end pageup pagedown up down left right`, `num_add num_sub num_mul num_div num_decimal`, `minus equals lbracket rbracket semicolon apostrophe comma period slash backslash grave`, `mouse_l mouse_r mouse_m mouse_x1 mouse_x2`
|
||||
- `key:default` and `pad:default` keep that part's defaults (`pad:default` is each layout's own button).
|
||||
- `none` leaves the button unbound.
|
||||
|
||||
@@ -392,6 +392,14 @@ int probe_cfg(void) {
|
||||
input_map_pad_buttons((uint8_t[PAD_COUNT]){[PAD_ZL] = 1}, PAD_LAYOUT_NINTENDO) == 1ull << B_ZL,
|
||||
"bind: pad:rpaddle1 adds a back paddle, pad:default keeps the trigger");
|
||||
input_map_reset();
|
||||
CHECK(input_map_pad_buttons((uint8_t[PAD_COUNT]){[PAD_TOUCHPAD] = 1}, PAD_LAYOUT_NINTENDO) == 0 &&
|
||||
input_map_pad_buttons((uint8_t[PAD_COUNT]){[PAD_TOUCHPAD] = 1}, PAD_LAYOUT_XBOX) == 0,
|
||||
"pad layout: the touchpad click is unbound by default");
|
||||
CHECK(input_map_bind("MINUS", "pad:default, pad:touchpad") &&
|
||||
input_map_pad_buttons((uint8_t[PAD_COUNT]){[PAD_TOUCHPAD] = 1}, PAD_LAYOUT_XBOX) == 1ull << B_MINUS &&
|
||||
input_map_pad_buttons((uint8_t[PAD_COUNT]){[PAD_BACK] = 1}, PAD_LAYOUT_XBOX) == 1ull << B_MINUS,
|
||||
"bind: pad:touchpad adds the touchpad click, pad:default keeps the button");
|
||||
input_map_reset();
|
||||
// Bind lines for stick directions and default parts; the remapping rows' edits (input_map.c)
|
||||
memset(dn, 0, sizeof dn);
|
||||
dn[KEY_I] = 1;
|
||||
|
||||
+2
-1
@@ -57,6 +57,7 @@ static const SDL_GamepadButton pad_sdl[PAD_COUNT] = {
|
||||
[PAD_DPAD_RIGHT] = SDL_GAMEPAD_BUTTON_DPAD_RIGHT, [PAD_DPAD_DOWN] = SDL_GAMEPAD_BUTTON_DPAD_DOWN,
|
||||
[PAD_LPADDLE1] = SDL_GAMEPAD_BUTTON_LEFT_PADDLE1, [PAD_RPADDLE1] = SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1,
|
||||
[PAD_LPADDLE2] = SDL_GAMEPAD_BUTTON_LEFT_PADDLE2, [PAD_RPADDLE2] = SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2,
|
||||
[PAD_TOUCHPAD] = SDL_GAMEPAD_BUTTON_TOUCHPAD,
|
||||
};
|
||||
|
||||
// TOTK_INPUT_SCRIPT=<file>: lines "<frame> <button> [hold]", "<frame> LSTICK|RSTICK <x> <y> [hold]", "<frame> MOUSE
|
||||
@@ -651,7 +652,7 @@ static int pad_physical(uint8_t pd[PAD_COUNT]) {
|
||||
for (int p = PAD_SOUTH; p < PAD_ZL; p++) pd[p] = SDL_GetGamepadButton(pad, pad_sdl[p]);
|
||||
pd[PAD_ZL] = SDL_GetGamepadAxis(pad, SDL_GAMEPAD_AXIS_LEFT_TRIGGER) > TRIGGER_ON;
|
||||
pd[PAD_ZR] = SDL_GetGamepadAxis(pad, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) > TRIGGER_ON;
|
||||
for (int p = PAD_ZR + 1; p < PAD_COUNT; p++) pd[p] = SDL_GetGamepadButton(pad, pad_sdl[p]); // false without paddles
|
||||
for (int p = PAD_ZR + 1; p < PAD_COUNT; p++) pd[p] = SDL_GetGamepadButton(pad, pad_sdl[p]); // false without paddles or touchpad
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@ static const char *const action_names[ACTION_COUNT] = {
|
||||
"LSTICK_LEFT", "LSTICK_UP", "LSTICK_RIGHT", "LSTICK_DOWN", "RSTICK_LEFT", "RSTICK_UP", "RSTICK_RIGHT", "RSTICK_DOWN", "SHAKE"};
|
||||
static const char *const pad_names[PAD_COUNT] = {
|
||||
NULL, "south", "east", "west", "north", "lstick", "rstick", "l", "r", "start", "back",
|
||||
"dpad_left", "dpad_up", "dpad_right", "dpad_down", "zl", "zr", "lpaddle1", "rpaddle1", "lpaddle2", "rpaddle2"};
|
||||
"dpad_left", "dpad_up", "dpad_right", "dpad_down", "zl", "zr", "lpaddle1", "rpaddle1", "lpaddle2", "rpaddle2",
|
||||
"touchpad"};
|
||||
static const char *const key_names[KEY_COUNT] = { // each group starts at its id; the ids of a group are consecutive
|
||||
[KEY_A] = "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
|
||||
"v", "w", "x", "y", "z",
|
||||
|
||||
+4
-3
@@ -37,13 +37,14 @@ enum {
|
||||
|
||||
// Gamepad inputs by position (Nintendo layout, as SDL names them), platform-neutral like the key ids. ZL and ZR are the
|
||||
// analog triggers; input_win.c translates SDL buttons and axes to these (one place). The paddles are the back buttons
|
||||
// of an Xbox Elite, DualSense Edge or Steam Controller (SDL's LEFT_PADDLE1 and so on); no Switch button has them by
|
||||
// default, a bind line or the remapping rows add them.
|
||||
// of an Xbox Elite, DualSense Edge or Steam Controller (SDL's LEFT_PADDLE1 and so on), the touchpad is the click of a
|
||||
// DualSense or DualShock 4 touchpad (SDL's TOUCHPAD); no Switch button has them by default, a bind line or the
|
||||
// remapping rows add them. A pad without one never reports it held.
|
||||
enum {
|
||||
PAD_NONE = 0,
|
||||
PAD_SOUTH, PAD_EAST, PAD_WEST, PAD_NORTH, PAD_LSTICK, PAD_RSTICK, PAD_L, PAD_R, PAD_START, PAD_BACK,
|
||||
PAD_DPAD_LEFT, PAD_DPAD_UP, PAD_DPAD_RIGHT, PAD_DPAD_DOWN, PAD_ZL, PAD_ZR,
|
||||
PAD_LPADDLE1, PAD_RPADDLE1, PAD_LPADDLE2, PAD_RPADDLE2,
|
||||
PAD_LPADDLE1, PAD_RPADDLE1, PAD_LPADDLE2, PAD_RPADDLE2, PAD_TOUCHPAD,
|
||||
PAD_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ void rt_log(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
static_assert(UI_BIND_SHAKE - UI_BIND_A == ACTION_COUNT - 1 && B_SHAKE == ACTION_COUNT - 1, "UI_BIND_* follow the actions");
|
||||
static_assert(UI_BIND_DESC_MINUS - UI_BIND_DESC_A == B_MINUS, "UI_BIND_DESC_* follow the actions");
|
||||
static_assert(UI_KEY_PAGEDOWN - UI_KEY_SPACE == KEY_PAGEDOWN - KEY_SPACE, "UI_KEY_* follow the key ids");
|
||||
static_assert(UI_PAD_RPADDLE2 - UI_PAD_SOUTH == PAD_RPADDLE2 - PAD_SOUTH && PAD_RPADDLE2 == PAD_COUNT - 1,
|
||||
static_assert(UI_PAD_TOUCHPAD - UI_PAD_SOUTH == PAD_TOUCHPAD - PAD_SOUTH && PAD_TOUCHPAD == PAD_COUNT - 1,
|
||||
"UI_PAD_* follow the pad ids");
|
||||
|
||||
enum { CAPTURE_SECONDS = 5 };
|
||||
|
||||
@@ -394,6 +394,7 @@ static const char *const text_en[UI_TEXT_COUNT] = {
|
||||
[UI_PAD_DPAD_DOWN] = "D-pad down", [UI_PAD_ZL] = "Left trigger", [UI_PAD_ZR] = "Right trigger",
|
||||
[UI_PAD_LPADDLE1] = "Left back button", [UI_PAD_RPADDLE1] = "Right back button",
|
||||
[UI_PAD_LPADDLE2] = "Left back button 2", [UI_PAD_RPADDLE2] = "Right back button 2",
|
||||
[UI_PAD_TOUCHPAD] = "Touchpad click",
|
||||
[UI_PAD_CROSS] = "Cross", [UI_PAD_CIRCLE] = "Circle", [UI_PAD_SQUARE] = "Square", [UI_PAD_TRIANGLE] = "Triangle",
|
||||
|
||||
[UI_MENU_AMIIBO_DIR] = "Amiibo folder",
|
||||
@@ -929,6 +930,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
|
||||
[UI_PAD_ZR] = "Правый курок",
|
||||
[UI_PAD_LPADDLE1] = "Левая задняя кнопка", [UI_PAD_RPADDLE1] = "Правая задняя кнопка",
|
||||
[UI_PAD_LPADDLE2] = "Левая задняя кнопка 2", [UI_PAD_RPADDLE2] = "Правая задняя кнопка 2",
|
||||
[UI_PAD_TOUCHPAD] = "Нажатие на тачпад",
|
||||
[UI_PAD_CROSS] = "Крест", [UI_PAD_CIRCLE] = "Круг", [UI_PAD_SQUARE] = "Квадрат", [UI_PAD_TRIANGLE] = "Треугольник",
|
||||
|
||||
[UI_MENU_AMIIBO_DIR] = "Папка amiibo",
|
||||
@@ -1312,6 +1314,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
|
||||
[UI_PAD_ZL] = "Gatilho esquerdo", [UI_PAD_ZR] = "Gatilho direito",
|
||||
[UI_PAD_LPADDLE1] = "Botão traseiro esquerdo", [UI_PAD_RPADDLE1] = "Botão traseiro direito",
|
||||
[UI_PAD_LPADDLE2] = "Botão traseiro esquerdo 2", [UI_PAD_RPADDLE2] = "Botão traseiro direito 2",
|
||||
[UI_PAD_TOUCHPAD] = "Clique do touchpad",
|
||||
[UI_PAD_CROSS] = "Cruz", [UI_PAD_CIRCLE] = "Círculo", [UI_PAD_SQUARE] = "Quadrado", [UI_PAD_TRIANGLE] = "Triângulo",
|
||||
|
||||
[UI_MENU_AMIIBO_DIR] = "Pasta de amiibo",
|
||||
@@ -1975,6 +1978,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
|
||||
[UI_PAD_RPADDLE1] = "右背键",
|
||||
[UI_PAD_LPADDLE2] = "左背键 2",
|
||||
[UI_PAD_RPADDLE2] = "右背键 2",
|
||||
[UI_PAD_TOUCHPAD] = "触摸板按下",
|
||||
[UI_PAD_CROSS] = "叉键",
|
||||
[UI_PAD_CIRCLE] = "圆圈键",
|
||||
[UI_PAD_SQUARE] = "方块键",
|
||||
|
||||
+2
-2
@@ -169,10 +169,10 @@ typedef enum {
|
||||
UI_KEY_ENTER, UI_KEY_BACKSPACE, UI_KEY_RSHIFT, UI_KEY_RCTRL, UI_KEY_LALT, UI_KEY_CAPSLOCK, UI_KEY_INSERT,
|
||||
UI_KEY_DELETE, UI_KEY_HOME, UI_KEY_END, UI_KEY_PAGEUP, UI_KEY_PAGEDOWN,
|
||||
UI_KEY_NUM_FMT, // "Num %s": a numpad key
|
||||
// gamepad buttons, in pad id order PAD_SOUTH .. PAD_RPADDLE2, then the PlayStation face labels
|
||||
// gamepad buttons, in pad id order PAD_SOUTH .. PAD_TOUCHPAD, then the PlayStation face labels
|
||||
UI_PAD_SOUTH, UI_PAD_EAST, UI_PAD_WEST, UI_PAD_NORTH, UI_PAD_LSTICK, UI_PAD_RSTICK, UI_PAD_L, UI_PAD_R,
|
||||
UI_PAD_START, UI_PAD_BACK, UI_PAD_DPAD_LEFT, UI_PAD_DPAD_UP, UI_PAD_DPAD_RIGHT, UI_PAD_DPAD_DOWN, UI_PAD_ZL,
|
||||
UI_PAD_ZR, UI_PAD_LPADDLE1, UI_PAD_RPADDLE1, UI_PAD_LPADDLE2, UI_PAD_RPADDLE2,
|
||||
UI_PAD_ZR, UI_PAD_LPADDLE1, UI_PAD_RPADDLE1, UI_PAD_LPADDLE2, UI_PAD_RPADDLE2, UI_PAD_TOUCHPAD,
|
||||
UI_PAD_CROSS, UI_PAD_CIRCLE, UI_PAD_SQUARE, UI_PAD_TRIANGLE,
|
||||
|
||||
// Amiibo tab (ui/amiibo_page.cpp): the dump folder and its files, the emulated NFC reader and its state, the
|
||||
|
||||
@@ -419,6 +419,7 @@
|
||||
# SHAKE take keys only. Invalid entries are logged and skipped. Changes while the game runs take effect at once.
|
||||
# pad names: south east west north l r zl zr start back lstick rstick dpad_left dpad_up dpad_right dpad_down
|
||||
# lpaddle1 rpaddle1 lpaddle2 rpaddle2 (the back buttons of an Xbox Elite, DualSense Edge or Steam Controller)
|
||||
# touchpad (the touchpad click of a DualSense or DualShock 4)
|
||||
# key names: a-z 0-9 f2-f7 f9 f12 num0-num9 space tab enter backspace lshift rshift lctrl rctrl lalt capslock insert
|
||||
# delete home end pageup pagedown up down left right num_add num_sub num_mul num_div num_decimal minus equals
|
||||
# lbracket rbracket semicolon apostrophe comma period slash backslash grave mouse_l mouse_r mouse_m mouse_x1 mouse_x2
|
||||
|
||||
Reference in new issue
Block a user