@zthun/romulator-client 1.8.0 → 1.10.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/index.cjs +41 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -18
- package/dist/index.js.map +1 -1
- package/dist/system/system.d.mts +22 -12
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -559,13 +559,18 @@ const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
|
559
559
|
* A builder for creating an IZRomulatorSystem.
|
|
560
560
|
*/ class ZRomulatorSystemBuilder {
|
|
561
561
|
_system = {
|
|
562
|
-
id: ZRomulatorSystemId.Nintendo
|
|
562
|
+
id: ZRomulatorSystemId.Nintendo,
|
|
563
|
+
extensions: [
|
|
564
|
+
"zip",
|
|
565
|
+
"7z"
|
|
566
|
+
]
|
|
563
567
|
};
|
|
564
568
|
/**
|
|
565
569
|
* Sets the id (slug) of the system.
|
|
566
570
|
*
|
|
567
571
|
* @param id -
|
|
568
572
|
* The unique identifier for the system.
|
|
573
|
+
*
|
|
569
574
|
* @returns
|
|
570
575
|
* This instance.
|
|
571
576
|
*/ id(id) {
|
|
@@ -577,6 +582,7 @@ const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
|
577
582
|
*
|
|
578
583
|
* @param name -
|
|
579
584
|
* The canonical name of the system.
|
|
585
|
+
*
|
|
580
586
|
* @returns
|
|
581
587
|
* This instance.
|
|
582
588
|
*/ name(name) {
|
|
@@ -584,6 +590,18 @@ const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
|
584
590
|
return this;
|
|
585
591
|
}
|
|
586
592
|
/**
|
|
593
|
+
* Sets the company that published the system.
|
|
594
|
+
*
|
|
595
|
+
* @param name -
|
|
596
|
+
* The name of the company.
|
|
597
|
+
*
|
|
598
|
+
* @returns
|
|
599
|
+
* This instance.
|
|
600
|
+
*/ company(name) {
|
|
601
|
+
this._system.company = name;
|
|
602
|
+
return this;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
587
605
|
* Sets the system hardware type.
|
|
588
606
|
*
|
|
589
607
|
* @param type -
|
|
@@ -651,29 +669,35 @@ const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
|
651
669
|
* This object.
|
|
652
670
|
*/ extension(extension) {
|
|
653
671
|
const extensions = helpfulFn.firstDefined([], this._system.extensions);
|
|
654
|
-
this._system.extensions = extensions.concat(extension);
|
|
672
|
+
this._system.extensions = lodashEs.uniqBy(extensions.concat(extension), lodashEs.upperCase).map((e)=>e.toLowerCase());
|
|
655
673
|
return this;
|
|
656
674
|
}
|
|
657
675
|
/**
|
|
658
|
-
*
|
|
676
|
+
* Parses an unknown object to try and build a system from it.
|
|
659
677
|
*
|
|
660
|
-
* @param
|
|
661
|
-
* The
|
|
678
|
+
* @param candidate -
|
|
679
|
+
* The candidate to try and parse.
|
|
662
680
|
*
|
|
663
681
|
* @returns
|
|
664
682
|
* This object.
|
|
665
|
-
*/
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
683
|
+
*/ parse(candidate) {
|
|
684
|
+
if (candidate == null || typeof candidate !== "object") {
|
|
685
|
+
return this;
|
|
686
|
+
}
|
|
687
|
+
const id = lodashEs.get(candidate, "id");
|
|
688
|
+
const name = lodashEs.get(candidate, "name");
|
|
689
|
+
const company = lodashEs.get(candidate, "company");
|
|
690
|
+
const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
691
|
+
if (isSystemId(id)) {
|
|
692
|
+
this.id(id);
|
|
693
|
+
}
|
|
694
|
+
if (name != null && typeof name === "string") {
|
|
695
|
+
this.name(name);
|
|
696
|
+
}
|
|
697
|
+
if (company != null && typeof company === "string") {
|
|
698
|
+
this.company(company);
|
|
699
|
+
}
|
|
700
|
+
return this.extension(extensions);
|
|
677
701
|
}
|
|
678
702
|
/**
|
|
679
703
|
* Builds the system instance.
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n","/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n","/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormatType {\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { isUndefined, omitBy, pick } from \"lodash-es\";\nimport type { ZRomulatorSystemContentType } from \"./system-content-type.mjs\";\nimport type { ZRomulatorSystemHardwareType } from \"./system-hardware-type.mjs\";\nimport { ZRomulatorSystemId } from \"./system-id.mjs\";\nimport type { ZRomulatorSystemMediaFormatType } from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name?: string;\n\n /**\n * The company that published the system.\n */\n company?: string;\n\n /**\n * The list of file extensions that system supports.\n */\n extensions?: string[];\n\n /**\n * Type classifications for the system.\n */\n classification?: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType?: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat?: ZRomulatorSystemMediaFormatType;\n\n /**\n * The digital format of the game media.\n */\n contentType?: ZRomulatorSystemContentType;\n };\n\n /**\n * The years the system was in production until.\n */\n productionYears?: {\n /**\n * The first year the system went into production.\n */\n start?: number;\n /**\n * The year when production stopped.\n */\n end?: number;\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.hardwareType = type;\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormatType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.mediaFormat = type;\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(start: number, end?: number) {\n delete this._system.productionYears;\n this._system.productionYears = {\n start,\n end,\n };\n this._system.productionYears = omitBy(\n this._system.productionYears,\n isUndefined,\n );\n return this;\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = extensions.concat(extension);\n return this;\n }\n\n /**\n * Assigns system data to this system.\n *\n * @param system -\n * The partial system data to assign.\n *\n * @returns\n * This object.\n */\n public assign(system: Partial<IZRomulatorSystem>) {\n this._system = { ...this._system, ...system };\n return this;\n }\n\n /**\n * Removes anything that is not a valid property on this object.\n */\n public redact() {\n this._system = pick(\n this._system,\n \"id\",\n \"name\",\n \"company\",\n \"extensions\",\n \"classification\",\n \"productionYears\",\n );\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","candidate","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemMediaFormatType","ZRomulatorSystemBuilder","_system","Nintendo","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","extension","extensions","pick"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,6BACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;A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A;AAC5C,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;;;MASOtE,MAAOa,CAAAA,MAAkC,EAAE;QAChD,IAAI,CAAC8C,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAG9C;AAAO,SAAA;AAC5C,QAAA,OAAO,IAAI;AACb;AAEA;;AAEC,MACD,MAAgB,GAAA;AACd,QAAA,IAAI,CAAC8C,OAAO,GAAGa,aAAAA,CACb,IAAI,CAACb,OAAO,EACZ,IACA,EAAA,MAAA,EACA,SACA,EAAA,YAAA,EACA,gBACA,EAAA,iBAAA,CAAA;AAEF,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO5D,eAAAA,CAAgB,IAAI,CAAC4D,OAAO,CAAA;AACrC;AACF;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n","/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n","/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormatType {\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport {\n castArray,\n get,\n isUndefined,\n omitBy,\n uniqBy,\n upperCase,\n} from \"lodash-es\";\nimport type { ZRomulatorSystemContentType } from \"./system-content-type.mjs\";\nimport type { ZRomulatorSystemHardwareType } from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport type { ZRomulatorSystemMediaFormatType } from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name?: string;\n\n /**\n * The company that published the system.\n */\n company?: string;\n\n /**\n * Type classifications for the system.\n */\n classification?: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType?: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat?: ZRomulatorSystemMediaFormatType;\n\n /**\n * The digital format of the game media.\n */\n contentType?: ZRomulatorSystemContentType;\n };\n\n /**\n * The years the system was in production until.\n */\n productionYears?: {\n /**\n * The first year the system went into production.\n */\n start?: number;\n /**\n * The year when production stopped.\n */\n end?: number;\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormatType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(start: number, end?: number) {\n delete this._system.productionYears;\n this._system.productionYears = {\n start,\n end,\n };\n this._system.productionYears = omitBy(\n this._system.productionYears,\n isUndefined,\n );\n\n return this;\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const id = get(candidate, \"id\");\n const name = get(candidate, \"name\");\n const company = get(candidate, \"company\");\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n if (isSystemId(id)) {\n this.id(id);\n }\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n if (company != null && typeof company === \"string\") {\n this.company(company);\n }\n\n return this.extension(extensions);\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","candidate","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemMediaFormatType","ZRomulatorSystemBuilder","_system","Nintendo","extensions","company","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","extension","uniqBy","upperCase","map","e","toLowerCase","parse","get","filter"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,6BACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;ACbO,MAAMC,4BAAAA,CAAAA;AACHC,IAAAA,OAAAA,GAAkC,EAAG;AAEtCV,IAAAA,WAAAA,CAAYW,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACD,OAAO,CAACV,WAAW,GAAGW,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACH,OAAO,GAAGI,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACH,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGG;AAAM,SA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O,IAAI;AACb;QAEA,MAAMtC,EAAAA,GAAK4F,aAAItD,SAAW,EAAA,IAAA,CAAA;QAC1B,MAAMpC,IAAAA,GAAO0F,aAAItD,SAAW,EAAA,MAAA,CAAA;QAC5B,MAAMqC,OAAAA,GAAUiB,aAAItD,SAAW,EAAA,SAAA,CAAA;AAC/B,QAAA,MAAMoC,aAAanD,kBAAUqE,CAAAA,YAAAA,CAAItD,SAAW,EAAA,YAAA,CAAA,CAAA,CACzCuD,MAAM,CAAC,CAAC/B,GAAQA,GAAAA,GAAAA,IAAO,MACvB+B,MAAM,CAAC,CAAC/B,GAAAA,GAAQ,OAAOA,GAAQ,KAAA,QAAA,CAAA;AAElC,QAAA,IAAIhB,WAAW9C,EAAK,CAAA,EAAA;YAClB,IAAI,CAACA,EAAE,CAACA,EAAAA,CAAAA;AACV;AAEA,QAAA,IAAIE,IAAQ,IAAA,IAAA,IAAQ,OAAOA,IAAAA,KAAS,QAAU,EAAA;YAC5C,IAAI,CAACA,IAAI,CAACA,IAAAA,CAAAA;AACZ;AAEA,QAAA,IAAIyE,OAAW,IAAA,IAAA,IAAQ,OAAOA,OAAAA,KAAY,QAAU,EAAA;YAClD,IAAI,CAACA,OAAO,CAACA,OAAAA,CAAAA;AACf;QAEA,OAAO,IAAI,CAACU,SAAS,CAACX,UAAAA,CAAAA;AACxB;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO9D,eAAAA,CAAgB,IAAI,CAAC4D,OAAO,CAAA;AACrC;AACF;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ZMetadataBuilder } from '@zthun/helpful-query';
|
|
2
2
|
import { firstDefined } from '@zthun/helpful-fn';
|
|
3
|
-
import { castArray, omitBy, isUndefined, keyBy, kebabCase,
|
|
3
|
+
import { castArray, omitBy, isUndefined, keyBy, kebabCase, uniqBy, upperCase, get } from 'lodash-es';
|
|
4
4
|
import { sep, extname, basename } from 'node:path';
|
|
5
5
|
|
|
6
6
|
class ZRomulatorConfigGamesMetadata {
|
|
@@ -555,13 +555,18 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
|
|
|
555
555
|
* A builder for creating an IZRomulatorSystem.
|
|
556
556
|
*/ class ZRomulatorSystemBuilder {
|
|
557
557
|
_system = {
|
|
558
|
-
id: ZRomulatorSystemId.Nintendo
|
|
558
|
+
id: ZRomulatorSystemId.Nintendo,
|
|
559
|
+
extensions: [
|
|
560
|
+
"zip",
|
|
561
|
+
"7z"
|
|
562
|
+
]
|
|
559
563
|
};
|
|
560
564
|
/**
|
|
561
565
|
* Sets the id (slug) of the system.
|
|
562
566
|
*
|
|
563
567
|
* @param id -
|
|
564
568
|
* The unique identifier for the system.
|
|
569
|
+
*
|
|
565
570
|
* @returns
|
|
566
571
|
* This instance.
|
|
567
572
|
*/ id(id) {
|
|
@@ -573,6 +578,7 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
|
|
|
573
578
|
*
|
|
574
579
|
* @param name -
|
|
575
580
|
* The canonical name of the system.
|
|
581
|
+
*
|
|
576
582
|
* @returns
|
|
577
583
|
* This instance.
|
|
578
584
|
*/ name(name) {
|
|
@@ -580,6 +586,18 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
|
|
|
580
586
|
return this;
|
|
581
587
|
}
|
|
582
588
|
/**
|
|
589
|
+
* Sets the company that published the system.
|
|
590
|
+
*
|
|
591
|
+
* @param name -
|
|
592
|
+
* The name of the company.
|
|
593
|
+
*
|
|
594
|
+
* @returns
|
|
595
|
+
* This instance.
|
|
596
|
+
*/ company(name) {
|
|
597
|
+
this._system.company = name;
|
|
598
|
+
return this;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
583
601
|
* Sets the system hardware type.
|
|
584
602
|
*
|
|
585
603
|
* @param type -
|
|
@@ -647,29 +665,35 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
|
|
|
647
665
|
* This object.
|
|
648
666
|
*/ extension(extension) {
|
|
649
667
|
const extensions = firstDefined([], this._system.extensions);
|
|
650
|
-
this._system.extensions = extensions.concat(extension);
|
|
668
|
+
this._system.extensions = uniqBy(extensions.concat(extension), upperCase).map((e)=>e.toLowerCase());
|
|
651
669
|
return this;
|
|
652
670
|
}
|
|
653
671
|
/**
|
|
654
|
-
*
|
|
672
|
+
* Parses an unknown object to try and build a system from it.
|
|
655
673
|
*
|
|
656
|
-
* @param
|
|
657
|
-
* The
|
|
674
|
+
* @param candidate -
|
|
675
|
+
* The candidate to try and parse.
|
|
658
676
|
*
|
|
659
677
|
* @returns
|
|
660
678
|
* This object.
|
|
661
|
-
*/
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
679
|
+
*/ parse(candidate) {
|
|
680
|
+
if (candidate == null || typeof candidate !== "object") {
|
|
681
|
+
return this;
|
|
682
|
+
}
|
|
683
|
+
const id = get(candidate, "id");
|
|
684
|
+
const name = get(candidate, "name");
|
|
685
|
+
const company = get(candidate, "company");
|
|
686
|
+
const extensions = castArray(get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
687
|
+
if (isSystemId(id)) {
|
|
688
|
+
this.id(id);
|
|
689
|
+
}
|
|
690
|
+
if (name != null && typeof name === "string") {
|
|
691
|
+
this.name(name);
|
|
692
|
+
}
|
|
693
|
+
if (company != null && typeof company === "string") {
|
|
694
|
+
this.company(company);
|
|
695
|
+
}
|
|
696
|
+
return this.extension(extensions);
|
|
673
697
|
}
|
|
674
698
|
/**
|
|
675
699
|
* Builds the system instance.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n","/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n","/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormatType {\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { isUndefined, omitBy, pick } from \"lodash-es\";\nimport type { ZRomulatorSystemContentType } from \"./system-content-type.mjs\";\nimport type { ZRomulatorSystemHardwareType } from \"./system-hardware-type.mjs\";\nimport { ZRomulatorSystemId } from \"./system-id.mjs\";\nimport type { ZRomulatorSystemMediaFormatType } from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name?: string;\n\n /**\n * The company that published the system.\n */\n company?: string;\n\n /**\n * The list of file extensions that system supports.\n */\n extensions?: string[];\n\n /**\n * Type classifications for the system.\n */\n classification?: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType?: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat?: ZRomulatorSystemMediaFormatType;\n\n /**\n * The digital format of the game media.\n */\n contentType?: ZRomulatorSystemContentType;\n };\n\n /**\n * The years the system was in production until.\n */\n productionYears?: {\n /**\n * The first year the system went into production.\n */\n start?: number;\n /**\n * The year when production stopped.\n */\n end?: number;\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.hardwareType = type;\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormatType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.mediaFormat = type;\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(start: number, end?: number) {\n delete this._system.productionYears;\n this._system.productionYears = {\n start,\n end,\n };\n this._system.productionYears = omitBy(\n this._system.productionYears,\n isUndefined,\n );\n return this;\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = extensions.concat(extension);\n return this;\n }\n\n /**\n * Assigns system data to this system.\n *\n * @param system -\n * The partial system data to assign.\n *\n * @returns\n * This object.\n */\n public assign(system: Partial<IZRomulatorSystem>) {\n this._system = { ...this._system, ...system };\n return this;\n }\n\n /**\n * Removes anything that is not a valid property on this object.\n */\n public redact() {\n this._system = pick(\n this._system,\n \"id\",\n \"name\",\n \"company\",\n \"extensions\",\n \"classification\",\n \"productionYears\",\n );\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","candidate","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemMediaFormatType","ZRomulatorSystemBuilder","_system","Nintendo","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","extension","extensions","pick"],"mappings":";;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,gBACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;ACbO,MAAMC,4BAAAA,CAAAA;AACHC,IAAAA,OAAAA,GAAkC,EAAG;AAEtCV,IAAAA,WAAAA,CAAYW,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACD,OAAO,CAACV,WAAW,GAAGW,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACH,OAAO,GAAGI,eAAgBD,CAAAA,KAA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ACZ,IACA,EAAA,MAAA,EACA,SACA,EAAA,YAAA,EACA,gBACA,EAAA,iBAAA,CAAA;AAEF,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO5D,eAAAA,CAAgB,IAAI,CAAC4D,OAAO,CAAA;AACrC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n","/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n","/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormatType {\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport {\n castArray,\n get,\n isUndefined,\n omitBy,\n uniqBy,\n upperCase,\n} from \"lodash-es\";\nimport type { ZRomulatorSystemContentType } from \"./system-content-type.mjs\";\nimport type { ZRomulatorSystemHardwareType } from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport type { ZRomulatorSystemMediaFormatType } from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name?: string;\n\n /**\n * The company that published the system.\n */\n company?: string;\n\n /**\n * Type classifications for the system.\n */\n classification?: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType?: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat?: ZRomulatorSystemMediaFormatType;\n\n /**\n * The digital format of the game media.\n */\n contentType?: ZRomulatorSystemContentType;\n };\n\n /**\n * The years the system was in production until.\n */\n productionYears?: {\n /**\n * The first year the system went into production.\n */\n start?: number;\n /**\n * The year when production stopped.\n */\n end?: number;\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormatType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(start: number, end?: number) {\n delete this._system.productionYears;\n this._system.productionYears = {\n start,\n end,\n };\n this._system.productionYears = omitBy(\n this._system.productionYears,\n isUndefined,\n );\n\n return this;\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const id = get(candidate, \"id\");\n const name = get(candidate, \"name\");\n const company = get(candidate, \"company\");\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n if (isSystemId(id)) {\n this.id(id);\n }\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n if (company != null && typeof company === \"string\") {\n this.company(company);\n }\n\n return this.extension(extensions);\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","candidate","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemMediaFormatType","ZRomulatorSystemBuilder","_system","Nintendo","extensions","company","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","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AAM,CAAC,CAAC/B,GAAAA,GAAQ,OAAOA,GAAQ,KAAA,QAAA,CAAA;AAElC,QAAA,IAAIhB,WAAW9C,EAAK,CAAA,EAAA;YAClB,IAAI,CAACA,EAAE,CAACA,EAAAA,CAAAA;AACV;AAEA,QAAA,IAAIE,IAAQ,IAAA,IAAA,IAAQ,OAAOA,IAAAA,KAAS,QAAU,EAAA;YAC5C,IAAI,CAACA,IAAI,CAACA,IAAAA,CAAAA;AACZ;AAEA,QAAA,IAAIyE,OAAW,IAAA,IAAA,IAAQ,OAAOA,OAAAA,KAAY,QAAU,EAAA;YAClD,IAAI,CAACA,OAAO,CAACA,OAAAA,CAAAA;AACf;QAEA,OAAO,IAAI,CAACU,SAAS,CAACX,UAAAA,CAAAA;AACxB;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO9D,eAAAA,CAAgB,IAAI,CAAC4D,OAAO,CAAA;AACrC;AACF;;;;"}
|
package/dist/system/system.d.mts
CHANGED
|
@@ -20,6 +20,12 @@ export interface IZRomulatorSystem {
|
|
|
20
20
|
* This is essentially a slug.
|
|
21
21
|
*/
|
|
22
22
|
id: ZRomulatorSystemId;
|
|
23
|
+
/**
|
|
24
|
+
* The list of file extensions that system supports.
|
|
25
|
+
*
|
|
26
|
+
* Extensions, zip and 7z, should always be in this list.
|
|
27
|
+
*/
|
|
28
|
+
extensions: string[];
|
|
23
29
|
/**
|
|
24
30
|
* The canonical name of the system.
|
|
25
31
|
*
|
|
@@ -32,10 +38,6 @@ export interface IZRomulatorSystem {
|
|
|
32
38
|
* The company that published the system.
|
|
33
39
|
*/
|
|
34
40
|
company?: string;
|
|
35
|
-
/**
|
|
36
|
-
* The list of file extensions that system supports.
|
|
37
|
-
*/
|
|
38
|
-
extensions?: string[];
|
|
39
41
|
/**
|
|
40
42
|
* Type classifications for the system.
|
|
41
43
|
*/
|
|
@@ -79,6 +81,7 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
79
81
|
*
|
|
80
82
|
* @param id -
|
|
81
83
|
* The unique identifier for the system.
|
|
84
|
+
*
|
|
82
85
|
* @returns
|
|
83
86
|
* This instance.
|
|
84
87
|
*/
|
|
@@ -88,10 +91,21 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
88
91
|
*
|
|
89
92
|
* @param name -
|
|
90
93
|
* The canonical name of the system.
|
|
94
|
+
*
|
|
91
95
|
* @returns
|
|
92
96
|
* This instance.
|
|
93
97
|
*/
|
|
94
98
|
name(name: string): this;
|
|
99
|
+
/**
|
|
100
|
+
* Sets the company that published the system.
|
|
101
|
+
*
|
|
102
|
+
* @param name -
|
|
103
|
+
* The name of the company.
|
|
104
|
+
*
|
|
105
|
+
* @returns
|
|
106
|
+
* This instance.
|
|
107
|
+
*/
|
|
108
|
+
company(name: string): this;
|
|
95
109
|
/**
|
|
96
110
|
* Sets the system hardware type.
|
|
97
111
|
*
|
|
@@ -145,19 +159,15 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
145
159
|
*/
|
|
146
160
|
extension(extension: string | string[]): this;
|
|
147
161
|
/**
|
|
148
|
-
*
|
|
162
|
+
* Parses an unknown object to try and build a system from it.
|
|
149
163
|
*
|
|
150
|
-
* @param
|
|
151
|
-
* The
|
|
164
|
+
* @param candidate -
|
|
165
|
+
* The candidate to try and parse.
|
|
152
166
|
*
|
|
153
167
|
* @returns
|
|
154
168
|
* This object.
|
|
155
169
|
*/
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Removes anything that is not a valid property on this object.
|
|
159
|
-
*/
|
|
160
|
-
redact(): this;
|
|
170
|
+
parse(candidate: unknown): this;
|
|
161
171
|
/**
|
|
162
172
|
* Builds the system instance.
|
|
163
173
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/romulator-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "A client for declaring models and invoking the romulator api",
|
|
5
5
|
"author": "Anthony Bonta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@zthun/helpful-fn": "^9.
|
|
29
|
-
"@zthun/helpful-query": "^9.
|
|
28
|
+
"@zthun/helpful-fn": "^9.8.0",
|
|
29
|
+
"@zthun/helpful-query": "^9.8.0",
|
|
30
30
|
"lodash-es": "^4.17.21"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/lodash-es": "^4.17.12",
|
|
34
|
-
"@zthun/janitor-build-config": "^19.4.
|
|
34
|
+
"@zthun/janitor-build-config": "^19.4.1",
|
|
35
35
|
"tsx": "^4.20.6",
|
|
36
36
|
"typescript": "^5.9.3",
|
|
37
37
|
"vite": "^7.1.11",
|
|
38
|
-
"vitest": "^
|
|
38
|
+
"vitest": "^4.0.1"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"sideEffects": false,
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "bad1143f9c40a8bd819117cb99bf2f1b58c005e6"
|
|
45
45
|
}
|