@gameslate/sdk 0.3.31 → 0.3.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -90,6 +90,14 @@ the input `downloads/<id>`; the player sees it among the plugin's permissions.
90
90
 
91
91
  `0.3.x` speaks plugin contract (`sdkApi`) 3: new 0.3 versions add tools, never change the contract. The core refuses a plugin built for another contract.
92
92
 
93
+ - **0.3.32**: the per-game README's `## Known Gaps` section is now `## Limitations`, and the
94
+ support check refuses one with no bullets, a top-level bullet that doesn't start with
95
+ `**Not tracked:**`, `**Not shown:**`, `**Can be wrong:**` or `**Not supported:**`, or those
96
+ labels out of order (the build skill, §7, says what goes under each). `QuickJsGuest` and
97
+ `PluginSandbox` (from `@gameslate/sdk/host`) take an optional `now: () => number` clock, in
98
+ milliseconds, that their time budgets are kept by, so a test can drive the budget on its own
99
+ clock. Left out, it is `performance.now()`: monotonic, so a step of the wall clock (WSL, NTP)
100
+ can't interrupt a healthy plugin.
93
101
  - **0.3.27**: \`runInSandbox(code, dir, budgetMs)\` from \`@gameslate/sdk/build\`, for tests: bundles
94
102
  \`code\` and runs it in QuickJS as the core does, so a cost only the sandbox has (a string built
95
103
  by \`+=\`) fails a test instead of a player's build.
@@ -0,0 +1,2 @@
1
+ /** Checks the Limitations section's shape: labelled top-level bullets, labels in order. */
2
+ export declare function checkLimitationsSection(body: string, problems: string[]): void;
@@ -0,0 +1,70 @@
1
+ /*
2
+ * The per-game README's `## Limitations` section: what a player will find incomplete or wrong,
3
+ * one labelled bullet per limitation, so every game's list reads the same way.
4
+ */
5
+ const LIMITATIONS_HEADING = '## Limitations';
6
+ /* every top-level Limitations bullet opens with one of these, in this order (player's view first) */
7
+ const LIMITATION_LABELS = [
8
+ '**Not tracked:**',
9
+ '**Not shown:**',
10
+ '**Can be wrong:**',
11
+ '**Not supported:**',
12
+ ];
13
+ /* Markdown's top level: up to 3 spaces before the marker; numbered items count too */
14
+ const TOP_LEVEL_BULLET = /^ {0,3}(?:[-*+]|\d+[.)])\s+(.*)$/;
15
+ /* `* * *`, `---`: a divider, not a bullet */
16
+ const THEMATIC_BREAK = /^ {0,3}([-*_])( *\1){2,} *$/;
17
+ const FENCE = /^ {0,3}(```|~~~)/;
18
+ const SECTION_END = /^ {0,3}#{1,2}\s/;
19
+ /* the top-level bullets between `## Limitations` and the next heading of level 1 or 2, outside
20
+ * code fences; undefined when there is no such section */
21
+ function findLimitationsBullets(body) {
22
+ const lines = body.split(/\r?\n/);
23
+ const start = lines.findIndex(l => l.trimEnd() === LIMITATIONS_HEADING);
24
+ if (start < 0)
25
+ return undefined;
26
+ const bullets = [];
27
+ let inFence = false;
28
+ for (const line of lines.slice(start + 1)) {
29
+ if (FENCE.test(line))
30
+ inFence = !inFence;
31
+ else if (inFence)
32
+ continue;
33
+ else if (SECTION_END.test(line))
34
+ break;
35
+ else if (!THEMATIC_BREAK.test(line)) {
36
+ const text = TOP_LEVEL_BULLET.exec(line)?.[1];
37
+ if (text !== undefined)
38
+ bullets.push(text);
39
+ }
40
+ }
41
+ return bullets;
42
+ }
43
+ /** Checks the Limitations section's shape: labelled top-level bullets, labels in order. */
44
+ export function checkLimitationsSection(body, problems) {
45
+ const bullets = findLimitationsBullets(body);
46
+ if (bullets === undefined)
47
+ return;
48
+ const labelList = LIMITATION_LABELS.join(', ');
49
+ if (bullets.length === 0) {
50
+ problems.push(`section "${LIMITATIONS_HEADING}" has no bullets: start each with ${labelList}`);
51
+ return;
52
+ }
53
+ let lastRank = 0;
54
+ bullets.forEach((text, i) => {
55
+ const rank = LIMITATION_LABELS.findIndex(label => text.startsWith(label));
56
+ const label = LIMITATION_LABELS[rank];
57
+ if (label === undefined) {
58
+ problems.push(`"${LIMITATIONS_HEADING}" bullet ${i + 1} doesn't start with ${labelList}: "${text.slice(0, 40)}"`);
59
+ }
60
+ else if (text.slice(label.length).trim() === '') {
61
+ problems.push(`"${LIMITATIONS_HEADING}" bullet ${i + 1} (${label}) says nothing after its label`);
62
+ }
63
+ else if (rank < lastRank) {
64
+ problems.push(`"${LIMITATIONS_HEADING}" bullet ${i + 1} (${label}) comes after ${LIMITATION_LABELS[lastRank]}: keep the labels in the order ${labelList}`);
65
+ }
66
+ else {
67
+ lastRank = rank;
68
+ }
69
+ });
70
+ }
@@ -4,7 +4,7 @@ import type { GamePack } from './pack.js';
4
4
  import { type GameManifest } from './registry.js';
5
5
  export declare const SUPPORT_TABLE_START = "<!-- gameslate:support-table:start -->";
6
6
  export declare const SUPPORT_TABLE_END = "<!-- gameslate:support-table:end -->";
7
- export declare const REQUIRED_SUPPORT_HEADINGS: readonly ["## Builds & Asset Extraction", "## Map", "## Vitals, Inventory, Missions & Reference", "## Known Gaps", "## Verification"];
7
+ export declare const REQUIRED_SUPPORT_HEADINGS: readonly ["## Builds & Asset Extraction", "## Map", "## Vitals, Inventory, Missions & Reference", "## Limitations", "## Verification"];
8
8
  export declare const SupportBuildSchema: z.ZodObject<{
9
9
  id: z.ZodString;
10
10
  label: z.ZodString;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { checkLimitationsSection } from './game-support-limitations.js';
2
3
  import { parseSupportYaml } from './game-support-yaml.js';
3
4
  import { pinRuleMatchesAt } from './pins.js';
4
5
  import { effectiveLandmarkKind } from './registry.js';
@@ -13,7 +14,7 @@ export const REQUIRED_SUPPORT_HEADINGS = [
13
14
  '## Builds & Asset Extraction',
14
15
  '## Map',
15
16
  '## Vitals, Inventory, Missions & Reference',
16
- '## Known Gaps',
17
+ '## Limitations',
17
18
  '## Verification',
18
19
  ];
19
20
  export const SupportBuildSchema = z.object({
@@ -121,6 +122,7 @@ export function parseGameSupportReadme(markdown) {
121
122
  lastPos = hm.index;
122
123
  }
123
124
  }
125
+ checkLimitationsSection(body, problems);
124
126
  return { support: parsed.data, body, problems };
125
127
  }
126
128
  /* a pin the app can mark collected or done from its own fields (web llm.ts `isLandmarkCollected`) */
@@ -1,5 +1,5 @@
1
1
  import { SignatureSchema, GameStateSchema, PackViewsSchema, SandboxDescriptionSchema, } from '../index.js';
2
- import { errorText, QuickJsGuest } from './quickjs-guest.js';
2
+ import { errorText, monotonicMs, QuickJsGuest } from './quickjs-guest.js';
3
3
  export { loadQuickJs } from './quickjs-guest.js';
4
4
  /*
5
5
  * The live sandbox (docs/plugin-architecture.md § The sandbox): each plugin's live code (packs and
@@ -50,7 +50,7 @@ export class PluginSandbox {
50
50
  this.code = code;
51
51
  this.name = name;
52
52
  this.log = opts.log;
53
- this.now = opts.now ?? Date.now;
53
+ this.now = opts.now ?? monotonicMs;
54
54
  this.wasm = opts.wasm ?? [];
55
55
  this.guest = this.newGuest();
56
56
  }
@@ -70,6 +70,7 @@ export class PluginSandbox {
70
70
  maxReadBytes: SANDBOX_LIMITS.maxReadBytes,
71
71
  },
72
72
  log,
73
+ now: this.now,
73
74
  });
74
75
  }
75
76
  /* A fresh runtime for a plugin that broke a limit, unless it has used up its restarts. Its
@@ -9,6 +9,7 @@ export interface GuestLimits {
9
9
  callMs: number;
10
10
  }
11
11
  export type HostFunction = (...args: QuickJSHandle[]) => QuickJSHandle | void;
12
+ export declare const monotonicMs: () => number;
12
13
  export declare const errorText: (e: unknown) => string;
13
14
  export declare class QuickJsGuest {
14
15
  private readonly opts;
@@ -17,6 +18,7 @@ export declare class QuickJsGuest {
17
18
  private readonly api;
18
19
  private disabled;
19
20
  private deadline;
21
+ private readonly now;
20
22
  private corrupted;
21
23
  constructor(quickJs: QuickJSWASMModule, opts: {
22
24
  name: string;
@@ -30,6 +32,8 @@ export declare class QuickJsGuest {
30
32
  /** the plugin's WebAssembly modules and what they may import */
31
33
  wasm?: WasmSetup;
32
34
  log: (line: string) => void;
35
+ /** the clock the budgets are kept by (milliseconds, monotonic by default); a test passes its own */
36
+ now?: () => number;
33
37
  });
