Pad input: buttons to pad bits
Decoded from the Store build 1.3.25854.2 executable. Completes “Lock-on and targeting” and “Play camera → Sticks”.
Per-frame read (0x14028ea10 → 0x14028e710 per pad, up to 4): the platform wrapper (0x1400dda60) fills a state block laid out like the common PC gamepad state: u16 buttons at +4, trigger bytes at +6 (left) and +7 (right), s16 sticks at +8 (left x, left y, right x, right y). The game turns it into a 32-bit button word plus four stick values, kept per pad at 0x1405a5ce0 + pad × 0x30 (+0x1c word, +0x20 left x, +0x24 left y, +0x28 right x, +0x2c right y). A pad that is not connected gives all zeroes (flag byte per pad at 0x14054ca58).
- Triggers are digital: a trigger value ≥ 20 (of 255) counts as pressed.
- Buttons go through a 16-row table (0x1403dc710, rows of {pad bit, name pointer, source bit}, H: table read from the executable; the source bits are the common gamepad button bits, which matches the playtester’s known controls):
| Pad bit | Mask | Button |
|---|---|---|
| 0 / 1 / 2 / 3 | 0x1 / 0x2 / 0x4 / 0x8 | d-pad up / down / left / right |
| 4 | 0x10 | A |
| 5 | 0x20 | B |
| 7 | 0x80 | X |
| 8 | 0x100 | Y |
| 9 | 0x200 | right shoulder |
| 10 | 0x400 | left trigger |
| 11 | 0x800 | right trigger |
| 12 | 0x1000 | Start |
| 13 | 0x2000 | Back |
| 24 | 0x1000000 | left stick click and left shoulder (both rows give the same bit) |
| 25 | 0x2000000 | right stick click |
- Stick directions as bits (threshold 15000 of 32767): bit 16 left stick up, 17 down, 18 left, 19 right; bit 20 right stick up, 21 down, 22 left, 23 right. Bit 6 is unused.
- Keyboard and mouse (active pad only, index 0x1403e0c74): a second word with the same bit layout (0x14054ca48, plus a one-frame word 0x14054ca40) is OR-ed into the button word; its direction bits 16..23 are turned into full stick deflection (±32767); mouse movement (0x14054ca44 / 0x14054ca5c) is added to the right stick x / y, at most 314670 per frame, with 13000 added so it clears the dead zone (M: the writers of these words, i.e. the key bindings, were not read).
Pad objects (4 × 0x34 bytes at 0x14059b800, update 0x1401d1250 once per frame):
| Offset | Meaning |
|---|---|
| +0x0 | held (the button word) |
| +0x4 | pressed = held now and not the frame before |
| +0x8 | repeat = pressed, then again every
interval frames while held after
delay frames |
| +0xc | held the frame before |
| +0x10 / +0x11 | repeat delay / repeat interval (bytes) |
| +0x14 | 32 countdown bytes, one per bit |
Menus read pressed / repeat; the character input fill (0x140256580) copies held into the character (C + 0x1425c) and makes its own previous / pressed pair there.
Pad bit → action in a battle (from the sections that read each bit):
| Bit | Button | Action | Where |
|---|---|---|---|
| 0x800 | right trigger | lock (toggle / hold by option) | “Lock-on and targeting” |
| 0x400 | left trigger | switch target; also the spectator’s next-player | “Lock-on”, “Play camera” |
| 0x1000000 | left stick click or left shoulder | the character’s evade / jump | “The evade” |
| 0x2000000 | right stick click | camera re-centre | “Play camera” |
| 0x10 / 0x20 / 0x80 / 0x100 | A / B / X / Y | the four skill buttons (M: which bit is which slot follows the skill record’s button field; not re-read here) | “Skill table” |
| sticks | left / right | move / camera (dead zone 13000, ÷ 19767) | “Play camera → Sticks” |
Lock options: three bytes at 0x14052dfb7 (lock button mode 0 toggle / 1 hold / 2 hold and keep), 0x14052dfb8 (switch by distance order) and 0x14052dfb9 (teammates lockable); all 0 on a fresh save.
Not decoded: right shoulder (0x200), Start, Back and the d-pad in a battle (pause, deck view and chat are the candidates; L); the options screen entries that write the three lock bytes; the keyboard bindings; the sort direction of the distance-ordered switch.
Implementation notes for the rebuild
- Bind: RT lock, LT switch target, L3 and LB evade / jump, R3 camera re-centre, A / B / X / Y the four skills. Triggers digital at 20 / 255.
- Keep one held word per player per tick and derive pressed = held and not previous; that is all the battle code uses. Menus want the repeat word.
- Stick-as-button threshold 15000 is for menus; movement uses the analogue values.