mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-21 12:55:57 +00:00
Remap gamepad buttons and keys with bind_<button> lines in totk.ini, one data-driven table for the pad and one for keys
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d3589c904e
commit
e8697659ac
6 files changed
+201
-28
No files matched your search
+27
-2
@@ -22,9 +22,34 @@ enum {
|
||||
KEY_COUNT
|
||||
};
|
||||
|
||||
// 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).
|
||||
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_COUNT
|
||||
};
|
||||
|
||||
enum { INPUT_BINDING_MAX = 96, INPUT_PAD_BINDING_MAX = 48 };
|
||||
|
||||
// The tables a remapping page edits. Defaults are the layout in docs/controls.md; input_map_reset restores them.
|
||||
typedef struct { uint8_t key; uint8_t action; } Binding;
|
||||
extern const Binding input_bindings[];
|
||||
extern const int input_binding_count;
|
||||
typedef struct { uint8_t pad; uint8_t action; } PadBinding;
|
||||
extern Binding input_bindings[INPUT_BINDING_MAX];
|
||||
extern int input_binding_count;
|
||||
extern PadBinding input_pad_bindings[INPUT_PAD_BINDING_MAX];
|
||||
extern int input_pad_binding_count;
|
||||
|
||||
void input_map_reset(void);
|
||||
// Replaces every binding of the Switch button `button` (script name: A B X Y LCLICK RCLICK L R ZL ZR PLUS MINUS LEFT UP
|
||||
// RIGHT DOWN, any case) with `list`: comma separated "pad:<name>" and "key:<name>" entries, or "none" for no input.
|
||||
// Invalid entries are logged and skipped; when none is valid the button keeps its bindings. 1 when applied.
|
||||
int input_map_bind(const char *button, const char *list);
|
||||
// Applies the TOTK_BIND_<button> settings (cfg_get) over the defaults. Once, at start.
|
||||
void input_map_configure(void);
|
||||
// down[pad] != 0 for the gamepad inputs held. Returns the Switch button bits (0..15) the pad table presses.
|
||||
uint64_t input_map_pad_buttons(const uint8_t down[PAD_COUNT]);
|
||||
|
||||
// down[key] != 0 for the keys held. Returns the Switch button bits (0..15) the table presses.
|
||||
uint64_t input_map_buttons(const uint8_t down[KEY_COUNT]);
|
||||
|
||||
Reference in new issue
Block a user