mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 05:05:56 +00:00
The gamepad poll keeps its buttons by position, the Home button and the trigger axes, and input_pad_combo reads a combo setting
pad_read stores what pad_physical saw (pad_seen, by PAD_* position, with the Home / Guide button after the Switch buttons as PAD_GUIDE) and the two trigger axes (trigger_seen), under the input lock, for gamepad combos that are no Switch buttons and for analog trigger readers. input_pad_combo parses a setting of button positions joined with + (the bind_ lines' pad: names plus guide or home) into a mask, logging a name that is no button. input_map.c exports input_key_id and input_pad_id, and ui/binds_page.cpp binds_pad_label gives the label the open pad has on a button, so menu rows can name buttons as the Controls tab does. No behaviour changes on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ebce67b367
commit
94c33b1d85
6 files changed
+54
-5
No files matched your search
+4
-4
@@ -66,13 +66,13 @@ const char *input_pad_name(int pad) { return pad > PAD_NONE && pad < PAD_COUNT ?
|
||||
|
||||
void input_map_reset(void) { input_map = defaults; }
|
||||
|
||||
static int key_id(const char *name) {
|
||||
int input_key_id(const char *name) {
|
||||
for (int k = KEY_A; k < KEY_COUNT; k++)
|
||||
if (key_names[k] && !strcasecmp(key_names[k], name)) return k;
|
||||
return KEY_NONE;
|
||||
}
|
||||
|
||||
static int pad_id(const char *name) {
|
||||
int input_pad_id(const char *name) {
|
||||
for (int p = PAD_SOUTH; p < PAD_COUNT; p++)
|
||||
if (!strcasecmp(pad_names[p], name)) return p;
|
||||
return PAD_NONE;
|
||||
@@ -133,12 +133,12 @@ int input_map_bind(const char *button, const char *list) {
|
||||
int ok = 0;
|
||||
if (!strncasecmp(tok, "pad:", 4) && action < B_SL_LEFT) {
|
||||
const char *name = trim(tok + 4);
|
||||
int p = pad_id(name);
|
||||
int p = input_pad_id(name);
|
||||
if (!strcasecmp(name, "default")) pad_def = ok = 1;
|
||||
else if (p && np < INPUT_PAD_BINDING_MAX) pads[np++] = (uint8_t)p, ok = 1;
|
||||
} else if (!strncasecmp(tok, "key:", 4)) {
|
||||
const char *name = trim(tok + 4);
|
||||
int k = key_id(name);
|
||||
int k = input_key_id(name);
|
||||
if (!strcasecmp(name, "default")) key_def = ok = 1;
|
||||
else if (k && nk < INPUT_BINDING_MAX) keys[nk++] = (uint8_t)k, ok = 1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user