@gameslate/sdk 0.3.13 → 0.3.14
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/lib/plugin/contract.d.ts
CHANGED
|
@@ -27,14 +27,28 @@ export interface GameMemory {
|
|
|
27
27
|
*/
|
|
28
28
|
log?(message: string): void;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* N64 only: code from the ROM that stays in RAM at a fixed address while the game runs, for a game
|
|
32
|
+
* whose boot code doesn't (Mario Tennis boots a decompressor at 0x80300000, then draws over it).
|
|
33
|
+
* The core searches for these 64 bytes, after the boot code, to find the console's RAM.
|
|
34
|
+
*/
|
|
35
|
+
export interface N64RamAnchor {
|
|
36
|
+
/** where the bytes start in the ROM, word-aligned */
|
|
37
|
+
romOffset: number;
|
|
38
|
+
/** the KSEG0 address (0x80…) they sit at in RAM */
|
|
39
|
+
ramAddress: number;
|
|
40
|
+
}
|
|
41
|
+
/** A build a source reads: where it's from, and (N64) how its RAM is found if the usual way fails. */
|
|
42
|
+
export interface BuildSupport {
|
|
43
|
+
region: string;
|
|
44
|
+
ramAnchor?: N64RamAnchor;
|
|
45
|
+
}
|
|
30
46
|
/** A memory-read state source for one game. Packs export theirs from games/<id>/source.ts. */
|
|
31
47
|
export interface GamePlugin {
|
|
32
48
|
readonly gameId: string;
|
|
33
49
|
readonly stateSchemaVersion: number;
|
|
34
50
|
readonly capabilities: GameCapability[];
|
|
35
|
-
readonly supportedBuildIds: ReadonlyMap<string,
|
|
36
|
-
region: string;
|
|
37
|
-
}>;
|
|
51
|
+
readonly supportedBuildIds: ReadonlyMap<string, BuildSupport>;
|
|
38
52
|
readonly executableHints: readonly string[];
|
|
39
53
|
/**
|
|
40
54
|
* Stats a launch wrapper from an older bundle may not send. While any is missing, the daemon
|
|
@@ -6,10 +6,28 @@ export declare const SandboxSourceSchema: z.ZodObject<{
|
|
|
6
6
|
capabilities: z.ZodArray<z.ZodEnum<["location", "map_2d", "objectives", "inventory", "stats", "chat_chips"]>, "many">;
|
|
7
7
|
supportedBuildIds: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodObject<{
|
|
8
8
|
region: z.ZodString;
|
|
9
|
+
ramAnchor: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
romOffset: z.ZodNumber;
|
|
11
|
+
ramAddress: z.ZodNumber;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
romOffset: number;
|
|
14
|
+
ramAddress: number;
|
|
15
|
+
}, {
|
|
16
|
+
romOffset: number;
|
|
17
|
+
ramAddress: number;
|
|
18
|
+
}>>;
|
|
9
19
|
}, "strip", z.ZodTypeAny, {
|
|
10
20
|
region: string;
|
|
21
|
+
ramAnchor?: {
|
|
22
|
+
romOffset: number;
|
|
23
|
+
ramAddress: number;
|
|
24
|
+
} | undefined;
|
|
11
25
|
}, {
|
|
12
26
|
region: string;
|
|
27
|
+
ramAnchor?: {
|
|
28
|
+
romOffset: number;
|
|
29
|
+
ramAddress: number;
|
|
30
|
+
} | undefined;
|
|
13
31
|
}>], null>, "many">;
|
|
14
32
|
executableHints: z.ZodArray<z.ZodString, "many">;
|
|
15
33
|
wrapperMayOmitStats: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -29,6 +47,10 @@ export declare const SandboxSourceSchema: z.ZodObject<{
|
|
|
29
47
|
capabilities: ("location" | "map_2d" | "objectives" | "inventory" | "stats" | "chat_chips")[];
|
|
30
48
|
supportedBuildIds: [string, {
|
|
31
49
|
region: string;
|
|
50
|
+
ramAnchor?: {
|
|
51
|
+
romOffset: number;
|
|
52
|
+
ramAddress: number;
|
|
53
|
+
} | undefined;
|
|
32
54
|
}][];
|
|
33
55
|
executableHints: string[];
|
|
34
56
|
wrapperMayOmitStats?: string[] | undefined;
|
|
@@ -42,6 +64,10 @@ export declare const SandboxSourceSchema: z.ZodObject<{
|
|
|
42
64
|
capabilities: ("location" | "map_2d" | "objectives" | "inventory" | "stats" | "chat_chips")[];
|
|
43
65
|
supportedBuildIds: [string, {
|
|
44
66
|
region: string;
|
|
67
|
+
ramAnchor?: {
|
|
68
|
+
romOffset: number;
|
|
69
|
+
ramAddress: number;
|
|
70
|
+
} | undefined;
|
|
45
71
|
}][];
|
|
46
72
|
executableHints: string[];
|
|
47
73
|
wrapperMayOmitStats?: string[] | undefined;
|
|
@@ -1038,10 +1064,28 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
|
|
|
1038
1064
|
capabilities: z.ZodArray<z.ZodEnum<["location", "map_2d", "objectives", "inventory", "stats", "chat_chips"]>, "many">;
|
|
1039
1065
|
supportedBuildIds: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodObject<{
|
|
1040
1066
|
region: z.ZodString;
|
|
1067
|
+
ramAnchor: z.ZodOptional<z.ZodObject<{
|
|
1068
|
+
romOffset: z.ZodNumber;
|
|
1069
|
+
ramAddress: z.ZodNumber;
|
|
1070
|
+
}, "strip", z.ZodTypeAny, {
|
|
1071
|
+
romOffset: number;
|
|
1072
|
+
ramAddress: number;
|
|
1073
|
+
}, {
|
|
1074
|
+
romOffset: number;
|
|
1075
|
+
ramAddress: number;
|
|
1076
|
+
}>>;
|
|
1041
1077
|
}, "strip", z.ZodTypeAny, {
|
|
1042
1078
|
region: string;
|
|
1079
|
+
ramAnchor?: {
|
|
1080
|
+
romOffset: number;
|
|
1081
|
+
ramAddress: number;
|
|
1082
|
+
} | undefined;
|
|
1043
1083
|
}, {
|
|
1044
1084
|
region: string;
|
|
1085
|
+
ramAnchor?: {
|
|
1086
|
+
romOffset: number;
|
|
1087
|
+
ramAddress: number;
|
|
1088
|
+
} | undefined;
|
|
1045
1089
|
}>], null>, "many">;
|
|
1046
1090
|
executableHints: z.ZodArray<z.ZodString, "many">;
|
|
1047
1091
|
wrapperMayOmitStats: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1061,6 +1105,10 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
|
|
|
1061
1105
|
capabilities: ("location" | "map_2d" | "objectives" | "inventory" | "stats" | "chat_chips")[];
|
|
1062
1106
|
supportedBuildIds: [string, {
|
|
1063
1107
|
region: string;
|
|
1108
|
+
ramAnchor?: {
|
|
1109
|
+
romOffset: number;
|
|
1110
|
+
ramAddress: number;
|
|
1111
|
+
} | undefined;
|
|
1064
1112
|
}][];
|
|
1065
1113
|
executableHints: string[];
|
|
1066
1114
|
wrapperMayOmitStats?: string[] | undefined;
|
|
@@ -1074,6 +1122,10 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
|
|
|
1074
1122
|
capabilities: ("location" | "map_2d" | "objectives" | "inventory" | "stats" | "chat_chips")[];
|
|
1075
1123
|
supportedBuildIds: [string, {
|
|
1076
1124
|
region: string;
|
|
1125
|
+
ramAnchor?: {
|
|
1126
|
+
romOffset: number;
|
|
1127
|
+
ramAddress: number;
|
|
1128
|
+
} | undefined;
|
|
1077
1129
|
}][];
|
|
1078
1130
|
executableHints: string[];
|
|
1079
1131
|
wrapperMayOmitStats?: string[] | undefined;
|
|
@@ -1223,6 +1275,10 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
|
|
|
1223
1275
|
capabilities: ("location" | "map_2d" | "objectives" | "inventory" | "stats" | "chat_chips")[];
|
|
1224
1276
|
supportedBuildIds: [string, {
|
|
1225
1277
|
region: string;
|
|
1278
|
+
ramAnchor?: {
|
|
1279
|
+
romOffset: number;
|
|
1280
|
+
ramAddress: number;
|
|
1281
|
+
} | undefined;
|
|
1226
1282
|
}][];
|
|
1227
1283
|
executableHints: string[];
|
|
1228
1284
|
wrapperMayOmitStats?: string[] | undefined;
|
|
@@ -1372,6 +1428,10 @@ export declare const SandboxDescriptionSchema: z.ZodObject<{
|
|
|
1372
1428
|
capabilities: ("location" | "map_2d" | "objectives" | "inventory" | "stats" | "chat_chips")[];
|
|
1373
1429
|
supportedBuildIds: [string, {
|
|
1374
1430
|
region: string;
|
|
1431
|
+
ramAnchor?: {
|
|
1432
|
+
romOffset: number;
|
|
1433
|
+
ramAddress: number;
|
|
1434
|
+
} | undefined;
|
|
1375
1435
|
}][];
|
|
1376
1436
|
executableHints: string[];
|
|
1377
1437
|
wrapperMayOmitStats?: string[] | undefined;
|
package/lib/sandbox-protocol.js
CHANGED
|
@@ -11,7 +11,18 @@ export const SandboxSourceSchema = z.object({
|
|
|
11
11
|
gameId: z.string().min(1),
|
|
12
12
|
stateSchemaVersion: z.number().int(),
|
|
13
13
|
capabilities: z.array(GameCapabilitySchema),
|
|
14
|
-
supportedBuildIds: z.array(z.tuple([
|
|
14
|
+
supportedBuildIds: z.array(z.tuple([
|
|
15
|
+
z.string(),
|
|
16
|
+
z.object({
|
|
17
|
+
region: z.string(),
|
|
18
|
+
ramAnchor: z
|
|
19
|
+
.object({
|
|
20
|
+
romOffset: z.number().int().nonnegative().multipleOf(4),
|
|
21
|
+
ramAddress: z.number().int().gte(0x80000000).lt(0x80800000),
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
}),
|
|
25
|
+
])),
|
|
15
26
|
executableHints: z.array(z.string()),
|
|
16
27
|
wrapperMayOmitStats: z.array(z.string()).optional(),
|
|
17
28
|
unsupportedExecutables: z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameslate/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
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",
|
|
@@ -207,6 +207,20 @@ first). Commit the spec and the generated table; the decomp and ROM stay local.
|
|
|
207
207
|
that works (Banjo-Kazooie's health code is the low byte of an s32): find the field's start.
|
|
208
208
|
Project64's `Config/Cheats/*.cht` files are per revision; `drive codes` reads them with
|
|
209
209
|
`--rom <rom>` and refuses a list whose header CRC isn't that ROM's.
|
|
210
|
+
- **ScriptHawk** (github.com/Isotarge/ScriptHawk, MIT) names many games' addresses per release,
|
|
211
|
+
pointers and whole flag lists included (SSSV, Rayman 2, Conker, DK64, Banjo). `drive codes` reads
|
|
212
|
+
a module's `Game.Memory` table (`--version <release>`) and a flag list such as `dk64_flags.lua`
|
|
213
|
+
(`--flag-base <block address>`, which the module computes at run time: read its code for it).
|
|
214
|
+
DK64's 7165S snapshots set exactly the movie's 5 flags at slot 0's `0x807ECEA8`.
|
|
215
|
+
- **Flag ids for collectibles: read the pause menu's totals first.** The function that fills the
|
|
216
|
+
pause or file-select counts (`flagCountRange(first, count)`, a table of flag ids, single flags)
|
|
217
|
+
names every collectible set the player sees, with the maximum beside it, all in the decomp. DK64's
|
|
218
|
+
`hudPauseMenuRefreshTotals` gave keys, crowns, medals, fairies, blueprints and both coins, so
|
|
219
|
+
ScriptHawk's list was only a cross-check and no third-party names were needed.
|
|
220
|
+
- **A save slot may move.** DK64 keeps its four files in sectors it swaps on every save
|
|
221
|
+
(`gEepromSectorSlot`), sized at boot from a model count: read the indirection each poll, compute
|
|
222
|
+
the size the way the game does, and check across snapshots that the set flags stay put whichever
|
|
223
|
+
sector holds the file.
|
|
210
224
|
- A byte-pattern lead stays a pattern: read it with `memory.scan({ pattern, kind, offset })`, so it
|
|
211
225
|
survives patches. It must match exactly once.
|
|
212
226
|
|
|
@@ -225,6 +239,20 @@ empty save, and the snapshots show the table holding its init values at every en
|
|
|
225
239
|
24 course records all read `MAX_TIMER` from frame 60, 2026-12-04). That pins the address and the
|
|
226
240
|
stride, not a set value: say so, and leave the set case to synthetic memory and a live check.
|
|
227
241
|
|
|
242
|
+
**A phase byte no lead names** (the title, menus and attract demos keep the last match's
|
|
243
|
+
score, so the score alone can't say when it's live): list the snapshots by what their screens
|
|
244
|
+
show, then search every byte for one value through the phase and another at every frame outside
|
|
245
|
+
it (a short Node script over the `rdram.bin`s; keep values small and the outside values few, or
|
|
246
|
+
you get thousands of heap bytes). Then run the ROM idle (a copy of the movie with N neutral
|
|
247
|
+
frames, framed exactly as the original's `Input Log.txt`: adding an `[Input]` line to a BizHawk
|
|
248
|
+
1.9.1 log made 2.9.1 quit before the script ran) through the attract demos: a byte that holds in
|
|
249
|
+
the demos too means "a match is on", not "the player is playing". Mario Tennis needed both: one
|
|
250
|
+
byte for any match on court, another for the player's own.
|
|
251
|
+
Before releasing, replay once more with `--watch` on the phase bytes: snapshots every 100 frames
|
|
252
|
+
missed Mario Tennis's black screen (court byte 6) and its 24-frame walk-on (player byte 1 with
|
|
253
|
+
the menu court byte), so 0.34.0 threw for the three seconds before every match. Give every pair
|
|
254
|
+
the watch log shows a phase, and keep throwing on the rest.
|
|
255
|
+
|
|
228
256
|
**A game with no decomp (Castlevania: Legacy of Darkness is the worked example):** the leads and
|
|
229
257
|
the screen are all the evidence there is, so `addresses.ts` is hand-written with each address's
|
|
230
258
|
frames and what the screen showed.
|
|
@@ -667,7 +695,9 @@ the plugin repos) in the same change as the fix. The next game should not have t
|
|
|
667
695
|
- **Before a file is chosen, the save index is stale.** Super Mario 64's `gCurrSaveFileNum` starts
|
|
668
696
|
at 1 and keeps the last file after Save & Quit, so file select showed file 1's stars as fact.
|
|
669
697
|
Leave save-derived flags and counters out until a file is entered (an absent flag reads as
|
|
670
|
-
untracked), and keep them where a file is known (in play, the ending)
|
|
698
|
+
untracked), and keep them where a file is known (in play, the ending), loads and cutscenes
|
|
699
|
+
included: a slot grid fed by `inventory` has no "not tracked" state, so gating items on "the
|
|
700
|
+
player is placed" empties it on every map load (DK64 review, 2026-12-05).
|
|
671
701
|
- **The game mode can be a function pointer:** when the decomp keeps the current mode in a
|
|
672
702
|
file-static the symbol maps don't list, read the mode table instead (Paper Mario:
|
|
673
703
|
`gMainGameMode[0].step` equals a `state_step_*` symbol).
|
|
@@ -695,3 +725,11 @@ the plugin repos) in the same change as the fix. The next game should not have t
|
|
|
695
725
|
lands somewhere else next time. Pin each choice with the game's own menu variables.
|
|
696
726
|
- **Prove it on real data before writing to a player's files.** Back up what's there before the
|
|
697
727
|
first run on a real machine.
|
|
728
|
+
- **Check the core can find the game's RAM before you ship.** The core finds an N64 game's RAM
|
|
729
|
+
by the code its boot chip copies from ROM 0x1000 (and 0x2000). A game that boots a
|
|
730
|
+
decompressor there and then draws over it is never found: no error, the game just never
|
|
731
|
+
attaches (Mario Tennis, found live on 2026-12-05, after the TAS work had passed). Check every
|
|
732
|
+
`rdram.bin` of your replays for the ROM's bytes at 0x1000 and 0x2000 at the entry point. If
|
|
733
|
+
they're gone, find 64 bytes of ROM code that sit at one RAM address in every snapshot, once,
|
|
734
|
+
and declare them on the build: `supportedBuildIds: new Map([['NM8E.0', { region, ramAnchor:
|
|
735
|
+
{ romOffset: 0x1300, ramAddress: 0x80042f50 } }]])` (sdk 0.3.14).
|
|
@@ -91,9 +91,23 @@ Script the route per game as inputs plus checks, such as "Start until game state
|
|
|
91
91
|
categories that play the game as intended, the newest BizHawk, the default core and plugin;
|
|
92
92
|
avoid ACE, wrong-warp and game-end-glitch runs, and read the submission (`tasvideos.org/<n>S`)
|
|
93
93
|
for sync steps. On Windows 11 24H2 old Mupen64Plus code fails (the dynarec,
|
|
94
|
-
Glide64mk2): a movie that sits at frame 0 or crashes may run
|
|
95
|
-
|
|
96
|
-
rising steadily, no lost health, level clears) before trusting any frame of it.
|
|
94
|
+
Glide64mk2): a movie that sits at frame 0 or crashes may run on `Core` 1 (interpreter):
|
|
95
|
+
`drive tas … --cpu interpreter` replays such a copy, but it is a deviation: prove sync (menu
|
|
96
|
+
picks, counts rising steadily, no lost health, level clears) before trusting any frame of it. A movie asking
|
|
97
|
+
for Jabo (`VideoPlugin` 3, gone in 2.x) is refused; `drive tas … --video gliden64` replays a
|
|
98
|
+
copy on another plugin (no hand-made zip needed): when GLideN64 (4) leaves BizHawk's
|
|
99
|
+
screenshots stale and `screen.png` comes out as noise (a framebuffer it misreads), use
|
|
100
|
+
`--video angrylion` (5), the software renderer: slower, but every screenshot is the frame
|
|
101
|
+
(Mario Tennis, 2026-12-05).
|
|
102
|
+
- **Only a `.m64` (mupen64-rr)?** `drive m64 <movie.m64> <rom> --out movie.bk2` converts it with
|
|
103
|
+
one BizHawk pass that hands each pad read the next sample. It syncs where the game reads the pad
|
|
104
|
+
as it did under mupen64-rr: check the samples-per-VI first (Yoshi's Story 1982M, ~1 a VI,
|
|
105
|
+
synced to its second reset; F-Zero X 2467M reads during BizHawk's boot logo and desyncs at the
|
|
106
|
+
title). A reset timed to a save (to skip a cutscene) is where a conversion stops syncing: take
|
|
107
|
+
frames before it. The ROM must match the movie's CRC1 and country: many SM64 and Smash `.m64`s
|
|
108
|
+
are for the Japanese ROM. A frame that reads the pad twice for two different samples can't be
|
|
109
|
+
held in a `.bk2`: the conversion refuses unless `--inexact allow`, and then sync must be proven
|
|
110
|
+
past the first such frame it names.
|
|
97
111
|
- **Naming an enum's values from a TAS** (an ability, a character, a fruit): the decomp often
|
|
98
112
|
proves the address and the numbering but not which value is which. Replay with `--watch
|
|
99
113
|
<addr>:<size>` and "-" for frames to log every change, then replay to a few hundred frames
|