Idea: mod API: the pad as the game was given it (taps and recordings in), for mods and engine callbacks #2641

Open
opened 2026-11-27 01:53:40 +00:00 by dyst · 1 comment
Member

The idea

A mod API read of the pad as the game was given it: the buttons the game's last controller read handed it, the
player's input with the host's taps and the input recordings in (the host already keeps it, hos_hid_buttons in
host/nn_hid.c, written at each read; the cheats use it for their button conditions).

What the API has today reads the player's controller before any mod (host_sys::input::pad_read, hos_pad_last) or
presses for the game (input.press). Neither says what the game itself saw, which is what a mod reacting to a button
inside the game's own screens needs: a tap from the menus' mouse (a click on a prompt taps its button), a
recording's press, or the player's, as one.

Proposed:

  • native: host_sys::input::buttons_given() -> u64 (HidNpadButton bits), any thread, one relaxed load: usable from an
    engine callback on a worker thread, where no API service reaches;
  • script: input.given() (the API's button order), at the frame's serial point;
  • a permission tier alongside the pad reads (input.read).

Anything else

First user: the save slots system mod on mod-api (branch feat/save-slots-mod, not yet a PR) reads X and B while
the game's save list waits, at an engine callback on the button wait's request; X must also come from a click on its
prompt, which taps X. It binds hos_hid_buttons in host-sys (with a settable fake) for now; this issue is to make
that a public part of the API rather than one mod's binding.

Prior work: none found (searched hid_buttons, buttons given, pad state).

### The idea A mod API read of **the pad as the game was given it**: the buttons the game's last controller read handed it, the player's input with the host's taps and the input recordings in (the host already keeps it, `hos_hid_buttons` in `host/nn_hid.c`, written at each read; the cheats use it for their button conditions). What the API has today reads the player's controller before any mod (`host_sys::input::pad_read`, `hos_pad_last`) or presses for the game (`input.press`). Neither says what the game itself saw, which is what a mod reacting to a button **inside the game's own screens** needs: a tap from the menus' mouse (a click on a prompt taps its button), a recording's press, or the player's, as one. Proposed: - native: `host_sys::input::buttons_given() -> u64` (HidNpadButton bits), any thread, one relaxed load: usable from an engine callback on a worker thread, where no API service reaches; - script: `input.given()` (the API's button order), at the frame's serial point; - a permission tier alongside the pad reads (`input.read`). ### Anything else First user: the save slots system mod on `mod-api` (branch `feat/save-slots-mod`, not yet a PR) reads X and B while the game's save list waits, at an engine callback on the button wait's request; X must also come from a click on its prompt, which taps X. It binds `hos_hid_buttons` in `host-sys` (with a settable fake) for now; this issue is to make that a public part of the API rather than one mod's binding. Prior work: none found (searched `hid_buttons`, `buttons given`, `pad state`).
Member

Possibly related, for context:

  • PR #1958 feat(mods): the Modding API: TypeScript mods the game compiles and sandboxes, system mods, a Mods tab, hot reload, custom actors and in-game tests — Mod API implementation includes input reads and replay APIs; new idea proposes exposing the distinct buttons-given state.
Possibly related, for context: - PR #1958 feat(mods): the Modding API: TypeScript mods the game compiles and sandboxes, system mods, a Mods tab, hot reload, custom actors and in-game tests — Mod API implementation includes input reads and replay APIs; new idea proposes exposing the distinct buttons-given state.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#2641
No description provided.