34
38
  /** Calls a guest function within the budget; its JSON-able result, dumped to the host. */
35
39
  call(fn: string, args: ReadonlyArray<string | number>): unknown;
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import releaseSync from '@jitl/quickjs-wasmfile-release-sync';
6
- import { newQuickJSWASMModuleFromVariant, newVariant, shouldInterruptAfterDeadline, } from 'quickjs-emscripten-core';
6
+ import { newQuickJSWASMModuleFromVariant, newVariant, } from 'quickjs-emscripten-core';
7
7
  import { WasmInstances } from './wasm-host.js';
8
8
  /*
9
9
  * One piece of plugin code in its own QuickJS runtime (WebAssembly): no file system, network,
@@ -24,6 +24,9 @@ export async function loadQuickJs() {
24
24
  const wasmBinary = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
25
25
  return newQuickJSWASMModuleFromVariant(newVariant(releaseSync, { wasmBinary }));
26
26
  }
27
+ /* Budgets are kept on a monotonic clock: WSL and NTP step the wall clock, and a step
28
+ * forward interrupted a healthy plugin's load (2026-12-06). */
29
+ export const monotonicMs = () => performance.now();
27
30
  export const errorText = (e) => (e instanceof Error ? e.message : String(e));
28
31
  const CORRUPTED_GUESTS = [];
