@gameslate/sdk 0.3.19 → 0.3.21
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/build/verify-effects.mjs +11 -7
- package/lib/host/inspect.d.ts +3 -0
- package/lib/host/inspect.js +39 -6
- package/lib/host/verify.d.ts +9 -3
- package/lib/host/verify.js +16 -3
- package/lib/pack.d.ts +991 -0
- package/lib/pack.js +6 -0
- package/lib/plugin/contract.d.ts +2 -1
- package/lib/plugin-manifest.d.ts +60 -0
- package/lib/plugin-manifest.js +27 -0
- package/lib/plugin-permissions.js +21 -4
- package/lib/plugins-api.d.ts +42 -0
- package/lib/plugins-api.js +10 -0
- package/lib/types.d.ts +4 -3
- package/lib/types.js +2 -1
- package/package.json +1 -1
- package/template/claude/skills/build-gameslate-plugin/SKILL.md +31 -6
- package/template/claude/skills/verify-gameslate-plugin/SKILL.md +4 -3
- package/template/plugin/live.ts +2 -1
- package/template/plugin/manifest.json +7 -1
package/lib/pack.js
CHANGED
|
@@ -22,6 +22,12 @@ export const PackDataSchema = z.object({
|
|
|
22
22
|
})
|
|
23
23
|
.optional(),
|
|
24
24
|
});
|
|
25
|
+
/** A pack's data as the daemon serves it, with what the core knows about the game. */
|
|
26
|
+
export const ServedPackDataSchema = PackDataSchema.extend({
|
|
27
|
+
/** a loaded plugin's asset code builds this game's maps and assets from the player's own
|
|
28
|
+
* files (the cog's build button) */
|
|
29
|
+
buildsAssets: z.boolean(),
|
|
30
|
+
});
|
|
25
31
|
/** The data part of a pack, without its code. */
|
|
26
32
|
export function packToData(pack) {
|
|
27
33
|
return {
|
package/lib/plugin/contract.d.ts
CHANGED
|
@@ -52,7 +52,8 @@ export interface GamePlugin {
|
|
|
52
52
|
readonly executableHints: readonly string[];
|
|
53
53
|
/**
|
|
54
54
|
* Stats a launch wrapper from an older bundle may not send. While any is missing, the daemon
|
|
55
|
-
* fills them (and flags) from its own direct read of the game, without a relaunch
|
|
55
|
+
* fills them (and flags) from its own direct read of the game, without a relaunch, provided
|
|
56
|
+
* the wrapper introduced itself (cores after 2.3.0; older wrappers send no `bridge:hello`).
|
|
56
57
|
*/
|
|
57
58
|
readonly wrapperMayOmitStats?: readonly string[];
|
|
58
59
|
/**
|
package/lib/plugin-manifest.d.ts
CHANGED
|
@@ -35,6 +35,24 @@ export declare const PluginDownloadSchema: z.ZodObject<{
|
|
|
35
35
|
export type PluginDownload = z.infer<typeof PluginDownloadSchema>;
|
|
36
36
|
/** The input name a download reaches the asset code under. */
|
|
37
37
|
export declare const downloadInputName: (id: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* A build of a game that the plugin's live code reads memory from: the id its source matches
|
|
40
|
+
* (an ELF or PE build id, or an N64 ROM's code and version such as `CZLE.2`) and what the player
|
|
41
|
+
* knows it as (the executable's file name, or the ROM's title). Each is a permission, keyed by
|
|
42
|
+
* both, so a plugin that starts matching another process asks first ("Closing the sandbox" item 4).
|
|
43
|
+
* When a game lists its builds, the core refuses live code that matches one it doesn't list.
|
|
44
|
+
*/
|
|
45
|
+
export declare const GameBuildSchema: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
}, "strict", z.ZodTypeAny, {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
}, {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
}>;
|
|
55
|
+
export type GameBuild = z.infer<typeof GameBuildSchema>;
|
|
38
56
|
/** major.minor.patch, the only form `compareVersions` orders. */
|
|
39
57
|
export declare const PluginVersionSchema: z.ZodString;
|
|
40
58
|
/** The release zip a published manifest names: its URL (absolute, or relative to the URL the
|
|
@@ -122,6 +140,24 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
122
140
|
url: string;
|
|
123
141
|
sha256: string;
|
|
124
142
|
}[]>>;
|
|
143
|
+
/** the builds its live code reads memory from. Absent in manifests from
|
|
144
|
+
* before sdk 0.3.21: then the permission names only the game. */
|
|
145
|
+
builds: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
}, "strict", z.ZodTypeAny, {
|
|
149
|
+
id: string;
|
|
150
|
+
name: string;
|
|
151
|
+
}, {
|
|
152
|
+
id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
}>, "many">, {
|
|
155
|
+
id: string;
|
|
156
|
+
name: string;
|
|
157
|
+
}[], {
|
|
158
|
+
id: string;
|
|
159
|
+
name: string;
|
|
160
|
+
}[]>>;
|
|
125
161
|
}, "strict", z.ZodTypeAny, {
|
|
126
162
|
id: string;
|
|
127
163
|
title: string;
|
|
@@ -135,10 +171,18 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
135
171
|
url: string;
|
|
136
172
|
sha256: string;
|
|
137
173
|
}[];
|
|
174
|
+
builds?: {
|
|
175
|
+
id: string;
|
|
176
|
+
name: string;
|
|
177
|
+
}[] | undefined;
|
|
138
178
|
aliases?: string[] | undefined;
|
|
139
179
|
}, {
|
|
140
180
|
id: string;
|
|
141
181
|
title: string;
|
|
182
|
+
builds?: {
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
}[] | undefined;
|
|
142
186
|
aliases?: string[] | undefined;
|
|
143
187
|
inputs?: {
|
|
144
188
|
label: string;
|
|
@@ -187,6 +231,10 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
187
231
|
url: string;
|
|
188
232
|
sha256: string;
|
|
189
233
|
}[];
|
|
234
|
+
builds?: {
|
|
235
|
+
id: string;
|
|
236
|
+
name: string;
|
|
237
|
+
}[] | undefined;
|
|
190
238
|
aliases?: string[] | undefined;
|
|
191
239
|
}[];
|
|
192
240
|
assets?: {
|
|
@@ -209,6 +257,10 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
209
257
|
games: {
|
|
210
258
|
id: string;
|
|
211
259
|
title: string;
|
|
260
|
+
builds?: {
|
|
261
|
+
id: string;
|
|
262
|
+
name: string;
|
|
263
|
+
}[] | undefined;
|
|
212
264
|
aliases?: string[] | undefined;
|
|
213
265
|
inputs?: {
|
|
214
266
|
label: string;
|
|
@@ -253,6 +305,10 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
253
305
|
url: string;
|
|
254
306
|
sha256: string;
|
|
255
307
|
}[];
|
|
308
|
+
builds?: {
|
|
309
|
+
id: string;
|
|
310
|
+
name: string;
|
|
311
|
+
}[] | undefined;
|
|
256
312
|
aliases?: string[] | undefined;
|
|
257
313
|
}[];
|
|
258
314
|
assets?: {
|
|
@@ -275,6 +331,10 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
275
331
|
games: {
|
|
276
332
|
id: string;
|
|
277
333
|
title: string;
|
|
334
|
+
builds?: {
|
|
335
|
+
id: string;
|
|
336
|
+
name: string;
|
|
337
|
+
}[] | undefined;
|
|
278
338
|
aliases?: string[] | undefined;
|
|
279
339
|
inputs?: {
|
|
280
340
|
label: string;
|
package/lib/plugin-manifest.js
CHANGED
|
@@ -99,6 +99,26 @@ export const PluginDownloadSchema = z
|
|
|
99
99
|
.strict();
|
|
100
100
|
/** The input name a download reaches the asset code under. */
|
|
101
101
|
export const downloadInputName = (id) => `downloads/${id}`;
|
|
102
|
+
/**
|
|
103
|
+
* A build of a game that the plugin's live code reads memory from: the id its source matches
|
|
104
|
+
* (an ELF or PE build id, or an N64 ROM's code and version such as `CZLE.2`) and what the player
|
|
105
|
+
* knows it as (the executable's file name, or the ROM's title). Each is a permission, keyed by
|
|
106
|
+
* both, so a plugin that starts matching another process asks first ("Closing the sandbox" item 4).
|
|
107
|
+
* When a game lists its builds, the core refuses live code that matches one it doesn't list.
|
|
108
|
+
*/
|
|
109
|
+
export const GameBuildSchema = z
|
|
110
|
+
.object({
|
|
111
|
+
id: z
|
|
112
|
+
.string()
|
|
113
|
+
.regex(/^[A-Za-z0-9._-]{1,128}$/, 'a build id: letters, digits, ".", "_" or "-"'),
|
|
114
|
+
name: z
|
|
115
|
+
.string()
|
|
116
|
+
.min(1)
|
|
117
|
+
.max(100)
|
|
118
|
+
/* shown to the player in a permission: one plain line */
|
|
119
|
+
.regex(/^[^\p{Cc}]+$/u, 'a name without control characters'),
|
|
120
|
+
})
|
|
121
|
+
.strict();
|
|
102
122
|
const CodeFile = z.object({
|
|
103
123
|
file: FileName,
|
|
104
124
|
sha256: Sha256,
|
|
@@ -140,6 +160,13 @@ export const PluginManifestSchema = z
|
|
|
140
160
|
.max(20)
|
|
141
161
|
.refine(ds => new Set(ds.map(d => d.id)).size === ds.length, "a game's download ids are unique")
|
|
142
162
|
.default([]),
|
|
163
|
+
/** the builds its live code reads memory from. Absent in manifests from
|
|
164
|
+
* before sdk 0.3.21: then the permission names only the game. */
|
|
165
|
+
builds: z
|
|
166
|
+
.array(GameBuildSchema)
|
|
167
|
+
.max(50)
|
|
168
|
+
.refine(bs => new Set(bs.map(b => b.id)).size === bs.length, "a game's build ids are unique")
|
|
169
|
+
.optional(),
|
|
143
170
|
})
|
|
144
171
|
/* a misspelt key (`download`) is refused, not dropped with what it declared */
|
|
145
172
|
.strict())
|
|
@@ -13,10 +13,7 @@ export const PluginPermissionSchema = z.object({
|
|
|
13
13
|
label: z.string(),
|
|
14
14
|
});
|
|
15
15
|
export function pluginPermissions(manifest) {
|
|
16
|
-
const memory = manifest.games.
|
|
17
|
-
key: `memory:${g.id}`,
|
|
18
|
-
label: `Read ${g.title}'s memory while it runs`,
|
|
19
|
-
}));
|
|
16
|
+
const memory = manifest.games.flatMap(memoryPermissions);
|
|
20
17
|
/* the offered folders are read only by asset code */
|
|
21
18
|
const folders = manifest.assets
|
|
22
19
|
? [...new Set(manifest.games.flatMap(g => g.inputs.flatMap(i => i.folders)))].map(f => ({
|
|
@@ -31,6 +28,26 @@ export function pluginPermissions(manifest) {
|
|
|
31
28
|
])));
|
|
32
29
|
return [...memory, ...folders, ...[...downloads].map(([key, label]) => ({ key, label }))];
|
|
33
30
|
}
|
|
31
|
+
const BUILD_ID_SHOWN = 8;
|
|
32
|
+
/* One per build, keyed by its id and name: matching another process, or calling a build by
|
|
33
|
+
* another name, asks again. A manifest from before builds were declared names only the game. */
|
|
34
|
+
function memoryPermissions(game) {
|
|
35
|
+
if (!game.builds) {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
key: `memory:${game.id}`,
|
|
39
|
+
label: `Read ${game.title}'s memory while it runs, when you launch it through GameSlate`,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
return game.builds.map(b => ({
|
|
44
|
+
key: `memory:${game.id}:${b.id}#${b.name}`,
|
|
45
|
+
label: `Read the memory of ${b.name} (${game.title}, build ${shortBuildId(b.id)}), when you launch it through GameSlate`,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
function shortBuildId(id) {
|
|
49
|
+
return id.length > BUILD_ID_SHOWN ? `${id.slice(0, BUILD_ID_SHOWN)}…` : id;
|
|
50
|
+
}
|
|
34
51
|
/* host and path, as the player reads a link ("example.com/a/b.tar.gz") */
|
|
35
52
|
function downloadPlace(url) {
|
|
36
53
|
const u = new URL(url);
|
package/lib/plugins-api.d.ts
CHANGED
|
@@ -391,6 +391,23 @@ export declare const JobStatusSchema: z.ZodObject<{
|
|
|
391
391
|
building?: string[] | undefined;
|
|
392
392
|
}>;
|
|
393
393
|
export type JobStatus = z.infer<typeof JobStatusSchema>;
|
|
394
|
+
/** A plugin the core found but refused to load (bad manifest, failed checks, a game another
|
|
395
|
+
* plugin already provides). */
|
|
396
|
+
export declare const RefusedPluginSchema: z.ZodObject<{
|
|
397
|
+
/** its id, or its folder's name when its manifest can't be read */
|
|
398
|
+
name: z.ZodString;
|
|
399
|
+
version: z.ZodNullable<z.ZodString>;
|
|
400
|
+
reason: z.ZodString;
|
|
401
|
+
}, "strip", z.ZodTypeAny, {
|
|
402
|
+
name: string;
|
|
403
|
+
version: string | null;
|
|
404
|
+
reason: string;
|
|
405
|
+
}, {
|
|
406
|
+
name: string;
|
|
407
|
+
version: string | null;
|
|
408
|
+
reason: string;
|
|
409
|
+
}>;
|
|
410
|
+
export type RefusedPlugin = z.infer<typeof RefusedPluginSchema>;
|
|
394
411
|
export declare const PluginsResponseSchema: z.ZodObject<{
|
|
395
412
|
plugins: z.ZodArray<z.ZodObject<{
|
|
396
413
|
id: z.ZodString;
|
|
@@ -710,6 +727,21 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
710
727
|
name: string;
|
|
711
728
|
version: string;
|
|
712
729
|
}>, "many">;
|
|
730
|
+
/** plugins found but not loaded, with the reason */
|
|
731
|
+
refused: z.ZodArray<z.ZodObject<{
|
|
732
|
+
/** its id, or its folder's name when its manifest can't be read */
|
|
733
|
+
name: z.ZodString;
|
|
734
|
+
version: z.ZodNullable<z.ZodString>;
|
|
735
|
+
reason: z.ZodString;
|
|
736
|
+
}, "strip", z.ZodTypeAny, {
|
|
737
|
+
name: string;
|
|
738
|
+
version: string | null;
|
|
739
|
+
reason: string;
|
|
740
|
+
}, {
|
|
741
|
+
name: string;
|
|
742
|
+
version: string | null;
|
|
743
|
+
reason: string;
|
|
744
|
+
}>, "many">;
|
|
713
745
|
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
714
746
|
* damaged), or null */
|
|
715
747
|
installError: z.ZodNullable<z.ZodString>;
|
|
@@ -779,6 +811,11 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
779
811
|
error?: string | undefined;
|
|
780
812
|
building?: string[] | undefined;
|
|
781
813
|
} | null;
|
|
814
|
+
refused: {
|
|
815
|
+
name: string;
|
|
816
|
+
version: string | null;
|
|
817
|
+
reason: string;
|
|
818
|
+
}[];
|
|
782
819
|
installError: string | null;
|
|
783
820
|
}, {
|
|
784
821
|
hidden: {
|
|
@@ -846,6 +883,11 @@ export declare const PluginsResponseSchema: z.ZodObject<{
|
|
|
846
883
|
error?: string | undefined;
|
|
847
884
|
building?: string[] | undefined;
|
|
848
885
|
} | null;
|
|
886
|
+
refused: {
|
|
887
|
+
name: string;
|
|
888
|
+
version: string | null;
|
|
889
|
+
reason: string;
|
|
890
|
+
}[];
|
|
849
891
|
installError: string | null;
|
|
850
892
|
}>;
|
|
851
893
|
export type PluginsResponse = z.infer<typeof PluginsResponseSchema>;
|
package/lib/plugins-api.js
CHANGED
|
@@ -69,11 +69,21 @@ export const JobStatusSchema = z.object({
|
|
|
69
69
|
failures: z.array(z.object({ label: z.string(), error: z.string() })),
|
|
70
70
|
error: z.string().optional(),
|
|
71
71
|
});
|
|
72
|
+
/** A plugin the core found but refused to load (bad manifest, failed checks, a game another
|
|
73
|
+
* plugin already provides). */
|
|
74
|
+
export const RefusedPluginSchema = z.object({
|
|
75
|
+
/** its id, or its folder's name when its manifest can't be read */
|
|
76
|
+
name: z.string(),
|
|
77
|
+
version: z.string().nullable(),
|
|
78
|
+
reason: z.string(),
|
|
79
|
+
});
|
|
72
80
|
export const PluginsResponseSchema = z.object({
|
|
73
81
|
plugins: z.array(PluginViewSchema),
|
|
74
82
|
job: JobStatusSchema.nullable(),
|
|
75
83
|
/** presets the player hid: not loaded, offered to show again */
|
|
76
84
|
hidden: z.array(z.object({ id: z.string(), name: z.string(), version: z.string() })),
|
|
85
|
+
/** plugins found but not loaded, with the reason */
|
|
86
|
+
refused: z.array(RefusedPluginSchema),
|
|
77
87
|
/** why plugins can't be added, updated or removed right now (the daemon's install record is
|
|
78
88
|
* damaged), or null */
|
|
79
89
|
installError: z.string().nullable(),
|
package/lib/types.d.ts
CHANGED
|
@@ -2673,14 +2673,15 @@ export declare const ServerWsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Z
|
|
|
2673
2673
|
timestamp: number;
|
|
2674
2674
|
}>, z.ZodObject<{
|
|
2675
2675
|
type: z.ZodLiteral<"error">;
|
|
2676
|
-
|
|
2676
|
+
/** not_paired: a screen that may view, without the pairing token, tried a change */
|
|
2677
|
+
code: z.ZodEnum<["unauthorized", "bad_request", "not_paired"]>;
|
|
2677
2678
|
message: z.ZodString;
|
|
2678
2679
|
}, "strip", z.ZodTypeAny, {
|
|
2679
|
-
code: "unauthorized" | "bad_request";
|
|
2680
|
+
code: "unauthorized" | "bad_request" | "not_paired";
|
|
2680
2681
|
message: string;
|
|
2681
2682
|
type: "error";
|
|
2682
2683
|
}, {
|
|
2683
|
-
code: "unauthorized" | "bad_request";
|
|
2684
|
+
code: "unauthorized" | "bad_request" | "not_paired";
|
|
2684
2685
|
message: string;
|
|
2685
2686
|
type: "error";
|
|
2686
2687
|
}>]>;
|
package/lib/types.js
CHANGED
|
@@ -277,7 +277,8 @@ export const ServerWsMessageSchema = z.discriminatedUnion('type', [
|
|
|
277
277
|
}),
|
|
278
278
|
z.object({
|
|
279
279
|
type: z.literal('error'),
|
|
280
|
-
|
|
280
|
+
/** not_paired: a screen that may view, without the pairing token, tried a change */
|
|
281
|
+
code: z.enum(['unauthorized', 'bad_request', 'not_paired']),
|
|
281
282
|
message: z.string(),
|
|
282
283
|
}),
|
|
283
284
|
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gameslate/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
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",
|
|
@@ -97,13 +97,34 @@ evaluator in the SDK decides "done", "collected" and "available". Rules:
|
|
|
97
97
|
## 4. Memory addresses, verified
|
|
98
98
|
|
|
99
99
|
**Pin the build.** List the exact builds you verified in the source's `supportedBuildIds` (a
|
|
100
|
-
`Map` from build id to `{ region }` on the `GamePlugin` in `live.ts
|
|
100
|
+
`Map` from build id to `{ region }` on the `GamePlugin` in `live.ts`):
|
|
101
101
|
|
|
102
102
|
- ELF or PE build id for PC games;
|
|
103
103
|
- `CODE.version` from the ROM header for N64 (e.g. `CZLE.2`).
|
|
104
104
|
|
|
105
105
|
An unknown build means refuse to attach, never "try the nearest offsets".
|
|
106
106
|
|
|
107
|
+
**Declare the same builds in the manifest** (sdk 0.3.21), each with what the player knows it as,
|
|
108
|
+
the executable's file name or the ROM's title:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
"games": [{ "id": "perfect-dark", "title": "Perfect Dark",
|
|
112
|
+
"builds": [{ "id": "0925a5f6…", "name": "pd.pal.x86_64" }] }]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Each build is a permission ("Read the memory of pd.pal.x86_64 (Perfect Dark, build 0925a5f6…),
|
|
116
|
+
when you launch it through GameSlate"), keyed by id and name: adding a build or renaming one makes
|
|
117
|
+
every player confirm the update. The core (and `validate`) refuses live code that matches a build
|
|
118
|
+
the manifest doesn't list. A manifest without `builds` still loads, with a permission naming only
|
|
119
|
+
the game; declare them anyway, since that leniency is for releases built before 0.3.21.
|
|
120
|
+
|
|
121
|
+
**Memory is read only from games launched through GameSlate.** The core reads a process only
|
|
122
|
+
when it descends from a `gameslate run --` launch wrapper that is connected to the daemon
|
|
123
|
+
(Steam launch options `~/.local/bin/gameslate run -- %command%`, or `n64-gameslate` for
|
|
124
|
+
ChimeraOS's N64 launcher). A game started any other way shows "Launch <game> through GameSlate
|
|
125
|
+
to read it" in the app instead. Test live runs that way too: `gameslate-plugin verify` starts
|
|
126
|
+
the emulator through the spec's `gameslate` wrapper by default.
|
|
127
|
+
|
|
107
128
|
**Open-source ports.** Compile a probe against the game's headers: print `sizeof` of a big struct
|
|
108
129
|
(it must equal what the shipped build uses) and the `offsetof` of each field. Put each value in
|
|
109
130
|
`offsets.ts`, with a comment naming the struct field and where the number came from. Header
|
|
@@ -334,8 +355,11 @@ A plugin carries its games' committed map data in `plugin/registry/games/<gameId
|
|
|
334
355
|
into the bundle, and the core serves it at `/registry/games/<gameId>/…`. `gameslate-plugin
|
|
335
356
|
validate` and the core's loader refuse a plugin whose registry carries a game its manifest doesn't
|
|
336
357
|
list, a file outside that layout, a file failing its schema, a layer naming a missing SVG, or an
|
|
337
|
-
SVG with anything but `svg g path polygon polyline rect circle line text title`.
|
|
338
|
-
carrying the same game
|
|
358
|
+
SVG with anything but `svg g path polygon polyline rect circle line text title`. Of two plugins
|
|
359
|
+
carrying the same game (id or alias), the second is refused. Every refused plugin is listed in
|
|
360
|
+
the cog as "Not loaded: <id> <version>: <reason>": look there first when a deployed plugin is
|
|
361
|
+
missing. A game whose plugin has asset code tells the player, on a place without a map, that its
|
|
362
|
+
maps aren't built yet and to press "Build maps" in the cog, until an extraction has run.
|
|
339
363
|
|
|
340
364
|
Commit only simplified data you produced: schematic SVGs, pins, affines, location and item names,
|
|
341
365
|
your own hint prose. Game text (objective and dialogue strings from the game's language files) is
|
|
@@ -512,11 +536,12 @@ plugin exactly as the core will before running it. Then bump `version` in `packa
|
|
|
512
536
|
plugin's games and permissions, then downloads the zip, refuses it unless its sha256 matches, checks
|
|
513
537
|
the zip's own manifest is the published one, and unpacks it. It re-reads that URL about hourly: a
|
|
514
538
|
newer version that asks for **no new permissions** installs itself (once none of its games is
|
|
515
|
-
running); one that asks for more (a new game's memory, a new
|
|
516
|
-
confirm. A manifest naming an `extract` module (code outside the sandbox, removed in sdk 0.3.19)
|
|
539
|
+
running); one that asks for more (a new game's memory, a new or renamed build, a new folder)
|
|
540
|
+
waits for the player to confirm. A manifest naming an `extract` module (code outside the sandbox, removed in sdk 0.3.19)
|
|
517
541
|
fails the schema everywhere, presets included (docs/plugin-architecture.md, "Closing the
|
|
518
542
|
sandbox"). So adding a game, a folder or a download in a release
|
|
519
|
-
means every player is asked again: say why in the release notes.
|
|
543
|
+
means every player is asked again: say why in the release notes. So does a new build in
|
|
544
|
+
`builds`, or a changed build id or name. A plain zip URL works too
|
|
520
545
|
(validated the same way, its `.zip.sha256` used when present), but gets no updates.
|
|
521
546
|
|
|
522
547
|
GameSlate also builds a few plugins in as presets, from `plugins.lock.json` (the release URL and the
|
|
@@ -214,9 +214,10 @@ map), because the game saves the last choices.
|
|
|
214
214
|
addressing; the tool converts a guest address for you) and requires it to equal the plugin's
|
|
215
215
|
counter. That second opinion catches a wrong offset that still looks plausible. Use it for at
|
|
216
216
|
least one value per struct the plugin reads (save, live game state).
|
|
217
|
-
-
|
|
218
|
-
`
|
|
219
|
-
|
|
217
|
+
- GameSlate reads memory only from games launched through it, so the emulator starts through
|
|
218
|
+
the launch wrapper of the spec's `gameslate` (`node <gameslate> run -- <emulator>`). A spec
|
|
219
|
+
without `gameslate` needs its own `"launchPrefix"`; an emulator started bare is never read
|
|
220
|
+
(the daemon shows "Launch <game> through GameSlate to read it").
|
|
220
221
|
|
|
221
222
|
## 4. Run it
|
|
222
223
|
|
package/template/plugin/live.ts
CHANGED
|
@@ -33,7 +33,8 @@ const source: GamePlugin = {
|
|
|
33
33
|
gameId: GAME_ID,
|
|
34
34
|
stateSchemaVersion: 2,
|
|
35
35
|
capabilities: ['stats'],
|
|
36
|
-
/* the exact builds these reads were verified against (ELF/PE build id → label)
|
|
36
|
+
/* the exact builds these reads were verified against (ELF/PE build id → label); each is
|
|
37
|
+
* also in the manifest's `builds`, with the executable's name, or the core refuses it */
|
|
37
38
|
supportedBuildIds: new Map([
|
|
38
39
|
['0000000000000000000000000000000000000000', { region: 'example' }],
|
|
39
40
|
]),
|
|
@@ -3,5 +3,11 @@
|
|
|
3
3
|
"name": "{{name}}",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"sdkApi": 0,
|
|
6
|
-
"games": [
|
|
6
|
+
"games": [
|
|
7
|
+
{
|
|
8
|
+
"id": "{{id}}-game",
|
|
9
|
+
"title": "{{name}}",
|
|
10
|
+
"builds": [{ "id": "0000000000000000000000000000000000000000", "name": "{{id}}" }]
|
|
11
|
+
}
|
|
12
|
+
]
|
|
7
13
|
}
|