diff --git a/docs/ACTIONS.md b/docs/ACTIONS.md index 8dd4cbd96..10e5bf77f 100644 --- a/docs/ACTIONS.md +++ b/docs/ACTIONS.md @@ -13,13 +13,19 @@ seven gyro slots accept both devices; their new controller sides default to unbo left stick to 40%. Tilt holds the mouse clutch and enables the existing sensorless controller stick tilt path. Gyro buttons and keys combine per direction, only while `gyro_keys_live()`; simultaneous opposite directions cancel. Walk, Tilt, gyro and game action bindings allow shared inputs on both devices. Assigning one never changes another -slot, including raw Switch menu buttons; rebinding a raw slot also leaves these shared bindings intact. Legacy -host slots still swap among themselves on the same device, including the raw Switch buttons (0 to 15). An action on -the page whose Switch input is not a face button (L, R, ZL, ZR, a stick press, the D-pad) answers from its own bindings -once that raw input differs from its defaults: in play the game reads those raw inputs for factory-default actions, so -without this Call horse moved with Magnesis: pull closer and Aim rune with Menu: previous tab. The face buttons need -none of it (in play `act_gameplay_buttons` builds them from the actions); hidden actions, with no row of their own, -go on following the raw input. +slot, including raw Switch menu buttons; rebinding a raw slot also leaves these shared bindings intact. Raw Switch +slots (0 to 15) no longer swap either: a host input already on another slot is simply shared (result kind 2 is unused). + +In play, the raw A / B / X / Y / L / R / ZL / ZR / stick-press bits the game reads are built only from actions still at +their factory binding (`act_play_keys` / `act_play_pads`), never from the "Menu: ..." rows. So a key given to +"Menu: sort / sensor" cannot press Attack, rebinding Jump leaves Space on the raw X bit for the other X actions, and the +new key does not set it. D-pad, Plus and Minus stay on their rows (quick menu, pause, map). The menus and the title keep +using the rows. This only switches on once the game has asked about an action (`act_play_active()`); before that, and on +game versions without the hook, the rows drive every button as before. +An action on the page whose Switch input is not a face button (L, R, ZL, ZR, a stick press, the D-pad) also answers from +its own bindings once that raw input differs from its defaults, so Call horse does not move with Magnesis: pull closer, +nor Aim rune with Menu: previous tab; hidden actions, with no row of their own, go on following the raw input. Shops +and dialogues use the menu rows like the other menus. The game's title, pause and map menus still use the raw Switch layer, including legacy raw-button rebinds. The runtime overlay and launcher keep their fixed navigation shortcuts. The separate UI update can use `bind_input_name`, @@ -180,7 +186,7 @@ synthetic rows (needs no game files). `make test-actions` (no game files): the answers to the hold / pressed queries, menus falling back, two actions on one key, factory-default fallthrough, customization on either device, legacy migration in either order, one-time schema -migration and reload idempotence, shared action/Walk/Tilt/gyro captures on both devices, preserved raw Switch swaps, +migration and reload idempotence, shared action/Walk/Tilt/gyro captures on both devices, raw Switch slots sharing instead of swapping, menu rows not reaching the play bits, reset and ini round trips (`tools/test_actions.c`), and the generated hook (`tools/test_act_site.py`). `make test-pc-controls` also checks Walk scaling, shared key/pad Tilt, mouse routing, sensorless dual-stick eligibility, diff --git a/runtime/hle/bindings.c b/runtime/hle/bindings.c index 754f6b3e0..377ad5e8f 100644 --- a/runtime/hle/bindings.c +++ b/runtime/hle/bindings.c @@ -346,7 +346,7 @@ void bind_set2(int dev, int slot, int host) { act_refresh(); } -// Bind `host` to `slot`; only legacy host slots swap. Actions, Walk, Tilt and gyro allow shared inputs. +// Bind `host` to `slot`. Every input may share its key or button with any other: nothing swaps and nothing else moves. static void assign(int dev, int slot, int host) { if (cap_alt) { if (bind_slot_is_action(slot)) { @@ -358,7 +358,7 @@ static void assign(int dev, int slot, int host) { result(1, dev, slot, -1); return; } - if (bind_slot_is_action(slot)) { // an action may share its key with any other: nothing swaps + if (bind_slot_is_action(slot)) { act_set(dev, slot - BIND_ACTION, host); LOG("[input] %s action %d -> %s\n", dev == BIND_DEV_PAD ? "controller" : "keyboard", slot - BIND_ACTION, dev == BIND_DEV_PAD ? k_pad_ini[host] : bind_key_label(host)); @@ -366,18 +366,10 @@ static void assign(int dev, int slot, int host) { return; } int16_t *t = dev == BIND_DEV_PAD ? g_bind_pad : g_bind_key; - int other = -1; - for (int i = 0; i < BIND_KEY_COUNT; i++) - if (i != slot && (dev == BIND_DEV_KEY ? bind_key_same_context(i, slot) : (bind_pad_slot(i) && bind_key_same_context(i, slot))) && t[i] == host) { - other = i; - t[i] = t[slot]; - } t[slot] = (int16_t)host; - LOG("[input] %s %s -> %s%s%s%s\n", dev == BIND_DEV_PAD ? "controller" : "keyboard", k_names[slot], - dev == BIND_DEV_PAD ? k_pad_ini[host] : bind_key_label(host), other >= 0 ? " (swapped with " : "", - other >= 0 ? k_names[other] : "", other >= 0 ? ")" : ""); - if (other >= 0) LOG("[input] %s -> %s\n", k_names[other], dev == BIND_DEV_PAD ? bind_pad_label(t[other], 0) : bind_key_label(t[other])); - result(other >= 0 ? 2 : 1, dev, slot, other); + LOG("[input] %s %s -> %s\n", dev == BIND_DEV_PAD ? "controller" : "keyboard", k_names[slot], + dev == BIND_DEV_PAD ? k_pad_ini[host] : bind_key_label(host)); + result(1, dev, slot, -1); act_refresh(); } @@ -585,7 +577,7 @@ bool act_is_default(int id) { // The raw Switch input b (not a face button) is bound to something other than its defaults. In play the game reads // those slots for actions at their factory defaults, so Call horse moved with Magnesis: pull closer and Aim rune with -// Menu: previous tab. The face buttons need none of this: in play act_gameplay_buttons builds them from the actions. +// Menu: previous tab. The face buttons need none of this: in play act_play_keys / act_play_pads build them from the actions. static bool raw_moved(int b) { if (b < 0 || b >= BIND_PAD_COUNT || b == BIND_A || b == BIND_B || b == BIND_X || b == BIND_Y) return false; return g_bind_key[b] != k_def_key[b] || g_bind_key2[b] != 0 || g_bind_pad[b] != k_def_pad[b] || @@ -671,6 +663,37 @@ static void act_migrate(int dev, int slot) { act_refresh(); } +// In play the game's A / B / X / Y / L / R / ZL / ZR / stick-press bits are built from the actions, never from the menu +// rows: a key given to "Menu: sort / sensor" must not press Attack, and rebinding Jump must not take Space away from the +// other actions that default to the same Switch button. A bit is set by the default binding of an action (still on its +// factory binding, so the game answers it from this bit) that reads that button. The menus keep using the menu rows. +#define ACT_RAW_SLOTS ((1u << BIND_A) | (1u << BIND_B) | (1u << BIND_X) | (1u << BIND_Y) | (1u << BIND_LSTICK) | \ + (1u << BIND_RSTICK) | (1u << BIND_L) | (1u << BIND_R) | (1u << BIND_ZL) | (1u << BIND_ZR)) +uint64_t act_raw_slots(void) { return ACT_RAW_SLOTS; } +// Only once the game has asked about an action (its hook is there); until then, and for game versions without the hook, +// the menu rows keep driving every button as before. +bool act_play_active(void) { return k_masks != NULL; } + +uint64_t act_play_keys(int (*held)(int scancode)) { + uint64_t out = 0; + for (int id = 0; id < ACT_COUNT; id++) { + int slot = act_switch_button(id), k = g_act_key[id]; + if (slot < 0 || !(ACT_RAW_SLOTS >> slot & 1) || (a_custom >> id & 1)) continue; + if (k > 0 && held(k)) out |= 1ull << slot; + } + return out; +} + +uint64_t act_play_pads(uint32_t host_buttons) { + uint64_t out = 0; + for (int id = 0; id < ACT_COUNT; id++) { + int slot = act_switch_button(id), k = g_act_pad[id]; + if (slot < 0 || !(ACT_RAW_SLOTS >> slot & 1) || (a_custom >> id & 1)) continue; + if (k >= 0 && k < PADB_HOST_COUNT && (host_buttons >> k & 1)) out |= 1ull << slot; + } + return out; +} + int act_prompt_host(int dev, int sw) { const int16_t *actions = dev == BIND_DEV_PAD ? g_act_pad : g_act_key; int host = -1; @@ -716,39 +739,6 @@ uint64_t act_scan_pad(uint64_t pad_buttons, uint32_t host_buttons) { return out; } -static bool act_held_host(int id, int (*held)(int scancode), uint32_t host) { - if (id < 0 || id >= ACT_COUNT) return false; - int k = g_act_key[id], k2 = g_act_key2[id], p = g_act_pad[id], p2 = g_act_pad2[id]; - return (k > 0 && held && held(k)) || (k2 > 0 && held && held(k2)) || - (p >= 0 && p < PADB_HOST_COUNT && (host >> p & 1)) || - (p2 >= 0 && p2 < PADB_HOST_COUNT && (host >> p2 & 1)); -} - -// During gameplay, decouple in-game action buttons (Y/X/A/B) from raw menu rebinds -// so that rebinding a menu slot (e.g. "Menu: sort / sensor") never hijacks actions in play. -// Only the raw keyboard/pad mask is rewritten; script/console/cursor/auto-continue bits stay untouched. -uint64_t act_gameplay_buttons(uint64_t raw, int (*held)(int scancode), uint32_t host) { - raw &= ~((1ull << BIND_Y) | (1ull << BIND_X) | (1ull << BIND_A) | (1ull << BIND_B)); - if (act_held_host(3, held, host) || act_held_host(36, held, host)) raw |= 1ull << BIND_Y; - if (act_held_host(2, held, host)) raw |= 1ull << BIND_X; - if (act_held_host(0, held, host)) raw |= 1ull << BIND_A; - if (act_held_host(12, held, host) || act_held_host(14, held, host)) raw |= 1ull << BIND_B; - // ZL and ZR too, once Guard / lock on (13) or Bow (18) answers from its own bindings: the game also reads ZL and - // ZR as buttons, not only through those actions (the shield held up, the lock-on kept), so a moved Menu: previous - // tab 2 / next tab 2 went on guarding in play and Guard's own key did half of it (#1103). Factory defaults leave - // the raw input as it is: the two are the same key then. - uint64_t custom = a_custom; - if (custom >> 13 & 1) { - raw &= ~(1ull << BIND_ZL); - if (act_held_host(13, held, host)) raw |= 1ull << BIND_ZL; - } - if (custom >> 18 & 1) { - raw &= ~(1ull << BIND_ZR); - if (act_held_host(18, held, host)) raw |= 1ull << BIND_ZR; - } - return raw; -} - // Each side publishes its own half (the keyboard and the controller change at different times) void act_publish(uint64_t keys, uint64_t pads) { if (keys != ~0ull) a_keys = keys; diff --git a/runtime/hle/input.c b/runtime/hle/input.c index 0dcaf3ef9..5d2c66351 100644 --- a/runtime/hle/input.c +++ b/runtime/hle/input.c @@ -41,6 +41,7 @@ enum { _Static_assert(BTN_DOWN == BIND_DOWN && BTN_ZL == BIND_ZL, "bindings follow the button bits"); static _Atomic uint64_t key_buttons, pad_buttons; +static _Atomic uint64_t key_play, pad_play; // the same in play: the action-driven bits replace the menu rows' (act_play_keys) // A contextual action consumes a held button until release, while observers // still read the raw snapshot to detect the next physical press. static _Atomic uint64_t consumed_buttons; @@ -191,6 +192,7 @@ static void recompute_keyboard(void) { for (int i = 0; i < BIND_PAD_COUNT; i++) if (game_key_slot(i)) b |= 1ull << i; key_buttons = b; + key_play = (b & ~act_raw_slots()) | act_play_keys(game_key); act_publish(act_scan_keys(b, game_key), ~0ull); // actions read their own host keys int tilt = game_key_slot(BIND_WALK) ? 13107 : 32767; // walk: 40% (BOTW walks below about half) key_lx = (game_key_slot(BIND_LS_RIGHT) - game_key_slot(BIND_LS_LEFT)) * tilt; @@ -219,6 +221,7 @@ static void dead_zone(_Atomic int32_t *x, _Atomic int32_t *y, int32_t rx, int32_ static void recompute_pad(void) { if (!pad_focused() && !host_test) { pad_buttons = 0; + pad_play = 0; host_buttons = 0; recompute_motion(); act_publish(~0ull, 0); @@ -264,6 +267,7 @@ static void recompute_pad(void) { freecam_pad_buttons(host); } pad_buttons = 0; + pad_play = 0; host_buttons = 0; // (the bindings see nothing either: the free camera has the controller) recompute_motion(); act_publish(~0ull, 0); @@ -281,6 +285,7 @@ static void recompute_pad(void) { if ((g_bind_pad[i] >= 0 && g_bind_pad[i] < PADB_HOST_COUNT && (host >> g_bind_pad[i] & 1)) || (g_bind_pad2[i] >= 0 && g_bind_pad2[i] < PADB_HOST_COUNT && (host >> g_bind_pad2[i] & 1))) b |= 1ull << i; pad_buttons = b; + pad_play = (b & ~act_raw_slots()) | act_play_pads(host); act_publish(~0ull, act_scan_pad(b, host)); // actions read their own host buttons // Fly mode (test builds): the press of its controller button toggles it. Not while the menu or a rebind has the pad // (the held state is still tracked, so letting go of a button that was just bound does not toggle). @@ -1255,10 +1260,10 @@ static bool ui_menu_active(void) { uint64_t input_buttons_now(void) { bool muted = (!win_focused && !host_test) || menu_input_captured(); bool pad_muted = (!pad_focused() && !host_test) || menu_input_captured(); - uint64_t raw = (muted ? 0 : key_buttons) | (pad_muted ? 0 : pad_buttons); - if (!pad_muted && !ui_menu_active() && !pc_cursor_active()) - raw = act_gameplay_buttons(raw, game_key, host_buttons); - uint64_t b = raw | (muted ? 0 : escape_buttons) | script_buttons; + bool play = !pad_muted && !ui_menu_active() && !pc_cursor_active() && act_play_active(); + uint64_t kbtn = muted ? 0 : (play ? key_play : key_buttons); + uint64_t pbtn = pad_muted ? 0 : (play ? pad_play : pad_buttons); + uint64_t b = kbtn | pbtn | (muted ? 0 : escape_buttons) | script_buttons; control_input_apply(&b, NULL, NULL, NULL, NULL); return b; } @@ -1399,12 +1404,13 @@ static void fill_state(Cpu *c) { // the window unfocused or the overlay up, use the Switch layer, so no binding can lock the player out. bool ui_menu = ui_menu_active(); uint64_t bow = pc_bow_sample(); + // In play the game's buttons come from the actions, not from the menu rows (act_play_keys); menus (and shops and + // dialogues) read the rows bool in_menu = pad_menu || ui_menu; - uint64_t kbtn = menu ? 0 : key_buttons; - uint64_t pbtn = pad_menu ? 0 : pad_buttons; - uint64_t raw = in_menu ? (kbtn | pbtn) - : act_gameplay_buttons(kbtn | pbtn, game_key, pad_menu ? 0 : host_buttons); - uint64_t b = raw | (menu ? 0 : escape_buttons | bow) | script_buttons; + bool acts = !in_menu && act_play_active(); + uint64_t kbtn = menu ? 0 : (acts ? key_play : key_buttons); + uint64_t pbtn = pad_menu ? 0 : (acts ? pad_play : pad_buttons); + uint64_t b = kbtn | pbtn | (menu ? 0 : escape_buttons | bow) | script_buttons; if (!menu) b |= auto_continue_buttons(b); // (not while the overlay has the controls) b=pc_cursor_buttons(b); // (Accessibility toggles: a menu, a cutscene or a talk lets go, so the shield or the bow isn't still up after it) diff --git a/runtime/input_bind.h b/runtime/input_bind.h index 4d4bfb838..2dd3d5082 100644 --- a/runtime/input_bind.h +++ b/runtime/input_bind.h @@ -74,7 +74,7 @@ bool bind_is_default(int dev); bool bind_is_default_slot(int dev, int slot); // "Click a binding, then press": begun from the UI; the next press (any thread's SDL event) is taken. Escape cancels, -// as does BIND_CAPTURE_MS without a press. On a conflict the two inputs swap. +// as does BIND_CAPTURE_MS without a press. Any input may share its key or button with another: nothing swaps. #define BIND_CAPTURE_MS 5000 void bind_capture_begin(int dev, int slot); void bind_capture_begin_alt(int dev, int slot, bool alt); @@ -84,7 +84,7 @@ void bind_capture_cancel(void); bool bind_capture_active(int *dev, int *slot, int *ms_left); // Main thread, before anything else sees the event: true = consumed by a capture bool bind_capture_event(const SDL_Event *e); -// Last change for the UI: 0 none, 1 set, 2 swapped (with *other), 3 cancelled, 4 timed out, 5 reset, 6 A / B swapped; *serial bumps +// Last change for the UI: 0 none, 1 set, 2 (unused: nothing swaps any more), 3 cancelled, 4 timed out, 5 reset, 6 A / B swapped; *serial bumps int bind_last_result(int *dev, int *slot, int *other, int *serial); // savagewind.ini: bind_pad_ / bind_key_ (only the ones that differ from the defaults are written) @@ -100,8 +100,9 @@ int bind_pad_from_name(const char *name); // Switch button (a table in the game: several actions share a button). Every action owns an explicit host key and // controller binding, initially copied from that button's factory defaults for 1.9.0. An action differing on either // device reads both host bindings directly. A factory-default action leaves the game to answer from its Switch layer, -// preserving JumpButtonChange and raw Switch injection. Before act_schema = 2, legacy ini raw-button rebinds migrate -// for action/device pairs without an act_* line. Menus also use the Switch layer. input.c publishes host state. +// preserving JumpButtonChange and raw Switch injection; in play that layer's bits come from the default actions, not from +// the menu rows (act_play_keys). Before act_schema = 2, legacy ini raw-button rebinds migrate for action/device pairs +// without an act_* line. Menus use the Switch layer, driven by the menu rows. input.c publishes host state. #define ACT_COUNT 41 enum { ACT_FOLLOW = -1, ACT_NONE = -2 }; extern int16_t g_act_key[ACT_COUNT]; // SDL_Scancode / BIND_MOUSE + button, or ACT_NONE @@ -150,10 +151,17 @@ uint64_t act_hud_slot_pane(int slot, const char *name); void act_masks(const uint32_t *table); // the game's table of one mask per action (its address, from the patch) void act_reset(void); // every action back to the default +// In play the game's A / B / X / Y / L / R / ZL / ZR / stick-press bits come from the actions (the default binding of every +// action still on its factory binding), never from the menu rows; the menus keep using the menu rows. act_play_active() +// is false until the game has asked about an action (and on game versions without the hook): then the rows drive everything. +bool act_play_active(void); +uint64_t act_raw_slots(void); // the BIND_* bits above (1 << slot) +uint64_t act_play_keys(int (*held)(int scancode)); // those bits, keyboard side +uint64_t act_play_pads(uint32_t host_buttons); // ... controller side + // Host state in, from runtime/hle/input.c. Main thread, on every key / button event: uint64_t act_scan_keys(uint64_t key_buttons, int (*held)(int scancode)); // actions the keyboard side holds uint64_t act_scan_pad(uint64_t pad_buttons, uint32_t host_buttons); // ... the controller side holds -uint64_t act_gameplay_buttons(uint64_t raw, int (*held)(int scancode), uint32_t host_buttons); // gameplay A/B/X/Y from action bindings void act_publish(uint64_t keys, uint64_t pads); // (bit per action) // The controller poll (game thread, once per GetNpadStates): freezes the held / pressed sets the game's queries see. // live = false in the game's menus, with the window unfocused or the overlay up: the Switch layer answers then. diff --git a/runtime/ui/controls_ui.mm b/runtime/ui/controls_ui.mm index 4d8eac834..6723450e5 100644 --- a/runtime/ui/controls_ui.mm +++ b/runtime/ui/controls_ui.mm @@ -3,7 +3,7 @@ // controller button and a key of its own: two actions can share one, and an action keeps the button of its Switch // input until it is given a binding. Below it the inputs no action covers (sticks, camera, motion, menus), and, folded, // the Switch buttons the actions follow. Select a binding, then press the new button / key (Esc or 5 s without a -// press cancels; a Switch input's button already in use swaps over). Drawn in whichever ImGui context is current. +// press cancels; a button already in use is shared). Drawn in whichever ImGui context is current. #include #include @@ -219,7 +219,7 @@ static void switch_table(const char *id, const int *order, int rows, int fam, in ImGui::TextUnformatted(line); ImGui::PushTextWrapPos(0); ImGui::TextDisabled("%s", tr("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button " - "that's already in use swaps with the old one.")); + "that's already in use can be shared.")); ImGui::PopTextWrapPos(); int cd, cs, ms; @@ -233,20 +233,16 @@ static void switch_table(const char *id, const int *order, int rows, int fam, in if (serial != seen_serial) { seen_serial = serial; const char *now = rslot < 0 ? "" : slot_binding(rdev, rslot, fam); - char name[64] = "", other[64] = ""; + char name[64] = ""; if (rslot >= 0) slot_name(rslot, name, sizeof name); - if (rother >= 0) slot_name(rother, other, sizeof other); if (kind == 5) snprintf(msg, sizeof msg, "%s", tr(rdev == BIND_DEV_PAD ? "Controller bindings reset to the defaults." : "Keyboard bindings reset to the defaults.")); else if (kind == 1) snprintf(msg, sizeof msg, tr("%s is now %s."), name, now); - else if (kind == 2) - snprintf(msg, sizeof msg, tr("%s is now %s; %s moved to %s (swapped)."), name, now, other, - slot_binding(rdev, rother, fam)); else if (kind == 3) snprintf(msg, sizeof msg, tr("Cancelled: %s unchanged."), name); else if (kind == 4) snprintf(msg, sizeof msg, tr("Nothing pressed: %s unchanged."), name); else if (kind == 6) snprintf(msg, sizeof msg, "%s", tr("A and B swapped, with the actions on them.")); - if (kind == 1 || kind == 2 || kind == 5 || kind == 6) settings_save(); + if (kind == 1 || kind == 5 || kind == 6) settings_save(); } if (msg[0]) ImGui::TextColored(ImGui::ColorConvertU32ToFloat4(UI_ACCENT_LIGHT), "%s", msg); diff --git a/runtime/ui/i18n/de.inc b/runtime/ui/i18n/de.inc index fc35a2e06..cbcceb8e1 100644 --- a/runtime/ui/i18n/de.inc +++ b/runtime/ui/i18n/de.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "X / Y tauschen") T("Controller: %s (%s button names)", "Controller: %s (Knopfnamen: %s)") T("connected", "verbunden") T("No controller connected (%s button names shown)", "Kein Controller verbunden (Knopfnamen: %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Wähle eine Belegung und drücke dann den neuen Knopf oder die neue Taste. Esc (oder 5 Sekunden) bricht ab. Ein bereits belegter Knopf wird mit dem alten getauscht.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Wähle eine Belegung und drücke dann den neuen Knopf oder die neue Taste. Esc (oder 5 Sekunden) bricht ab. Ein bereits belegter Knopf kann mehrfach verwendet werden.") T("Controller bindings reset to the defaults.", "Controller-Belegung auf Standard zurückgesetzt.") T("Keyboard bindings reset to the defaults.", "Tastaturbelegung auf Standard zurückgesetzt.") T("%s is now %s.", "%s ist jetzt %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s ist jetzt %s; %s liegt jetzt auf %s (getauscht).") T("Cancelled: %s unchanged.", "Abgebrochen: %s unverändert.") T("Nothing pressed: %s unchanged.", "Nichts gedrückt: %s unverändert.") T("A and B swapped, with the actions on them.", "A und B getauscht, samt ihrer Aktionen.") diff --git a/runtime/ui/i18n/es.inc b/runtime/ui/i18n/es.inc index 4bb1a14b4..2b1de470a 100644 --- a/runtime/ui/i18n/es.inc +++ b/runtime/ui/i18n/es.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "Intercambiar X / Y") T("Controller: %s (%s button names)", "Mando: %s (nombres de botones de %s)") T("connected", "conectado") T("No controller connected (%s button names shown)", "Ningún mando conectado (se muestran los nombres de botones de %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Elige una asignación y pulsa el nuevo botón o tecla. Esc (o 5 segundos) cancela. Un botón que ya está en uso se intercambia con el anterior.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Elige una asignación y pulsa el nuevo botón o tecla. Esc (o 5 segundos) cancela. Un botón que ya está en uso se puede compartir.") T("Controller bindings reset to the defaults.", "Asignaciones del mando restablecidas a las predeterminadas.") T("Keyboard bindings reset to the defaults.", "Asignaciones del teclado restablecidas a las predeterminadas.") T("%s is now %s.", "%s ahora es %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s ahora es %s; %s pasó a %s (intercambiados).") T("Cancelled: %s unchanged.", "Cancelado: %s sin cambios.") T("Nothing pressed: %s unchanged.", "No se pulsó nada: %s sin cambios.") T("A and B swapped, with the actions on them.", "A y B intercambiados, con sus acciones.") diff --git a/runtime/ui/i18n/fr.inc b/runtime/ui/i18n/fr.inc index ea4e2cc0a..0c6338576 100644 --- a/runtime/ui/i18n/fr.inc +++ b/runtime/ui/i18n/fr.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "Inverser X / Y") T("Controller: %s (%s button names)", "Manette : %s (noms des boutons %s)") T("connected", "connectée") T("No controller connected (%s button names shown)", "Aucune manette connectée (noms des boutons %s affichés)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Choisissez une commande, puis appuyez sur le nouveau bouton ou la nouvelle touche. Échap (ou 5 secondes) annule. Un bouton déjà utilisé est échangé avec l'ancien.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Choisissez une commande, puis appuyez sur le nouveau bouton ou la nouvelle touche. Échap (ou 5 secondes) annule. Un bouton déjà utilisé peut être partagé.") T("Controller bindings reset to the defaults.", "Commandes de la manette réinitialisées.") T("Keyboard bindings reset to the defaults.", "Commandes du clavier réinitialisées.") T("%s is now %s.", "%s est maintenant %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s est maintenant %s ; %s passe à %s (échangés).") T("Cancelled: %s unchanged.", "Annulé : %s inchangé.") T("Nothing pressed: %s unchanged.", "Rien n'a été pressé : %s inchangé.") T("A and B swapped, with the actions on them.", "A et B échangés, avec leurs actions.") diff --git a/runtime/ui/i18n/he.inc b/runtime/ui/i18n/he.inc index cfc610833..47791a856 100644 --- a/runtime/ui/i18n/he.inc +++ b/runtime/ui/i18n/he.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "החלף X / Y") T("Controller: %s (%s button names)", "בקר: %s (שמות כפתורים של %s)") T("connected", "מחובר") T("No controller connected (%s button names shown)", "אין בקר מחובר (מוצגים שמות כפתורים של %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "בחרו הקצאה ולחצו על הכפתור או המקש החדש. לביטול: Esc (או המתנה של 5 שניות). אם הכפתור כבר בשימוש, הוא מתחלף עם הכפתור הקודם.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "בחרו הקצאה ולחצו על הכפתור או המקש החדש. לביטול: Esc (או המתנה של 5 שניות). אפשר להשתמש באותו כפתור ליותר מהקצאה אחת.") T("Controller bindings reset to the defaults.", "הקצאות הבקר אופסו לברירת המחדל.") T("Keyboard bindings reset to the defaults.", "הקצאות המקלדת אופסו לברירת המחדל.") T("%s is now %s.", "ההקצאה החדשה של %s: %s.") -T("%s is now %s; %s moved to %s (swapped).", "ההקצאה החדשה של %s: %s, ושל %s: %s (הוחלפו).") T("Cancelled: %s unchanged.", "בוטל: ההקצאה של %s לא השתנתה.") T("Nothing pressed: %s unchanged.", "לא נלחץ שום דבר: ההקצאה של %s לא השתנתה.") T("A and B swapped, with the actions on them.", "A ו-B הוחלפו, יחד עם הפעולות שלהם.") diff --git a/runtime/ui/i18n/it.inc b/runtime/ui/i18n/it.inc index bac714e78..bed36fe71 100644 --- a/runtime/ui/i18n/it.inc +++ b/runtime/ui/i18n/it.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "Scambia X / Y") T("Controller: %s (%s button names)", "Controller: %s (nomi dei pulsanti %s)") T("connected", "connesso") T("No controller connected (%s button names shown)", "Nessun controller connesso (nomi dei pulsanti %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Scegli un'assegnazione, poi premi il nuovo pulsante o tasto. Esc (o 5 secondi) annulla. Un pulsante già in uso viene scambiato con quello vecchio.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Scegli un'assegnazione, poi premi il nuovo pulsante o tasto. Esc (o 5 secondi) annulla. Un pulsante già in uso può essere condiviso.") T("Controller bindings reset to the defaults.", "Assegnazioni del controller ripristinate.") T("Keyboard bindings reset to the defaults.", "Assegnazioni della tastiera ripristinate.") T("%s is now %s.", "%s ora è %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s ora è %s; %s passa a %s (scambiati).") T("Cancelled: %s unchanged.", "Annullato: %s invariato.") T("Nothing pressed: %s unchanged.", "Nessun input: %s invariato.") T("A and B swapped, with the actions on them.", "A e B scambiati, con le loro azioni.") diff --git a/runtime/ui/i18n/ja.inc b/runtime/ui/i18n/ja.inc index ce6d045e3..abd4e7ab8 100644 --- a/runtime/ui/i18n/ja.inc +++ b/runtime/ui/i18n/ja.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "X / Y を入れ替え") T("Controller: %s (%s button names)", "コントローラー:%s (%sのボタン名)") T("connected", "接続済み") T("No controller connected (%s button names shown)", "コントローラー未接続 (%sのボタン名を表示)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "割り当てを選んでから、新しいボタンかキーを押してください。Esc(または5秒)でキャンセルします。すでに使われているボタンは元のボタンと入れ替わります。") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "割り当てを選んでから、新しいボタンかキーを押してください。Esc(または5秒)でキャンセルします。すでに使われているボタンも共有できます。") T("Controller bindings reset to the defaults.", "コントローラーの割り当てを初期設定に戻しました。") T("Keyboard bindings reset to the defaults.", "キーボードの割り当てを初期設定に戻しました。") T("%s is now %s.", "%sを%sにしました。") -T("%s is now %s; %s moved to %s (swapped).", "%sを%sにしました。%sは%sに移動しました(入れ替え)。") T("Cancelled: %s unchanged.", "キャンセル:%sは変更されていません。") T("Nothing pressed: %s unchanged.", "入力なし:%sは変更されていません。") T("A and B swapped, with the actions on them.", "AとBを入れ替えました(割り当てたアクションも)。") diff --git a/runtime/ui/i18n/ko.inc b/runtime/ui/i18n/ko.inc index ae67ff858..10bde8e94 100644 --- a/runtime/ui/i18n/ko.inc +++ b/runtime/ui/i18n/ko.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "X / Y 바꾸기") T("Controller: %s (%s button names)", "컨트롤러: %s (%s 버튼 이름)") T("connected", "연결됨") T("No controller connected (%s button names shown)", "연결된 컨트롤러 없음 (%s 버튼 이름 표시)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "할당할 항목을 선택한 다음 새 버튼이나 키를 누르세요. Esc(또는 5초)로 취소합니다. 이미 사용 중인 버튼은 이전 버튼과 서로 바뀝니다.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "할당할 항목을 선택한 다음 새 버튼이나 키를 누르세요. Esc(또는 5초)로 취소합니다. 이미 사용 중인 버튼도 함께 사용할 수 있습니다.") T("Controller bindings reset to the defaults.", "컨트롤러 할당을 기본값으로 되돌렸습니다.") T("Keyboard bindings reset to the defaults.", "키보드 할당을 기본값으로 되돌렸습니다.") T("%s is now %s.", "%s: 이제 %s입니다.") -T("%s is now %s; %s moved to %s (swapped).", "%s: 이제 %s입니다. %s: %s(으)로 옮겼습니다(교체).") T("Cancelled: %s unchanged.", "취소됨: %s 변경 없음.") T("Nothing pressed: %s unchanged.", "입력 없음: %s 변경 없음.") T("A and B swapped, with the actions on them.", "A와 B를 바꿨습니다 (할당된 동작 포함).") diff --git a/runtime/ui/i18n/nl.inc b/runtime/ui/i18n/nl.inc index 192ef386b..7ead52a7b 100644 --- a/runtime/ui/i18n/nl.inc +++ b/runtime/ui/i18n/nl.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "X / Y wisselen") T("Controller: %s (%s button names)", "Controller: %s (knopnamen van %s)") T("connected", "verbonden") T("No controller connected (%s button names shown)", "Geen controller verbonden (knopnamen van %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Kies een toewijzing en druk dan op de nieuwe knop of toets. Esc (of 5 seconden) annuleert. Een knop die al in gebruik is, wisselt met de oude.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Kies een toewijzing en druk dan op de nieuwe knop of toets. Esc (of 5 seconden) annuleert. Een knop die al in gebruik is, kan gedeeld worden.") T("Controller bindings reset to the defaults.", "Controllertoewijzingen teruggezet naar de standaard.") T("Keyboard bindings reset to the defaults.", "Toetsenbordtoewijzingen teruggezet naar de standaard.") T("%s is now %s.", "%s is nu %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s is nu %s; %s is verplaatst naar %s (gewisseld).") T("Cancelled: %s unchanged.", "Geannuleerd: %s ongewijzigd.") T("Nothing pressed: %s unchanged.", "Niets ingedrukt: %s ongewijzigd.") T("A and B swapped, with the actions on them.", "A en B gewisseld, met hun acties.") diff --git a/runtime/ui/i18n/pt.inc b/runtime/ui/i18n/pt.inc index e01d2eabb..83dac69c8 100644 --- a/runtime/ui/i18n/pt.inc +++ b/runtime/ui/i18n/pt.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "Trocar X / Y") T("Controller: %s (%s button names)", "Controle: %s (nomes dos botões de %s)") T("connected", "conectado") T("No controller connected (%s button names shown)", "Nenhum controle conectado (nomes dos botões de %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Escolha um comando e pressione o novo botão ou tecla. Esc (ou 5 segundos) cancela. Um botão que já está em uso troca de lugar com o anterior.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Escolha um comando e pressione o novo botão ou tecla. Esc (ou 5 segundos) cancela. Um botão que já está em uso pode ser compartilhado.") T("Controller bindings reset to the defaults.", "Comandos do controle restaurados para o padrão.") T("Keyboard bindings reset to the defaults.", "Comandos do teclado restaurados para o padrão.") T("%s is now %s.", "%s agora é %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s agora é %s; %s passou para %s (trocados).") T("Cancelled: %s unchanged.", "Cancelado: %s sem alterações.") T("Nothing pressed: %s unchanged.", "Nada pressionado: %s sem alterações.") T("A and B swapped, with the actions on them.", "A e B trocados, com as suas ações.") diff --git a/runtime/ui/i18n/ru.inc b/runtime/ui/i18n/ru.inc index 096a4c2fc..3af96f6d9 100644 --- a/runtime/ui/i18n/ru.inc +++ b/runtime/ui/i18n/ru.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "Поменять X / Y") T("Controller: %s (%s button names)", "Контроллер: %s (названия кнопок %s)") T("connected", "подключён") T("No controller connected (%s button names shown)", "Контроллер не подключён (названия кнопок %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Выберите назначение и нажмите новую кнопку или клавишу. Esc (или 5 секунд) — отмена. Уже занятая кнопка меняется местами со старой.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Выберите назначение и нажмите новую кнопку или клавишу. Esc (или 5 секунд) — отмена. Уже занятую кнопку можно использовать повторно.") T("Controller bindings reset to the defaults.", "Назначения контроллера сброшены.") T("Keyboard bindings reset to the defaults.", "Назначения клавиатуры сброшены.") T("%s is now %s.", "%s теперь %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s теперь %s; %s перенесено на %s (обмен).") T("Cancelled: %s unchanged.", "Отменено: %s без изменений.") T("Nothing pressed: %s unchanged.", "Ничего не нажато: %s без изменений.") T("A and B swapped, with the actions on them.", "A и B поменяны местами вместе с их действиями.") diff --git a/runtime/ui/i18n/th.inc b/runtime/ui/i18n/th.inc index 295cb1ff3..b62941dd4 100644 --- a/runtime/ui/i18n/th.inc +++ b/runtime/ui/i18n/th.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "สลับ X / Y") T("Controller: %s (%s button names)", "คอนโทรลเลอร์: %s (ชื่อปุ่มแบบ %s)") T("connected", "เชื่อมต่อแล้ว") T("No controller connected (%s button names shown)", "ไม่มีคอนโทรลเลอร์เชื่อมต่อ (แสดงชื่อปุ่มแบบ %s)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "เลือกการกำหนดปุ่ม แล้วกดปุ่มหรือแป้นใหม่ Esc (หรือ 5 วินาที) ยกเลิก ปุ่มที่ใช้อยู่แล้วจะสลับกับปุ่มเดิม") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "เลือกการกำหนดปุ่ม แล้วกดปุ่มหรือแป้นใหม่ Esc (หรือ 5 วินาที) ยกเลิก ปุ่มที่ใช้อยู่แล้วก็ใช้ร่วมกันได้") T("Controller bindings reset to the defaults.", "รีเซ็ตการกำหนดปุ่มคอนโทรลเลอร์เป็นค่าเริ่มต้นแล้ว") T("Keyboard bindings reset to the defaults.", "รีเซ็ตการกำหนดแป้นคีย์บอร์ดเป็นค่าเริ่มต้นแล้ว") T("%s is now %s.", "ตอนนี้ %s คือ %s") -T("%s is now %s; %s moved to %s (swapped).", "ตอนนี้ %s คือ %s; %s ย้ายไปที่ %s (สลับกัน)") T("Cancelled: %s unchanged.", "ยกเลิกแล้ว: %s ไม่เปลี่ยน") T("Nothing pressed: %s unchanged.", "ไม่มีการกด: %s ไม่เปลี่ยน") T("A and B swapped, with the actions on them.", "สลับ A และ B แล้ว รวมถึงการกระทำที่กำหนดไว้") diff --git a/runtime/ui/i18n/tr.inc b/runtime/ui/i18n/tr.inc index 6c59ce37e..bb6ab92a1 100644 --- a/runtime/ui/i18n/tr.inc +++ b/runtime/ui/i18n/tr.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "X / Y Yer Değiştir") T("Controller: %s (%s button names)", "Kontrolcü: %s (%s düğme adları)") T("connected", "bağlı") T("No controller connected (%s button names shown)", "Bağlı kontrolcü yok (%s düğme adları gösteriliyor)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "Bir atama seçin, ardından yeni düğmeye veya tuşa basın. Esc (veya 5 saniye) iptal eder. Zaten kullanılan bir düğme eskisiyle yer değiştirir.") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "Bir atama seçin, ardından yeni düğmeye veya tuşa basın. Esc (veya 5 saniye) iptal eder. Zaten kullanılan bir düğme paylaşılabilir.") T("Controller bindings reset to the defaults.", "Kontrolcü atamaları varsayılana sıfırlandı.") T("Keyboard bindings reset to the defaults.", "Klavye atamaları varsayılana sıfırlandı.") T("%s is now %s.", "%s artık %s.") -T("%s is now %s; %s moved to %s (swapped).", "%s artık %s; %s, %s tuşuna taşındı (yer değiştirildi).") T("Cancelled: %s unchanged.", "İptal edildi: %s değişmedi.") T("Nothing pressed: %s unchanged.", "Hiçbir tuşa basılmadı: %s değişmedi.") T("A and B swapped, with the actions on them.", "A ve B tuşları, üzerlerindeki eylemlerle birlikte yer değiştirildi.") diff --git a/runtime/ui/i18n/zh-Hans.inc b/runtime/ui/i18n/zh-Hans.inc index c6475f031..1a478413b 100644 --- a/runtime/ui/i18n/zh-Hans.inc +++ b/runtime/ui/i18n/zh-Hans.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "交换 X / Y") T("Controller: %s (%s button names)", "手柄:%s (%s按键名称)") T("connected", "已连接") T("No controller connected (%s button names shown)", "未连接手柄 (显示%s按键名称)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "选择一项按键设置,然后按下新的手柄按键或键盘按键。按Esc(或等待5秒)取消。已被占用的按键会与原来的按键互换。") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "选择一项按键设置,然后按下新的手柄按键或键盘按键。按Esc(或等待5秒)取消。已被占用的按键也可以共用。") T("Controller bindings reset to the defaults.", "手柄按键设置已恢复默认。") T("Keyboard bindings reset to the defaults.", "键盘按键设置已恢复默认。") T("%s is now %s.", "%s现在是%s。") -T("%s is now %s; %s moved to %s (swapped).", "%s现在是%s;%s改为%s(已互换)。") T("Cancelled: %s unchanged.", "已取消:%s未更改。") T("Nothing pressed: %s unchanged.", "未按下任何键:%s未更改。") T("A and B swapped, with the actions on them.", "已交换 A 和 B(包括其上的动作)。") diff --git a/runtime/ui/i18n/zh-Hant.inc b/runtime/ui/i18n/zh-Hant.inc index ceed6c427..9ff7785ee 100644 --- a/runtime/ui/i18n/zh-Hant.inc +++ b/runtime/ui/i18n/zh-Hant.inc @@ -13,11 +13,10 @@ T("Swap X / Y", "交換 X / Y") T("Controller: %s (%s button names)", "控制器:%s (%s按鈕名稱)") T("connected", "已連接") T("No controller connected (%s button names shown)", "未連接控制器 (顯示%s按鈕名稱)") -T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use swaps with the old one.", "選擇一項按鈕設定,然後按下新的控制器按鈕或鍵盤按鍵。按Esc(或等待5秒)取消。已被使用的按鈕會與原本的按鈕互換。") +T("Select a binding, then press the new button or key. Esc (or 5 seconds) cancels. A button that's already in use can be shared.", "選擇一項按鈕設定,然後按下新的控制器按鈕或鍵盤按鍵。按Esc(或等待5秒)取消。已被使用的按鈕也可以共用。") T("Controller bindings reset to the defaults.", "控制器按鈕設定已恢復預設值。") T("Keyboard bindings reset to the defaults.", "鍵盤按鍵設定已恢復預設值。") T("%s is now %s.", "%s現在是%s。") -T("%s is now %s; %s moved to %s (swapped).", "%s現在是%s;%s改為%s(已互換)。") T("Cancelled: %s unchanged.", "已取消:%s未變更。") T("Nothing pressed: %s unchanged.", "未按下任何按鍵:%s未變更。") T("A and B swapped, with the actions on them.", "已交換 A 和 B(包括其上的動作)。") diff --git a/tools/test_actions.c b/tools/test_actions.c index 3d1facc66..2bdc2f39a 100644 --- a/tools/test_actions.c +++ b/tools/test_actions.c @@ -518,15 +518,15 @@ static void captures_allow_shared_action_inputs(void) { for (int id = 0; id < ACT_COUNT; id++) act_set(dev, id, raw[BIND_A]); for (int id = 0; id < ACT_COUNT; id++) assert(actions[id] == raw[BIND_A]); assert(raw[BIND_B] == host); - // Raw Switch slots still swap with each other without displacing any shared host actions. + // Menu rows share inputs like actions: nothing swaps and no shared host action is displaced. int old_a = raw[BIND_A]; bind_capture_begin(dev, BIND_A); assert(bind_capture_event(&e)); - assert(raw[BIND_A] == host && raw[BIND_B] == old_a); + assert(raw[BIND_A] == host && raw[BIND_B] == host); for (int slot = BIND_WALK; slot <= BIND_GYRO_CENTER; slot++) assert(raw[slot] == host); for (int id = 0; id < ACT_COUNT; id++) assert(actions[id] == old_a); int other; - assert(bind_last_result(NULL, NULL, &other, NULL) == 2 && other == BIND_B); + assert(bind_last_result(NULL, NULL, &other, NULL) == 1 && other == -1); } } reset_bindings(); @@ -554,6 +554,63 @@ static void names_and_groups(void) { for (unsigned i = 0; i < sizeof raw / sizeof *raw; i++) assert(strcmp(bind_input_name(slot), raw[i])); } +// In play the raw A/B/X/Y bits come only from actions still at their factory binding, so a menu row never presses an +// action and a rebound action stops driving its old button, while the other actions on that button keep it. +static void play_bits_ignore_menu_rows(void) { + reset_bindings(); + act_masks(masks); + assert(act_play_active()); + int hy = g_bind_key[BIND_Y], hx = g_bind_key[BIND_X]; + key_down[hy] = 1; + assert(act_play_keys(held) >> BIND_Y & 1); // the factory key of Attack still gives raw Y + key_down[hy] = 0; + + // "Menu: sort" moved to another key: Attack keeps its own key and the new key presses nothing in play + g_bind_key[BIND_Y] = SDL_SCANCODE_Q; + key_down[SDL_SCANCODE_Q] = 1; + assert(!(act_play_keys(held) >> BIND_Y & 1)); + key_down[SDL_SCANCODE_Q] = 0; + key_down[hy] = 1; + assert(act_play_keys(held) >> BIND_Y & 1); + key_down[hy] = 0; + reset_bindings(); + + // Jump -> G: G is no longer raw X, the other X actions keep the factory X key. The factory binding of an action + // comes from the 1.9.0 table, so take another action whose factory key is X and let the live table agree. + reset_bindings(); + int twin = -1; + for (int id = 0; id < ACT_COUNT && twin < 0; id++) + if (id != JUMP && g_act_key[id] == hx && act_is_default(id)) twin = id; + assert(twin >= 0); + uint32_t saved = masks[twin]; + masks[twin] = masks[JUMP]; + act_set(BIND_DEV_KEY, JUMP, SDL_SCANCODE_G); + key_down[SDL_SCANCODE_G] = 1; + assert(!(act_play_keys(held) >> BIND_X & 1)); + key_down[SDL_SCANCODE_G] = 0; + key_down[hx] = 1; + assert(act_play_keys(held) >> BIND_X & 1); + key_down[hx] = 0; + masks[twin] = saved; + reset_bindings(); + + // The pad side does the same + uint32_t pad_y = 1u << g_act_pad[ATTACK]; + assert(act_play_pads(pad_y) >> BIND_Y & 1); + g_bind_pad[BIND_Y] = SDL_GAMEPAD_BUTTON_START; + assert(act_play_pads(pad_y) >> BIND_Y & 1); + assert(!(act_play_pads(1u << SDL_GAMEPAD_BUTTON_START) >> BIND_Y & 1)); + reset_bindings(); + + // D-pad / Plus / Minus are not isolated: they stay on their rows + assert(!(act_raw_slots() >> BIND_UP & 1) && !(act_raw_slots() >> BIND_PLUS & 1)); + + // Before the game asked about any action nothing is isolated + act_masks(NULL); + assert(!act_play_active()); + act_masks(masks); +} + static void swapped_jump_sprint_masks_keep_keyboard_bindings(void) { act_reset(); masks[2] = 0x2; // BOTW JumpButtonChange: Jump -> B @@ -750,36 +807,6 @@ static void bow_and_guard_swapped_on_mouse_and_key_leaves_lock_on_on_the_guard_k act_reset(); } -// #1103: Menu: previous tab 2 (ZL) on another key leaves Guard / lock on on its own in play, the game's raw ZL too -static void a_moved_menu_tab_leaves_guard_in_play(void) { - act_reset(); - bind_reset(BIND_DEV_KEY); - const int GUARD = 13, BOW = 18; - uint64_t zl = 1ull << BIND_ZL, zr = 1ull << BIND_ZR; - int guard_key = g_act_key[GUARD]; - key_down[guard_key] = 1; // factory defaults: the raw input as it comes - assert(act_gameplay_buttons(zl, held, 0) == zl); - key_down[guard_key] = 0; - bind_settings_load("act_schema", "2"); - bind_settings_load("bind_key_zl", "G"); - assert(g_bind_key[BIND_ZL] == SDL_SCANCODE_G && g_act_key[GUARD] == guard_key); - // the menu's key gives the raw ZL (key_buttons): in play it no longer reaches the game - key_down[SDL_SCANCODE_G] = 1; - assert(!(act_gameplay_buttons(zl, held, 0) & zl)); - key_down[SDL_SCANCODE_G] = 0; - key_down[guard_key] = 1; - assert(act_gameplay_buttons(0, held, 0) & zl); - key_down[guard_key] = 0; - // Bow on another key: ZR in play from it, not from Menu: next tab 2's - act_set(BIND_DEV_KEY, BOW, SDL_SCANCODE_H); - key_down[SDL_SCANCODE_H] = 1; - assert(act_gameplay_buttons(0, held, 0) & zr); - key_down[SDL_SCANCODE_H] = 0; - assert(!(act_gameplay_buttons(zr, held, 0) & zr)); - act_reset(); - bind_reset(BIND_DEV_KEY); -} - static void crouch_and_scope_require_a_hold_while_guarding(void) { const uint64_t guard = 1ull << BIND_ZL, crouch = 1ull << BIND_LSTICK, scope = 1ull << BIND_RSTICK; assert(act_poll(true, guard | crouch | scope, GUARD_ACTION_ON, GUARD_ACTION_ON) == (guard | crouch | scope)); @@ -865,12 +892,12 @@ int main(void) { host_pad_slots(); swap_ab_sets_the_xbox_convention(); names_and_groups(); + play_bits_ignore_menu_rows(); a_conversation_answer_does_not_jump(); guard_rebind_updates_hidden_lock_on(); a_reset_leaves_the_hidden_lock_on_check_following_guard(); bow_and_guard_swapped_on_mouse_and_key_leaves_lock_on_on_the_guard_key(); a_moved_menu_input_leaves_its_actions(); - a_moved_menu_tab_leaves_guard_in_play(); crouch_and_scope_require_a_hold_while_guarding(); puts("action bindings: default fallthrough, custom host bindings, schema migration, held / pressed, menus, shared keys, pad capture, contexts, A / B swap, reset and ini passed"); return 0; diff --git a/tools/test_bind_capture.c b/tools/test_bind_capture.c index aa1762268..99df6bdc6 100644 --- a/tools/test_bind_capture.c +++ b/tools/test_bind_capture.c @@ -61,7 +61,8 @@ int main(void) { e = (SDL_Event){0}; e.type = SDL_EVENT_GAMEPAD_BUTTON_UP; e.gbutton.button = SDL_GAMEPAD_BUTTON_EAST; release_to_game(e); waiting(); e.type = SDL_EVENT_GAMEPAD_BUTTON_DOWN; e.gbutton.button = SDL_GAMEPAD_BUTTON_SOUTH; - assert(bind_capture_event(&e)); ended(2); // B already uses the south button: swap + assert(bind_capture_event(&e)); ended(1); // B already uses the south button: shared, nothing swaps + assert(g_bind_pad[BIND_RIGHT] == SDL_GAMEPAD_BUTTON_SOUTH && g_bind_pad[BIND_B] == SDL_GAMEPAD_BUTTON_SOUTH); const int devices[] = {BIND_DEV_KEY, BIND_DEV_PAD}; for (unsigned i = 0; i < sizeof devices / sizeof *devices; i++) { @@ -91,7 +92,8 @@ int main(void) { e.gaxis.axis = SDL_GAMEPAD_AXIS_LEFT_TRIGGER; assert(bind_capture_event(&e)); assert(g_bind_pad[BIND_A] == PADB_LTRIGGER); - ended(2); // ZL already uses the left trigger + ended(1); // ZL already uses the left trigger: shared, nothing swaps + assert(g_bind_pad[BIND_ZL] == PADB_LTRIGGER); // Optional gyro bindings may overlap normal keys and each other without mutating existing bindings. bind_reset(BIND_DEV_KEY); int camera_up=g_bind_key[BIND_RS_UP]; diff --git a/tools/test_input_focus.c b/tools/test_input_focus.c index 7fb7bb864..047991ef9 100644 --- a/tools/test_input_focus.c +++ b/tools/test_input_focus.c @@ -63,8 +63,11 @@ void bind_reset(int dev) { (void)dev; unexpected_helper(); } // (per-action bindings: none here, the Switch layer answers) uint64_t act_scan_keys(uint64_t b, int (*held)(int)) { (void)b; (void)held; return 0; } uint64_t act_scan_pad(uint64_t b, uint32_t host) { (void)b; (void)host; return 0; } -uint64_t act_gameplay_buttons(uint64_t raw, int (*held)(int), uint32_t host) { (void)held; (void)host; return raw; } void act_publish(uint64_t keys, uint64_t pads) { (void)keys; (void)pads; } +bool act_play_active(void) { return false; } +uint64_t act_raw_slots(void) { return 0; } +uint64_t act_play_keys(int (*held)(int)) { (void)held; return 0; } +uint64_t act_play_pads(uint32_t host) { (void)host; return 0; } uint64_t act_poll(bool live, uint64_t buttons, int crouch_mode, int scope_mode) { (void)live; (void)crouch_mode; (void)scope_mode; return buttons; } diff --git a/tools/test_quick_drop_input.c b/tools/test_quick_drop_input.c index be2989651..059b48de3 100644 --- a/tools/test_quick_drop_input.c +++ b/tools/test_quick_drop_input.c @@ -10,6 +10,10 @@ #include "../runtime/quick_drop_action.c" Settings g_settings; +bool act_play_active(void) { return false; } +uint64_t act_raw_slots(void) { return 0; } +uint64_t act_play_keys(int (*held)(int)) { (void)held; return 0; } +uint64_t act_play_pads(uint32_t host) { (void)host; return 0; } uint64_t act_poll(bool live, uint64_t buttons, int crouch_mode, int scope_mode) { (void)live; (void)crouch_mode; (void)scope_mode; return buttons; }