@zthun/romulator-client 1.16.0 → 1.17.0
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/dist/game/game.d.mts +75 -3
- package/dist/index.cjs +337 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.js +337 -122
- package/dist/index.js.map +1 -1
- package/dist/players/players-serialize.d.mts +11 -0
- package/dist/players/players.d.mts +100 -0
- package/package.json +2 -2
package/dist/game/game.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IZRomulatorPlayers } from '../players/players.mjs';
|
|
1
2
|
import { ZRomulatorSystemId } from '../system/system-id.mjs';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a rom file or image.
|
|
@@ -16,15 +17,35 @@ export interface IZRomulatorGame {
|
|
|
16
17
|
* Battletoads and Double Dragon has the same name
|
|
17
18
|
* across 3 different systems.
|
|
18
19
|
*/
|
|
19
|
-
name
|
|
20
|
+
name: string;
|
|
20
21
|
/**
|
|
21
22
|
* The fully qualified path to the game file.
|
|
22
23
|
*/
|
|
23
|
-
file
|
|
24
|
+
file: string;
|
|
24
25
|
/**
|
|
25
26
|
* The system id that this game belongs to.
|
|
26
27
|
*/
|
|
27
|
-
system
|
|
28
|
+
system: ZRomulatorSystemId;
|
|
29
|
+
/**
|
|
30
|
+
* The date the game was released.
|
|
31
|
+
*/
|
|
32
|
+
release: string;
|
|
33
|
+
/**
|
|
34
|
+
* The developer studio.
|
|
35
|
+
*/
|
|
36
|
+
developer: string;
|
|
37
|
+
/**
|
|
38
|
+
* The publisher studio.
|
|
39
|
+
*/
|
|
40
|
+
publisher: string;
|
|
41
|
+
/**
|
|
42
|
+
* The game description.
|
|
43
|
+
*/
|
|
44
|
+
description: string;
|
|
45
|
+
/**
|
|
46
|
+
* The player information.
|
|
47
|
+
*/
|
|
48
|
+
players: IZRomulatorPlayers;
|
|
28
49
|
}
|
|
29
50
|
/**
|
|
30
51
|
* A builder for the IZRomulatorGame model.
|
|
@@ -67,6 +88,57 @@ export declare class ZRomulatorGameBuilder {
|
|
|
67
88
|
* This instance.
|
|
68
89
|
*/
|
|
69
90
|
system(system: ZRomulatorSystemId): this;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the release date for the game.
|
|
93
|
+
*
|
|
94
|
+
* @param release -
|
|
95
|
+
* The release information for the game.
|
|
96
|
+
* @returns
|
|
97
|
+
* This instance.
|
|
98
|
+
*/
|
|
99
|
+
release(release: string): this;
|
|
100
|
+
/**
|
|
101
|
+
* Sets the developer studio for the game.
|
|
102
|
+
*
|
|
103
|
+
* @param developer -
|
|
104
|
+
* The developer name.
|
|
105
|
+
* @returns
|
|
106
|
+
* This instance.
|
|
107
|
+
*/
|
|
108
|
+
developer(developer: string): this;
|
|
109
|
+
/**
|
|
110
|
+
* Sets the publisher studio for the game.
|
|
111
|
+
*
|
|
112
|
+
* @param publisher -
|
|
113
|
+
* The publisher name.
|
|
114
|
+
* @returns
|
|
115
|
+
* This instance.
|
|
116
|
+
*/
|
|
117
|
+
publisher(publisher: string): this;
|
|
118
|
+
/**
|
|
119
|
+
* Sets the description for the game.
|
|
120
|
+
*
|
|
121
|
+
* @param description -
|
|
122
|
+
* The game description.
|
|
123
|
+
* @returns
|
|
124
|
+
* This instance.
|
|
125
|
+
*/
|
|
126
|
+
description(description: string): this;
|
|
127
|
+
/**
|
|
128
|
+
* Sets the player configuration for the game.
|
|
129
|
+
*
|
|
130
|
+
* @param players -
|
|
131
|
+
* The player configuration.
|
|
132
|
+
* @returns
|
|
133
|
+
* This instance.
|
|
134
|
+
*/
|
|
135
|
+
players(players: IZRomulatorPlayers): this;
|
|
136
|
+
private parseDeveloper;
|
|
137
|
+
private parsePublisher;
|
|
138
|
+
private parseReleaseDate;
|
|
139
|
+
private parsePlayers;
|
|
140
|
+
private parseDescription;
|
|
141
|
+
private parseName;
|
|
70
142
|
/**
|
|
71
143
|
* Attempts to parse a game from a game entry in a system.json game
|
|
72
144
|
* list.
|
package/dist/index.cjs
CHANGED
|
@@ -18,7 +18,7 @@ class ZRomulatorConfigGamesMetadata {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function _define_property$
|
|
21
|
+
function _define_property$5(obj, key, value) {
|
|
22
22
|
if (key in obj) {
|
|
23
23
|
Object.defineProperty(obj, key, {
|
|
24
24
|
value: value,
|
|
@@ -51,11 +51,11 @@ class ZRomulatorConfigGamesBuilder {
|
|
|
51
51
|
return structuredClone(this._config);
|
|
52
52
|
}
|
|
53
53
|
constructor(){
|
|
54
|
-
_define_property$
|
|
54
|
+
_define_property$5(this, "_config", {});
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function _define_property$
|
|
58
|
+
function _define_property$4(obj, key, value) {
|
|
59
59
|
if (key in obj) {
|
|
60
60
|
Object.defineProperty(obj, key, {
|
|
61
61
|
value: value,
|
|
@@ -117,7 +117,7 @@ class ZRomulatorConfigBuilder {
|
|
|
117
117
|
return structuredClone(this._config);
|
|
118
118
|
}
|
|
119
119
|
constructor(){
|
|
120
|
-
_define_property$
|
|
120
|
+
_define_property$4(this, "_config", {
|
|
121
121
|
id: "games",
|
|
122
122
|
name: "",
|
|
123
123
|
file: ""
|
|
@@ -125,7 +125,7 @@ class ZRomulatorConfigBuilder {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
function _define_property$
|
|
128
|
+
function _define_property$3(obj, key, value) {
|
|
129
129
|
if (key in obj) {
|
|
130
130
|
Object.defineProperty(obj, key, {
|
|
131
131
|
value: value,
|
|
@@ -139,58 +139,48 @@ function _define_property$2(obj, key, value) {
|
|
|
139
139
|
return obj;
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
143
|
-
*/ class
|
|
142
|
+
* Creates player range instances
|
|
143
|
+
*/ class ZRomulatorPlayersBuilder {
|
|
144
144
|
/**
|
|
145
|
-
* Sets the
|
|
145
|
+
* Sets the minimum supported players.
|
|
146
146
|
*
|
|
147
|
-
* @param
|
|
148
|
-
*
|
|
149
|
-
* @returns
|
|
150
|
-
* This instance.
|
|
151
|
-
*/ id(id) {
|
|
152
|
-
this._game.id = id;
|
|
153
|
-
return this;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Sets the display name for the game.
|
|
147
|
+
* @param players -
|
|
148
|
+
* Minimum number of players.
|
|
157
149
|
*
|
|
158
|
-
* @param name -
|
|
159
|
-
* The canonical display name for the game.
|
|
160
150
|
* @returns
|
|
161
|
-
* This
|
|
162
|
-
*/
|
|
163
|
-
this.
|
|
151
|
+
* This object.
|
|
152
|
+
*/ min(players) {
|
|
153
|
+
this._players.min = players;
|
|
164
154
|
return this;
|
|
165
155
|
}
|
|
166
156
|
/**
|
|
167
|
-
* Sets the
|
|
157
|
+
* Sets the maximum supported players.
|
|
168
158
|
*
|
|
169
|
-
* @param
|
|
170
|
-
*
|
|
171
|
-
* @returns
|
|
172
|
-
* This instance.
|
|
173
|
-
*/ file(path) {
|
|
174
|
-
this._game.file = path;
|
|
175
|
-
return this;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Sets the system the game belongs to.
|
|
159
|
+
* @param players -
|
|
160
|
+
* Maximum number of players.
|
|
179
161
|
*
|
|
180
|
-
* @param system -
|
|
181
|
-
* The owning system id.
|
|
182
162
|
* @returns
|
|
183
|
-
* This
|
|
184
|
-
*/
|
|
185
|
-
this.
|
|
163
|
+
* This object.
|
|
164
|
+
*/ max(players) {
|
|
165
|
+
this._players.max = players;
|
|
186
166
|
return this;
|
|
187
167
|
}
|
|
168
|
+
range(min, max) {
|
|
169
|
+
return this.min(min).max(max);
|
|
170
|
+
}
|
|
171
|
+
parseMax(candidate) {
|
|
172
|
+
const max = lodashEs.get(candidate, "max");
|
|
173
|
+
return typeof max === "number" ? this.max(max) : this;
|
|
174
|
+
}
|
|
175
|
+
parseMin(candidate) {
|
|
176
|
+
const min = lodashEs.get(candidate, "min");
|
|
177
|
+
return typeof min === "number" ? this.min(min) : this;
|
|
178
|
+
}
|
|
188
179
|
/**
|
|
189
|
-
* Attempts to
|
|
190
|
-
* list.
|
|
180
|
+
* Attempts to read player range values from an arbitrary candidate.
|
|
191
181
|
*
|
|
192
182
|
* @param candidate -
|
|
193
|
-
*
|
|
183
|
+
* Source object to inspect.
|
|
194
184
|
*
|
|
195
185
|
* @returns
|
|
196
186
|
* This object.
|
|
@@ -198,101 +188,58 @@ function _define_property$2(obj, key, value) {
|
|
|
198
188
|
if (candidate == null || typeof candidate !== "object") {
|
|
199
189
|
return this;
|
|
200
190
|
}
|
|
201
|
-
|
|
202
|
-
if (name != null && typeof name === "string") {
|
|
203
|
-
this.name(name);
|
|
204
|
-
}
|
|
205
|
-
return this;
|
|
191
|
+
return this.parseMin(candidate).parseMax(candidate);
|
|
206
192
|
}
|
|
207
193
|
/**
|
|
208
|
-
* Copies an existing
|
|
194
|
+
* Copies an existing player range into this builder.
|
|
209
195
|
*
|
|
210
196
|
* @param other -
|
|
211
|
-
*
|
|
197
|
+
* Players object to duplicate.
|
|
198
|
+
*
|
|
212
199
|
* @returns
|
|
213
|
-
* This
|
|
200
|
+
* This object
|
|
214
201
|
*/ copy(other) {
|
|
215
|
-
this.
|
|
202
|
+
this._players = structuredClone(other);
|
|
216
203
|
return this;
|
|
217
204
|
}
|
|
218
205
|
/**
|
|
219
|
-
*
|
|
206
|
+
* Creates the final player range instance.
|
|
220
207
|
*
|
|
221
208
|
* @returns
|
|
222
|
-
* A
|
|
209
|
+
* A cloned IZRomulatorPlayers instance.
|
|
223
210
|
*/ build() {
|
|
224
|
-
|
|
225
|
-
return lodashEs.omitBy(clone, lodashEs.isUndefined);
|
|
211
|
+
return structuredClone(this._players);
|
|
226
212
|
}
|
|
227
213
|
constructor(){
|
|
228
|
-
_define_property$
|
|
229
|
-
|
|
214
|
+
_define_property$3(this, "_players", {
|
|
215
|
+
min: 1,
|
|
216
|
+
max: 1
|
|
230
217
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var ZRomulatorGameMediaType = /*#__PURE__*/ function(ZRomulatorGameMediaType) {
|
|
235
|
-
/**
|
|
236
|
-
* A 3d representation of the box art.
|
|
237
|
-
*/ ZRomulatorGameMediaType["Box3d"] = "3dboxes";
|
|
238
|
-
/**
|
|
239
|
-
* Back of the game box.
|
|
240
|
-
*/ ZRomulatorGameMediaType["BackCover"] = "backcovers";
|
|
241
|
-
/**
|
|
242
|
-
* Front of the game box.
|
|
243
|
-
*/ ZRomulatorGameMediaType["Cover"] = "covers";
|
|
244
|
-
/**
|
|
245
|
-
* Fan art.
|
|
246
|
-
*/ ZRomulatorGameMediaType["FanArt"] = "fanart";
|
|
247
|
-
/**
|
|
248
|
-
* Game manual.
|
|
249
|
-
*/ ZRomulatorGameMediaType["Manual"] = "manuals";
|
|
250
|
-
/**
|
|
251
|
-
* A marquee of a game.
|
|
252
|
-
*/ ZRomulatorGameMediaType["Marquee"] = "marquees";
|
|
253
|
-
/**
|
|
254
|
-
* The cartridge or disc label.
|
|
255
|
-
*/ ZRomulatorGameMediaType["PhysicalMedia"] = "physicalmedia";
|
|
256
|
-
/**
|
|
257
|
-
* An in game screenshot showcasing gameplay.
|
|
258
|
-
*/ ZRomulatorGameMediaType["Screenshot"] = "screenshots";
|
|
259
|
-
/**
|
|
260
|
-
* An in game screenshot of the title screen.
|
|
261
|
-
*/ ZRomulatorGameMediaType["Title"] = "titlescreens";
|
|
262
|
-
/**
|
|
263
|
-
* A video showcasing the game.
|
|
264
|
-
*/ ZRomulatorGameMediaType["Video"] = "videos";
|
|
265
|
-
return ZRomulatorGameMediaType;
|
|
266
|
-
}({});
|
|
267
|
-
/**
|
|
268
|
-
* Media type for a system.
|
|
269
|
-
*/ var ZRomulatorSystemMediaType = /*#__PURE__*/ function(ZRomulatorSystemMediaType) {
|
|
270
|
-
/**
|
|
271
|
-
* An image of a system's controller.
|
|
272
|
-
*/ ZRomulatorSystemMediaType["Controller"] = "controller";
|
|
273
|
-
/**
|
|
274
|
-
* A picture of the system.
|
|
218
|
+
/**
|
|
219
|
+
* Sets the player count to 1 player for both min and max.
|
|
275
220
|
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
*
|
|
221
|
+
* @returns
|
|
222
|
+
* This object.
|
|
223
|
+
*/ _define_property$3(this, "singlePlayer", this.range.bind(this, 1, 1));
|
|
224
|
+
/**
|
|
225
|
+
* Sets the player count to 2 for max and 1 for min.
|
|
281
226
|
*
|
|
282
|
-
*
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
227
|
+
* @returns
|
|
228
|
+
* This object.
|
|
229
|
+
*/ _define_property$3(this, "twoPlayer", this.range.bind(this, 1, 2));
|
|
230
|
+
/**
|
|
231
|
+
* Sets the player count to 4 for max and 1 for min.
|
|
232
|
+
*
|
|
233
|
+
* @returns
|
|
234
|
+
* This object.
|
|
235
|
+
*/ _define_property$3(this, "fourPlayer", this.range.bind(this, 1, 4));
|
|
236
|
+
/**
|
|
237
|
+
* Sets the player count to 8 for max and 1 for min.
|
|
238
|
+
*
|
|
239
|
+
* @returns
|
|
240
|
+
* This object.
|
|
241
|
+
*/ _define_property$3(this, "eightPlayer", this.range.bind(this, 1, 8));
|
|
242
|
+
}
|
|
296
243
|
}
|
|
297
244
|
|
|
298
245
|
/**
|
|
@@ -478,6 +425,259 @@ const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
|
478
425
|
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate);
|
|
479
426
|
}
|
|
480
427
|
|
|
428
|
+
function _define_property$2(obj, key, value) {
|
|
429
|
+
if (key in obj) {
|
|
430
|
+
Object.defineProperty(obj, key, {
|
|
431
|
+
value: value,
|
|
432
|
+
enumerable: true,
|
|
433
|
+
configurable: true,
|
|
434
|
+
writable: true
|
|
435
|
+
});
|
|
436
|
+
} else {
|
|
437
|
+
obj[key] = value;
|
|
438
|
+
}
|
|
439
|
+
return obj;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* A builder for the IZRomulatorGame model.
|
|
443
|
+
*/ class ZRomulatorGameBuilder {
|
|
444
|
+
/**
|
|
445
|
+
* Sets the unique id for the game.
|
|
446
|
+
*
|
|
447
|
+
* @param id -
|
|
448
|
+
* The unique identifier across all games and systems.
|
|
449
|
+
* @returns
|
|
450
|
+
* This instance.
|
|
451
|
+
*/ id(id) {
|
|
452
|
+
this._game.id = id;
|
|
453
|
+
return this;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Sets the display name for the game.
|
|
457
|
+
*
|
|
458
|
+
* @param name -
|
|
459
|
+
* The canonical display name for the game.
|
|
460
|
+
* @returns
|
|
461
|
+
* This instance.
|
|
462
|
+
*/ name(name) {
|
|
463
|
+
this._game.name = name;
|
|
464
|
+
return this;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Sets the file path for the rom.
|
|
468
|
+
*
|
|
469
|
+
* @param path -
|
|
470
|
+
* The fully qualified path to the game file.
|
|
471
|
+
* @returns
|
|
472
|
+
* This instance.
|
|
473
|
+
*/ file(path) {
|
|
474
|
+
this._game.file = path;
|
|
475
|
+
return this;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Sets the system the game belongs to.
|
|
479
|
+
*
|
|
480
|
+
* @param system -
|
|
481
|
+
* The owning system id.
|
|
482
|
+
* @returns
|
|
483
|
+
* This instance.
|
|
484
|
+
*/ system(system) {
|
|
485
|
+
this._game.system = system;
|
|
486
|
+
return this;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Sets the release date for the game.
|
|
490
|
+
*
|
|
491
|
+
* @param release -
|
|
492
|
+
* The release information for the game.
|
|
493
|
+
* @returns
|
|
494
|
+
* This instance.
|
|
495
|
+
*/ release(release) {
|
|
496
|
+
this._game.release = release;
|
|
497
|
+
return this;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Sets the developer studio for the game.
|
|
501
|
+
*
|
|
502
|
+
* @param developer -
|
|
503
|
+
* The developer name.
|
|
504
|
+
* @returns
|
|
505
|
+
* This instance.
|
|
506
|
+
*/ developer(developer) {
|
|
507
|
+
this._game.developer = developer;
|
|
508
|
+
return this;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Sets the publisher studio for the game.
|
|
512
|
+
*
|
|
513
|
+
* @param publisher -
|
|
514
|
+
* The publisher name.
|
|
515
|
+
* @returns
|
|
516
|
+
* This instance.
|
|
517
|
+
*/ publisher(publisher) {
|
|
518
|
+
this._game.publisher = publisher;
|
|
519
|
+
return this;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Sets the description for the game.
|
|
523
|
+
*
|
|
524
|
+
* @param description -
|
|
525
|
+
* The game description.
|
|
526
|
+
* @returns
|
|
527
|
+
* This instance.
|
|
528
|
+
*/ description(description) {
|
|
529
|
+
this._game.description = description;
|
|
530
|
+
return this;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Sets the player configuration for the game.
|
|
534
|
+
*
|
|
535
|
+
* @param players -
|
|
536
|
+
* The player configuration.
|
|
537
|
+
* @returns
|
|
538
|
+
* This instance.
|
|
539
|
+
*/ players(players) {
|
|
540
|
+
this._game.players = new ZRomulatorPlayersBuilder().copy(players).build();
|
|
541
|
+
return this;
|
|
542
|
+
}
|
|
543
|
+
parseDeveloper(candidate) {
|
|
544
|
+
const developer = lodashEs.get(candidate, "developer");
|
|
545
|
+
return typeof developer === "string" ? this.developer(developer) : this;
|
|
546
|
+
}
|
|
547
|
+
parsePublisher(candidate) {
|
|
548
|
+
const publisher = lodashEs.get(candidate, "publisher");
|
|
549
|
+
return typeof publisher === "string" ? this.publisher(publisher) : this;
|
|
550
|
+
}
|
|
551
|
+
parseReleaseDate(candidate) {
|
|
552
|
+
const release = lodashEs.get(candidate, "release");
|
|
553
|
+
return typeof release == "string" ? this.release(release) : this;
|
|
554
|
+
}
|
|
555
|
+
parsePlayers(candidate) {
|
|
556
|
+
const players = lodashEs.get(candidate, "players");
|
|
557
|
+
return this.players(new ZRomulatorPlayersBuilder().copy(this._game.players).parse(players).build());
|
|
558
|
+
}
|
|
559
|
+
parseDescription(candidate) {
|
|
560
|
+
const description = lodashEs.get(candidate, "description");
|
|
561
|
+
return typeof description === "string" ? this.description(description) : this;
|
|
562
|
+
}
|
|
563
|
+
parseName(candidate) {
|
|
564
|
+
const name = lodashEs.get(candidate, "name");
|
|
565
|
+
return typeof name === "string" ? this.name(name) : this;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Attempts to parse a game from a game entry in a system.json game
|
|
569
|
+
* list.
|
|
570
|
+
*
|
|
571
|
+
* @param candidate -
|
|
572
|
+
* The candidate to parse.
|
|
573
|
+
*
|
|
574
|
+
* @returns
|
|
575
|
+
* This object.
|
|
576
|
+
*/ parse(candidate) {
|
|
577
|
+
if (candidate == null || typeof candidate !== "object") {
|
|
578
|
+
return this;
|
|
579
|
+
}
|
|
580
|
+
return this.parseName(candidate).parseDescription(candidate).parsePlayers(candidate).parseReleaseDate(candidate).parseDeveloper(candidate).parsePublisher(candidate);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Copies an existing game into this builder.
|
|
584
|
+
*
|
|
585
|
+
* @param other -
|
|
586
|
+
* The other game to copy.
|
|
587
|
+
* @returns
|
|
588
|
+
* This instance.
|
|
589
|
+
*/ copy(other) {
|
|
590
|
+
this._game = structuredClone(other);
|
|
591
|
+
return this;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Builds the game instance.
|
|
595
|
+
*
|
|
596
|
+
* @returns
|
|
597
|
+
* A structured clone of the current game with undefined properties removed.
|
|
598
|
+
*/ build() {
|
|
599
|
+
const clone = structuredClone(this._game);
|
|
600
|
+
return lodashEs.omitBy(clone, lodashEs.isUndefined);
|
|
601
|
+
}
|
|
602
|
+
constructor(){
|
|
603
|
+
_define_property$2(this, "_game", {
|
|
604
|
+
id: "",
|
|
605
|
+
name: "",
|
|
606
|
+
file: "",
|
|
607
|
+
system: ZRomulatorSystemId.Adam,
|
|
608
|
+
release: "",
|
|
609
|
+
description: "",
|
|
610
|
+
developer: "",
|
|
611
|
+
publisher: "",
|
|
612
|
+
players: new ZRomulatorPlayersBuilder().build()
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
var ZRomulatorGameMediaType = /*#__PURE__*/ function(ZRomulatorGameMediaType) {
|
|
618
|
+
/**
|
|
619
|
+
* A 3d representation of the box art.
|
|
620
|
+
*/ ZRomulatorGameMediaType["Box3d"] = "3dboxes";
|
|
621
|
+
/**
|
|
622
|
+
* Back of the game box.
|
|
623
|
+
*/ ZRomulatorGameMediaType["BackCover"] = "backcovers";
|
|
624
|
+
/**
|
|
625
|
+
* Front of the game box.
|
|
626
|
+
*/ ZRomulatorGameMediaType["Cover"] = "covers";
|
|
627
|
+
/**
|
|
628
|
+
* Fan art.
|
|
629
|
+
*/ ZRomulatorGameMediaType["FanArt"] = "fanart";
|
|
630
|
+
/**
|
|
631
|
+
* Game manual.
|
|
632
|
+
*/ ZRomulatorGameMediaType["Manual"] = "manuals";
|
|
633
|
+
/**
|
|
634
|
+
* A marquee of a game.
|
|
635
|
+
*/ ZRomulatorGameMediaType["Marquee"] = "marquees";
|
|
636
|
+
/**
|
|
637
|
+
* The cartridge or disc label.
|
|
638
|
+
*/ ZRomulatorGameMediaType["PhysicalMedia"] = "physicalmedia";
|
|
639
|
+
/**
|
|
640
|
+
* An in game screenshot showcasing gameplay.
|
|
641
|
+
*/ ZRomulatorGameMediaType["Screenshot"] = "screenshots";
|
|
642
|
+
/**
|
|
643
|
+
* An in game screenshot of the title screen.
|
|
644
|
+
*/ ZRomulatorGameMediaType["Title"] = "titlescreens";
|
|
645
|
+
/**
|
|
646
|
+
* A video showcasing the game.
|
|
647
|
+
*/ ZRomulatorGameMediaType["Video"] = "videos";
|
|
648
|
+
return ZRomulatorGameMediaType;
|
|
649
|
+
}({});
|
|
650
|
+
/**
|
|
651
|
+
* Media type for a system.
|
|
652
|
+
*/ var ZRomulatorSystemMediaType = /*#__PURE__*/ function(ZRomulatorSystemMediaType) {
|
|
653
|
+
/**
|
|
654
|
+
* An image of a system's controller.
|
|
655
|
+
*/ ZRomulatorSystemMediaType["Controller"] = "controller";
|
|
656
|
+
/**
|
|
657
|
+
* A picture of the system.
|
|
658
|
+
*
|
|
659
|
+
* These are real life looking photos of what
|
|
660
|
+
* a system looks like.
|
|
661
|
+
*/ ZRomulatorSystemMediaType["Picture"] = "picture";
|
|
662
|
+
/**
|
|
663
|
+
* A wheel for a system.
|
|
664
|
+
*
|
|
665
|
+
* This is basically the logo.
|
|
666
|
+
*/ ZRomulatorSystemMediaType["Wheel"] = "wheel";
|
|
667
|
+
return ZRomulatorSystemMediaType;
|
|
668
|
+
}({});
|
|
669
|
+
const ZRomulatorSystemMediaTypeMap = lodashEs.keyBy(Object.values(ZRomulatorSystemMediaType));
|
|
670
|
+
const ZRomulatorGameMediaTypeMap = lodashEs.keyBy(Object.values(ZRomulatorGameMediaType));
|
|
671
|
+
function isSystemMediaType(candidate) {
|
|
672
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemMediaTypeMap, candidate);
|
|
673
|
+
}
|
|
674
|
+
function isGameMediaType(candidate) {
|
|
675
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate);
|
|
676
|
+
}
|
|
677
|
+
function isMediaType(candidate) {
|
|
678
|
+
return isSystemMediaType(candidate) || isGameMediaType(candidate);
|
|
679
|
+
}
|
|
680
|
+
|
|
481
681
|
function _define_property$1(obj, key, value) {
|
|
482
682
|
if (key in obj) {
|
|
483
683
|
Object.defineProperty(obj, key, {
|
|
@@ -560,6 +760,21 @@ function _define_property$1(obj, key, value) {
|
|
|
560
760
|
}
|
|
561
761
|
}
|
|
562
762
|
|
|
763
|
+
/**
|
|
764
|
+
* Represents a serializer for a players object.
|
|
765
|
+
*
|
|
766
|
+
* The serialized form of players is a single digit if min and max are equal, or
|
|
767
|
+
* a range string of #min-#max if they are different.
|
|
768
|
+
*/ class ZRomulatorPlayersSerialize {
|
|
769
|
+
serialize(candidate) {
|
|
770
|
+
if (candidate == null) {
|
|
771
|
+
return undefined;
|
|
772
|
+
}
|
|
773
|
+
const { min, max } = candidate;
|
|
774
|
+
return min === max ? `${min}` : `${min}-${max}`;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
563
778
|
/**
|
|
564
779
|
* The type of media content for a system.
|
|
565
780
|
*/ var ZRomulatorSystemContentType = /*#__PURE__*/ function(ZRomulatorSystemContentType) {
|
|
@@ -921,6 +1136,8 @@ exports.ZRomulatorConfigId = ZRomulatorConfigId;
|
|
|
921
1136
|
exports.ZRomulatorGameBuilder = ZRomulatorGameBuilder;
|
|
922
1137
|
exports.ZRomulatorGameMediaType = ZRomulatorGameMediaType;
|
|
923
1138
|
exports.ZRomulatorMediaBuilder = ZRomulatorMediaBuilder;
|
|
1139
|
+
exports.ZRomulatorPlayersBuilder = ZRomulatorPlayersBuilder;
|
|
1140
|
+
exports.ZRomulatorPlayersSerialize = ZRomulatorPlayersSerialize;
|
|
924
1141
|
exports.ZRomulatorSystemBuilder = ZRomulatorSystemBuilder;
|
|
925
1142
|
exports.ZRomulatorSystemContentType = ZRomulatorSystemContentType;
|
|
926
1143
|
exports.ZRomulatorSystemHardwareType = ZRomulatorSystemHardwareType;
|