29
32
  export class QuickJsGuest {
@@ -32,13 +35,15 @@ export class QuickJsGuest {
32
35
  runtime;
33
36
  api;
34
37
  disabled = null;
35
- /* when the guest call running now must end (Date.now() time) */
38
+ /* when the guest call running now must end, by `now` */
36
39
  deadline = 0;
40
+ now;
37
41
  /* runaway guest recursion exhausts the host's stack mid-call and leaves the runtime holding
38
42
  * objects it can't account for: freeing it then aborts the whole QuickJS module */
39
43
  corrupted = false;
40
44
  constructor(quickJs, opts) {
41
45
  this.opts = opts;
46
+ this.now = opts.now ?? monotonicMs;
42
47
  this.runtime = quickJs.newRuntime();
43
48
  this.runtime.setMemoryLimit(opts.limits.memoryBytes);
44
49
  this.runtime.setMaxStackSize(opts.limits.stackBytes);
@@ -70,7 +75,7 @@ export class QuickJsGuest {
70
75
  call(fn, args) {
71
76
  if (this.disabled)
72
77
  throw new Error(`${this.opts.name} is switched off: ${this.disabled}`);
73
- const started = Date.now();
78
+ const started = this.now();
74
79
  try {
75
80
  return this.withBudget(this.opts.limits.callMs, () => this.callGuest(fn, args));
76
81
  }
@@ -83,7 +88,7 @@ export class QuickJsGuest {
83
88
  throw e;
84
89
  }
85
90
  finally {
86
- const ms = Date.now() - started;
91
+ const ms = this.now() - started;
87
92
  const budget = this.opts.limits.callMs;
88
93
  if (!this.disabled && ms > budget * 2) {
89
94
  this.disable(`${fn} took ${ms} ms (budget ${budget} ms)`);
@@ -129,7 +134,7 @@ export class QuickJsGuest {
129
134
  wasmFunctions(setup) {
130
135
  const vm = this.vm;
131
136
  const wasm = new WasmInstances(setup, reason => this.disable(reason));
132
- const left = () => this.deadline - Date.now();
137
+ const left = () => this.deadline - this.now();
133
138
  const text = (h) => {
134
139
  if (vm.typeof(h) !== 'string')
135
140
  throw new Error('a WebAssembly file is named by a string');
@@ -168,8 +173,9 @@ export class QuickJsGuest {
168
173
  };
169
174
  }
170
175
  withBudget(ms, run) {
171
- this.deadline = Date.now() + ms;
172
- this.runtime.setInterruptHandler(shouldInterruptAfterDeadline(this.deadline));
176
+ const deadline = this.now() + ms;
177
+ this.deadline = deadline;
178
+ this.runtime.setInterruptHandler(() => this.now() > deadline);
173
179
  try {
174
180
  return run();
175
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gameslate/sdk",
3
- "version": "0.3.31",
3
+ "version": "0.3.32",
4
4
  "description": "Build plugins for GameSlate, the second-screen companion for PC games: the plugin contract, game-state and catalogue schemas, and the plugin builder.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,6 +51,10 @@ Each manifest game has:
51
51
  - optional `inputs[]`, only for asset extractors: a `label`, the `folders` under `~` where the
52
52
  player's files usually are, and `subfolders` whose files count too, such as a port's `mods/`.
53
53
  Hidden folders are refused except under `~/.var/app`, `~/.local/share` and `~/.steam`.
54
+ Every game your assets module extracts needs them: the app offers Build only for a game with
55
+ input folders. Super Mario 64, Diddy Kong Racing, Banjo-Kazooie, Conker and Donkey Kong 64 had
56
+ extractors but no inputs, so players couldn't build their maps (2026-12-06). A manifest test
57
+ that walks `assets.extractors` catches it (gameslate-n64's `plugin/manifest.test.ts`).
54
58
 
55
59
  The build fills in the code files' hashes. Never edit those by hand.
56
60
 
@@ -626,9 +630,23 @@ Mario Party 3 filed them under `collectiblesOrItems` and Body Harvest under `obj
626
630
  1. `## Builds & Asset Extraction`
627
631
  2. `## Map`
628
632
  3. `## Vitals, Inventory, Missions & Reference`
629
- 4. `## Known Gaps`
633
+ 4. `## Limitations`
630
634
  5. `## Verification`
631
635
 
636
+ `## Limitations` is written for the player: what they'll see that is incomplete or can be wrong,
637
+ with the developer detail (the reason, the address, the decomp symbol) after the player sentence
638
+ in the same bullet. Every top-level bullet starts with one of `**Not tracked:**` (shown, but its
639
+ done or collected state isn't read; give counts and say which), `**Not shown:**` (in the game,
640
+ nowhere in the app), `**Can be wrong:**` (when it misreads, and what the player sees) or
641
+ `**Not supported:**` (builds, regions, modes, menus), in that order; leave out a label with
642
+ nothing under it. Nested bullets are fine. The support check refuses an empty section, an
643
+ unknown label and labels out of order; a game with nothing to say writes
644
+ `- **Not supported:** nothing known beyond the builds listed above.` Take the facts from the
645
+ code, not memory: pin categories and landmark kinds with no `collectedBy` (or one only some pins
646
+ get), missions and counters with no condition the state can satisfy, the caveats in `## Map` and
647
+ `## Vitals...`, and `supportedBuildIds` and the frontmatter's `false`/`none` entries. Until
648
+ 0.3.32 this section was `## Known Gaps`, free-form (the maintainer, 2026-12-06).
649
+
632
650
  Keep `<!-- gameslate:support-table:start -->` … `<!-- gameslate:support-table:end -->` in the
633
651
  repo's top-level `README.md` and run:
634
652
 
@@ -714,6 +732,14 @@ the plugin repos) in the same change as the fix. The next game should not have t
714
732
  - **Check each RE address note against a snapshot before using it.** DOOM64-RE's notes were right
715
733
  for `gamemap` and `players[]`, but its `totalkills`/`totalitems`/`totalsecret` addresses read 0
716
734
  all through MAP01, a level full of monsters. One note being right says nothing about the next.
735
+ - **A wrong RE address is found where the code writes the value.** Doom 64's real totals were in
736
+ the functions that count them: `P_SpawnMobj` loads `lui 0x8006; addiu 0x3398`, then `lw`,
737
+ `addiu 1`, `sw` under its `MF_COUNTKILL` test. A ~40-line Python decoder of `lui`/`addiu`/`lw`/
738
+ `sw` over a snapshot's `rdram.bin` at the RE's function address is enough when no disassembler
739
+ is installed. Then check the value against the level's own data (THINGS on the snapshot's skill
740
+ gave 55 kills, as RAM did). A neighbour the RE does place right (`end_time`, just before) backs
741
+ it up. Key per-level flags and flag sets by the level (`map-01-…`), so another level's map pins
742
+ read unknown, not this level's state.
717
743
  - **Don't take a threshold from a game message without reading its condition.** Doom 64's
718
744
  "medikit that you REALLY need" tests health after the medikit is added, so it never shows; a
719
745
  chip citing it as "the game's own 25" cited a bug. A health chip also wants `gte: 1`: a dead
@@ -809,6 +835,13 @@ the plugin repos) in the same change as the fix. The next game should not have t
809
835
  And `1 << (marker->id + 6)` for a Jinjo is a shift by 96..100, which MIPS `sllv` takes mod 32
810
836
  (C calls it undefined): read the compiled shift with `objdump -dr` before mapping a value to a
811
837
  bit (BK, 2026-12-06).
838
+ - **A switch's bit is not its effect's, and not every progress bit stays set.** Banjo-Kazooie's
839
+ lair water switch sets its "pressed" bit when hit, but the water level's bit only at the map
840
+ change that ends its cutscene (`func_802D6114`), and the third level's bit is cleared again
841
+ after 30 seconds or on leaving its rooms; a world's entrance bit is set when its lobby next
842
+ loads, after an unnamed bit (0x28 + world) its opening cutscene sets. Show the effect's bit,
843
+ grep every writer of it (clears included) before calling it progress, and check the order
844
+ across a TAS replay's snapshots (BK, 2026-12-06).
812
845
  - **Exit pins: read the spawn function first.** Some exits never place the player (BK's 0x65),
813
846
  some use hard-coded positions (0x80 and up): neither gets a pin. Keep duplicate exit nodes
814
847
  with unique ids (a `Map` keeps the last, not the one the game uses). Many exits drop the
@@ -1002,6 +1035,19 @@ the plugin repos) in the same change as the fix. The next game should not have t
1002
1035
  and position (the same point in another area is another coin), test the whole byte, not a
1003
1036
  bit of it, and tie the preset ids the reader keeps to the extractor's behaviours in a ROM
1004
1037
  test. Leave a pin with no such record uncollected and say so (gameslate-n64, 2026-12-06).
1038
+ - **A "gone this visit" mark is "collected" only for objects that leave no other way.** SM64
1039
+ marks any deactivated object's spawn entry the same, whatever deactivated it: a sliding or
1040
+ hidden 1-up that flickers away uncollected, a spawner that goes once the player is near, an
1041
+ init that deletes a 1-up before a key is held. Before giving a pin `collectedBy` from such a
1042
+ mark, read every place the object's behaviour deactivates it; keep one table of the kinds that
1043
+ count, shared by the reader and the pins, and add what else must hold (`{ all: [taken,
1044
+ keyFlag] }`, from save flags that are absent before a file is chosen, never from an inventory
1045
+ that reads empty there). Objects placed by level-script commands keep their mark too, in another list (SM64's
1046
+ `SpawnInfo.behaviorArg`): read every list the area spawns from (gameslate-n64, 2026-12-06).
1047
+ - **A place's save bit can sit in a neighbour's byte.** SM64 keeps course c's cannon in bit 7
1048
+ of `courseStars[c]`, the byte after course c's own stars (`save_file_is_cannon_unlocked`), so
1049
+ indexing it like the stars reads the course before's cannon. Copy the game's own getter's
1050
+ index, and table-test the neighbour's bit reading "closed" (gameslate-n64, 2026-12-06).
1005
1051
  - **Save bits that run across maps need a game-wide index.** DK64 numbers a coloured banana's
1006
1052
  bit as 0x320 plus every counted model of the worlds before its own, of the maps before its own
1007
1053
  in that world and of its setup before it (a lobby counts as DK Isles); balloons count from
@@ -1065,6 +1111,9 @@ the plugin repos) in the same change as the fix. The next game should not have t
1065
1111
  so `has` reads "not done"; a `{ bit }` on the streamed slot reads unknown.
1066
1112
  - **A pin helper spreads its spec** (`...spec`), never `category: spec.category` by hand, or the
1067
1113
  pin-categories scan can't see the category (gameslate-n64, 2026-12-06).
1114
+ - **Labels from the same ROM as the maps want a lazy cache per table.** SM64's `star-names` asset
1115
+ built the level table too until each table was read on first use: a labels-only asset parsed
1116
+ every level script, and a test ROM holding only the act-name table couldn't be built.
1068
1117
  - **A ROM table's length comes from its declared size,** not the gap to the next symbol; check the
1069
1118
  gap is rows × stride exactly. And give hubs one meaning everywhere: DK64's lobbies are DK Isles
1070
1119
  for the save grid, so the chips must say so too.
@@ -1099,7 +1148,7 @@ the plugin repos) in the same change as the fix. The next game should not have t
1099
1148
  - **Follow every source the floor or water query asks.** DK64's floor query merges the map mesh,
1100
1149
  placed models and actor boxes; Conker's water height comes from water props, trigger-zone
1101
1150
  volumes and surface type 8 at once. Port the game's query, not one of its sources, and say in
1102
- Known Gaps which sources are built at run time (animated bones, actor floors, scripted water)
1151
+ Limitations which sources are built at run time (animated bones, actor floors, scripted water)
1103
1152
  and so aren't drawn.
1104
1153
  - **A trigger volume isn't a surface.** Port its contains-test exactly (Conker's
1105
1154
  `zone_isOutside`: thresholds, integer truncation, rotation order), draw the floors it holds as
@@ -1363,7 +1412,7 @@ the plugin repos) in the same change as the fix. The next game should not have t
1363
1412
  real hole it looks like (2026-12-05).
1364
1413
  - **`position` needs a heading.** The sdk's position requires `headingDeg` (0.3.14). An actor
1365
1414
  with no heading in memory can't be the position; send it as an `enemies`/`npcs` dot and say so
1366
- in Known Gaps rather than inventing an angle (2026-12-05).
1415
+ in Limitations rather than inventing an angle (2026-12-05).
1367
1416
  - **Changing a README's frontmatter changes the root support table.** Run
1368
1417
  `gameslate-plugin support plugin --built dist/<repo> --write` after editing `npcs`, `enemies` or
1369
1418
  capabilities, or the check refuses (2026-12-05).
@@ -1549,3 +1598,72 @@ the plugin repos) in the same change as the fix. The next game should not have t
1549
1598
  barn defence starts at 2 AM; the invasion actor runs from `CLOCK_TIME(2, 30)`. Check timings and
1550
1599
  rewards in the decomp (the Oceanside Spider House's wallet is chosen by the day it's paid out),
1551
1600
  then name a walkthrough that agrees (2026-12-05).
1601
+ - **Stream a game's bitset word as `flagSets` bytes, low byte first, and check its numbering in a
1602
+ replay.** Body Harvest tests mission m as `word & (1 << m)` (the decomp's three-line bit helper
1603
+ says the order; read it, don't assume). Streamed as the word's bytes from its low end, mission
1604
+ m is `{ bit: { set, index: m >> 3, mask: 1 << (m & 7) } }`, and one helper builds both the
1605
+ stream and the pins' conditions. Then read the word across a TAS replay's snapshots: no bit
1606
+ should ever be set at or past the level's count (Greece's 23 missions never set bit 23), which
1607
+ shows the bits number the same things the pins do. Read the word only in modes where it's the
1608
+ current level's (each level clears it before loading; the frontend keeps the last one's). In
1609
+ loading and cutscenes, hold the last word read in play, and drop it when the level changes or the
1610
+ frontend shows. Otherwise a finished target comes back on every load screen. With nothing held,
1611
+ a `hiddenWhen` reads unknown and the pin shows. Build an expected bitset in a test from a list
1612
+ of bits, not from `toString(2)`: that string puts the highest bit first, and a README
1613
+ misnumbered two bits this way (gameslate-n64, 2026-12-06).
1614
+ - **Find when a save bit is written before you document a "saved at stage end" gap.** Kirby 64's
1615
+ README said a shard showed only once the stage saved on exit; the pickup routine calls the save
1616
+ helper (`func_800B9CB4`) at once, so the bits are live mid-visit. When the decomp leaves the
1617
+ helper as asm, disassemble it from the ROM (`llvm-objcopy-18 -I binary -O elf32-tradbigmips` on
1618
+ the slice, then `llvm-objdump-18 -d --adjust-vma=<vram>`), find its callers by searching the ROM
1619
+ for its `jal` word (`0x0C000000 | (addr & 0x0FFFFFFF) >> 2`, word-aligned), and watch the bytes
1620
+ change mid-stage across a TAS replay's snapshots. The routine is the publisher's code: keep the
1621
+ listing in your scratchpad, never in a repo or worktree, and take from it only addresses, offsets
1622
+ and bit numbering, as from an unlicensed decomp (data-licensing.md). A spawn's save index can name the bit as well
1623
+ as the stage (Kirby's `saveToEeprom` is stage ordinal × 3 + bit): census it on the ROM so a pin
1624
+ never guesses a bit (gameslate-n64, 2026-12-06).
1625
+ - **When placed spawns fall short of the game's count, the code spawns the rest.** Kirby 64's
1626
+ entity lists place 49 of its 66 shards; the other 17 come from code. Search the ROM for `jal`s
1627
+ to the spawn routine (Kirby's `func_800FCD14`: 11 callers) and to the save helper, and read
1628
+ each caller's save-index argument: an instruction immediate (Adeleine, the minibosses' drop) or
1629
+ a table row the routine indexes (the enemy-wave rooms' ovl18 table, row = the room entity's
1630
+ id). Read those values from the ROM in the extractor, checking each instruction word's top
1631
+ half, and census the total: every index once (gameslate-n64, 2026-12-06).
1632
+ - **A spawn-list mark can mean "out", not "gone".** Yoshi's Story writes -1 over a placed
1633
+ entry's word when its actor spawns and writes the word back when the actor leaves the screen,
1634
+ so -1 covers a live actor as well as an eaten fruit. Eaten is -1 with no live, unkilled actor
1635
+ pointing back at the entry (`Actor + 0x1D8`). The game spawns before it writes -1 and writes
1636
+ the word back before it kills, so read the list, then the pool, then the list again, and call
1637
+ an entry gone only when both lists say -1: read once, a melon coming on or going off screen
1638
+ flickers eaten. Count an actor that is spawned but not yet listed as holding its entry. When the
1639
+ object's behaviour is an overlay the decomp leaves unsplit, take its ROM range from the unit
1640
+ header and scan it for `jal`s into main. That lists every way out: Yoshi's fruit overlay has
1641
+ one of its own, which writes the word back, and eating it is Yoshi's code (gameslate-n64,
1642
+ 2026-12-06).
1643
+ - **An entry's holder can be another object's child, in another pool.** Yoshi's Story's Shy Guys
1644
+ and bubbles spawn the melon they hold and share their entry with it, or hand it over when the
1645
+ melon is taken, and that melon lives in one of the actor manager's sub-pools, not the main
1646
+ actor pool. A reader that scans only the main pool calls the entry eaten while the melon is
1647
+ still out. Scan every pool an actor can live in, and stream nothing when one can't be read. A
1648
+ holder that spawns its prize with no entry leaves no record at all: pin it with no collected
1649
+ state and say so in Limitations. And a prize still attached as its holder's child dies with it:
1650
+ a kill that takes the children and puts no entry back leaves "out, no actor" for a prize
1651
+ nobody took. Track a holder only when every way it ends (its overlay's kills and the main
1652
+ code's) leaves its prize free or puts the entry back; Yoshi's Shy Guys didn't pass, the
1653
+ objects that spawn a free melon and then kill themselves did (gameslate-n64, 2026-12-06).
1654
+ - **"Freed" is "taken" only when every other way to free the object leaves a mark.** GoldenEye
1655
+ frees body armour and an untagged gun when Bond takes it (`objFree` sets `obj->prop` to NULL),
1656
+ and frees a destroyed object, a detonated mine and a recycled projectile the same way. Those go
1657
+ through `RUNTIMEBITFLAG_REMOVE`, which `objFree` never clears, so taken is "prop NULL without
1658
+ REMOVE", or "prop parented to Bond's" for what the game hands him (keys, tagged objects). List
1659
+ every caller of the free routine and of the flag's setters before trusting the split, and say
1660
+ in Limitations which frees leave no mark (a crate freed with its gun inside). "No object" is
1661
+ also "never set up": find a field the setup writes with the object and the free leaves alone
1662
+ (GoldenEye's `obj->model`) and give no flag without it. And list who reuses a freed record:
1663
+ GoldenEye's `weaponCreate`, out of slots, writes a new weapon over a setup record, so tell a
1664
+ reused record by the fields the setup gave it (model number, pad), keep taken taken for the
1665
+ visit, and forget it when the stage unloads. Pin only what the
1666
+ pickup routine accepts: GoldenEye's map pinned 44 `PROPFLAG_UNCOLLECTABLE` grenades, the
1667
+ stages' scripted explosions, as Hand Grenades. Offsets the probe gives for a struct that
1668
+ `inherits` another are short by the parent's size (clang drops the member): add it, and check
1669
+ the result in the compiled code (gameslate-n64, 2026-12-06).