@gameslate/sdk 0.3.22 → 0.3.23
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.
|
@@ -94,14 +94,29 @@ function assetsHost() {
|
|
|
94
94
|
throw new Error('the core gave no input capability');
|
|
95
95
|
return host;
|
|
96
96
|
}
|
|
97
|
+
/*
|
|
98
|
+
* The same input arrives as the same object on every call, so an extractor can keep what it read
|
|
99
|
+
* from a file between assets by comparing files (`cached.file === file`). Without this each call
|
|
100
|
+
* made new objects and every such cache missed: a 104-place build re-read a 16 MB ROM 104 times.
|
|
101
|
+
* Keyed on all three fields: a handle belongs to one job's file, and a sandbox lives for one job.
|
|
102
|
+
*/
|
|
103
|
+
const inputs = new Map();
|
|
97
104
|
function inputFiles(host, json) {
|
|
98
105
|
const files = SandboxInputFilesSchema.parse(JSON.parse(json));
|
|
99
|
-
return files.map(f =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
return files.map(f => {
|
|
107
|
+
const key = JSON.stringify([f.handle, f.name, f.size]);
|
|
108
|
+
const known = inputs.get(key);
|
|
109
|
+
if (known)
|
|
110
|
+
return known;
|
|
111
|
+
const file = {
|
|
112
|
+
name: f.name,
|
|
113
|
+
size: f.size,
|
|
114
|
+
handle: f.handle,
|
|
115
|
+
read: (offset, length) => new Uint8Array(host.inputRead(f.handle, offset, length)),
|
|
116
|
+
};
|
|
117
|
+
inputs.set(key, file);
|
|
118
|
+
return file;
|
|
119
|
+
});
|
|
105
120
|
}
|
|
106
121
|
/* an exact-size copy, so only the output's own bytes cross */
|
|
107
122
|
const bufferOf = (data) => data.slice().buffer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameslate/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.23",
|
|
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",
|
|
@@ -701,6 +701,47 @@ the plugin repos) in the same change as the fix. The next game should not have t
|
|
|
701
701
|
- **Take level and map ids from the decomp's enums, not the ROM's tables.** Diddy Kong Racing's
|
|
702
702
|
`include/asset_enums.h` names all 65 level headers (`ASSET_LEVEL_*`), and `addresses` copies
|
|
703
703
|
them as constants: the place table is then source code, with nothing game-derived committed.
|
|
704
|
+
- **Find a ROM's script table by the command that loads it.** Super Mario 64's level-script
|
|
705
|
+
segment isn't named in any header: scan the ROM on 4-byte steps for the load command's bytes
|
|
706
|
+
and require every hit to agree, so another ROM fails loud instead of reading hand-copied
|
|
707
|
+
linker numbers. Read a variable-length stream (SM64 collision, whose special-object records
|
|
708
|
+
vary by a table in the game's code) only as far as you need, and record what that leaves out
|
|
709
|
+
as a gap (its water boxes). When one place spans several levels (the Bowser arenas share
|
|
710
|
+
their course), fold the level into `roomId` (level × 8 + area) and test that each level's
|
|
711
|
+
rooms appear on its own place only. A level script's start position is a free projection
|
|
712
|
+
check: a live read at the level start must equal it (SM64, 2026-12-05).
|
|
713
|
+
- **A table no symbol names: find it by its shape, strictly.** Diddy Kong Racing's asset lookup
|
|
714
|
+
table is found by its layout; require exactly one match and that its sections end past the
|
|
715
|
+
table, or a count word followed by zeros passes as a table of empty sections. Follow the
|
|
716
|
+
decomp's spawn call to the object map it really spawns (`track_spawn_objects(…, 0)` reads
|
|
717
|
+
`unkBA`, not `collectables`), and check the header width (`sizeof(uintptr_t)` words put
|
|
718
|
+
entries at byte 16). Water batches are often flagged no-collision: keep them by the water
|
|
719
|
+
render flag or surface type, or the lakes vanish. Before trusting a decomp function's flag
|
|
720
|
+
test, count each category (surface type × flags) over the ROM: that census showed DKR's lakes
|
|
721
|
+
are water-render batches flagged no-collision, and its `UNK_F` "water" a hidden height cap,
|
|
722
|
+
which a fix drawn from the functions alone would have got wrong. Every start the ROM gives makes a
|
|
723
|
+
projection check for every track: measure the height gap first (DKR's is 0–50, Smokey starts
|
|
724
|
+
in the air) (DKR, 2026-12-05).
|
|
725
|
+
- **Detect a ROM's byte order from its first word, never its extension.** A `.v64` file can hold
|
|
726
|
+
z64 bytes (BK, 2026-12-05).
|
|
727
|
+
- **Rare's indicator-byte streams** (`file_isNextByteExpected`): copy the held-back byte
|
|
728
|
+
exactly; a list's indicator may be missing when its count is 0; a count can be narrower than
|
|
729
|
+
its byte (6 bits in BK's setup files), so refuse larger values. offsetof can't pin a
|
|
730
|
+
bitfield: confirm it by disassembling the accessor (`llvm-objdump -d`) and place it relative
|
|
731
|
+
to a pinned neighbouring field (BK, 2026-12-05).
|
|
732
|
+
- **Exit pins: read the spawn function first.** Some exits never place the player (BK's 0x65),
|
|
733
|
+
some use hard-coded positions (0x80 and up): neither gets a pin. Keep duplicate exit nodes
|
|
734
|
+
with unique ids (a `Map` keeps the last, not the one the game uses). Many exits drop the
|
|
735
|
+
player in from above: check every exit lands over a drawn floor in plan, and most on the
|
|
736
|
+
ground, not ±N units for all. The player's wall and ceiling queries pass through water, so
|
|
737
|
+
draw only water faces that point up (BK, 2026-12-05).
|
|
738
|
+
- **Mirror modes: draw the course as built.** `roomId` means a room to shared code (layer
|
|
739
|
+
choice, actor filters, AI prompts: "I'm in Room 1"), so never use it for a mode. Where the
|
|
740
|
+
game mirrors its world (Mario Kart 64's Extra cups), the reader negates x and the heading
|
|
741
|
+
back; where it mirrors only the screen (DKR), positions already fit the map as built. Showing
|
|
742
|
+
a mirrored map would need a contract field, not a second layer per race (DKR review,
|
|
743
|
+
2026-12-05). A new `map_2d` goes in the source's capabilities, `registry-specs.ts` and the
|
|
744
|
+
manifest together, or the support step refuses `map.status: partial`.
|
|
704
745
|
- **Dump the real "empty" record before you write the empty check.** A review asked for Wave Race
|
|
705
746
|
64's "no ground" to be "all eight header words zero"; Port Blue's header has zero extents but
|
|
706
747
|
still names an 8 x 6 grid, so that check would have thrown on a real course. Match the empty
|
|
@@ -1046,8 +1087,11 @@ the plugin repos) in the same change as the fix. The next game should not have t
|
|
|
1046
1087
|
drums" in "four rooms", where the game has five cabinets you open and burn with timed mines,
|
|
1047
1088
|
and a dish "console" where you stick a mine on the dish. Write each fact from a walkthrough
|
|
1048
1089
|
(a GameFAQs FAQ, often mirrored as PDFs on video-games-museum.com; the Wayback Machine serves
|
|
1049
|
-
pages that refuse fetches; StrategyWiki answers 403
|
|
1050
|
-
|
|
1090
|
+
pages that refuse fetches; StrategyWiki answers 403; zeldadungeon.net blocks automated fetches
|
|
1091
|
+
behind a bot challenge, but Zelda Wiki serves wikitext at
|
|
1092
|
+
`https://zeldawiki.wiki/wiki/<Page>?action=raw`, following a `#REDIRECT` stub to its target),
|
|
1093
|
+
in your own words, and name it in the commit. Add a test, gated on the local labels file, that
|
|
1094
|
+
fails when a hint holds a label whole,
|
|
1051
1095
|
a quoted multi-word piece of one, or a five-word run of one; pin its matcher on made-up labels
|
|
1052
1096
|
so it runs everywhere (TS2, 2026-12-05).
|
|
1053
1097
|
- **Fact-check every level's hints, not only the one caught.** The other nine TS2 levels were
|
|
@@ -1068,6 +1112,21 @@ the plugin repos) in the same change as the fix. The next game should not have t
|
|
|
1068
1112
|
"exit" may be the player's start position, so check it. A pin whose object appears only on
|
|
1069
1113
|
some difficulties gets `hiddenWhen`, built from the setup entry's per-difficulty flags
|
|
1070
1114
|
(TS2, 2026-12-05).
|
|
1115
|
+
- **Name an actor from its code, and check its params first.** Six of Ship of Harkinian's chest
|
|
1116
|
+
labels named the wrong item, and a dozen actor labels named the wrong character (an OoT
|
|
1117
|
+
"Grog", a "Gerudo Fighter" that the code calls a thief). Take a chest's item from the decomp's
|
|
1118
|
+
get-item enum, and an actor's name from its overlay Description or, without one, its Navi
|
|
1119
|
+
enemy id (`NAVI_ENEMY_*`) and the type enum in its header; the `case`s in Init show where an
|
|
1120
|
+
NPC stands. One actor id can be several characters (a father and his five sons, Goron types)
|
|
1121
|
+
and its params can pick the variant (Keese types 0–1 are on fire): read the enum before
|
|
1122
|
+
writing a params-based label, and pin each id to its enum name in a test (SoH, 2026-12-05).
|
|
1123
|
+
- **Give a pin status from an item only when owning it proves the pin.** An item that's sold,
|
|
1124
|
+
consumed, burnt or traded on (a Deku Shield, Magic Beans, Bombchus, the Odd Mushroom) doesn't
|
|
1125
|
+
show which chest it came from: use the chest's own flag, or leave the pin untracked. Check
|
|
1126
|
+
how the game hands the item over before writing a "Chest" rule (OoT's Fire Arrows lie free at
|
|
1127
|
+
Lake Hylia, Zelda gives the Light Arrows, MM's Link starts with his sword), and test that
|
|
1128
|
+
every rule's label is one the pin-label table can produce: a rule no pin matches does
|
|
1129
|
+
nothing and nothing reports it (SoH, 2026-12-05).
|
|
1071
1130
|
- **Invented hints name the wrong tool, place and method.** Perfect Dark's hints were wrong on
|
|
1072
1131
|
almost every mission: a Data Uplink on cleaning robots (two consoles start them), Mining
|
|
1073
1132
|
Explosives on a hangar door (a technician's key card), a security "booth" with biometrics, a
|