@zthun/romulator-client 1.11.0 → 1.13.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 +161 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +160 -39
- package/dist/index.js.map +1 -1
- package/dist/system/system-content-type.d.mts +16 -0
- package/dist/system/system-hardware-type.d.mts +16 -0
- package/dist/system/system-id.d.mts +8 -0
- package/dist/system/system-media-format-type.d.mts +17 -1
- package/dist/system/system.d.mts +60 -23
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -477,6 +477,14 @@ function isMediaType(candidate) {
|
|
|
477
477
|
const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
478
478
|
/**
|
|
479
479
|
* Gets whether a candidate string represents a system id.
|
|
480
|
+
*
|
|
481
|
+
* This check is case sensitive.
|
|
482
|
+
*
|
|
483
|
+
* @param candidate -
|
|
484
|
+
* The candidate to check.
|
|
485
|
+
*
|
|
486
|
+
* @returns
|
|
487
|
+
* True if candidate is a string that represents a system id.
|
|
480
488
|
*/ function isSystemId(candidate) {
|
|
481
489
|
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate);
|
|
482
490
|
}
|
|
@@ -567,6 +575,9 @@ function _define_property$1(obj, key, value) {
|
|
|
567
575
|
* The type of media content for a system.
|
|
568
576
|
*/ var ZRomulatorSystemContentType = /*#__PURE__*/ function(ZRomulatorSystemContentType) {
|
|
569
577
|
/**
|
|
578
|
+
* No idea
|
|
579
|
+
*/ ZRomulatorSystemContentType["Unknown"] = "unknown";
|
|
580
|
+
/**
|
|
570
581
|
* Uses memory roms.
|
|
571
582
|
*/ ZRomulatorSystemContentType["ReadOnlyMemory"] = "rom";
|
|
572
583
|
/**
|
|
@@ -580,11 +591,28 @@ function _define_property$1(obj, key, value) {
|
|
|
580
591
|
*/ ZRomulatorSystemContentType["Disk"] = "iso";
|
|
581
592
|
return ZRomulatorSystemContentType;
|
|
582
593
|
}({});
|
|
594
|
+
const ZRomulatorSystemContentTypeMap = lodashEs.keyBy(Object.values(ZRomulatorSystemContentType));
|
|
595
|
+
/**
|
|
596
|
+
* Gets whether a candidate string represents a system content type.
|
|
597
|
+
*
|
|
598
|
+
* This check is case sensitive.
|
|
599
|
+
*
|
|
600
|
+
* @param candidate -
|
|
601
|
+
* The candidate to check.
|
|
602
|
+
*
|
|
603
|
+
* @returns
|
|
604
|
+
* True if candidate is a string that represents a system content type.
|
|
605
|
+
*/ function isSystemContentType(candidate) {
|
|
606
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemContentTypeMap, candidate);
|
|
607
|
+
}
|
|
583
608
|
|
|
584
609
|
/**
|
|
585
610
|
* Describes the type of hardware a system is.
|
|
586
611
|
*/ var ZRomulatorSystemHardwareType = /*#__PURE__*/ function(ZRomulatorSystemHardwareType) {
|
|
587
612
|
/**
|
|
613
|
+
* No idea what this is.
|
|
614
|
+
*/ ZRomulatorSystemHardwareType["Unknown"] = "unknown";
|
|
615
|
+
/**
|
|
588
616
|
* An accessory that attaches to another system.
|
|
589
617
|
*/ ZRomulatorSystemHardwareType["Accessory"] = "accessory";
|
|
590
618
|
/**
|
|
@@ -613,26 +641,57 @@ function _define_property$1(obj, key, value) {
|
|
|
613
641
|
*/ ZRomulatorSystemHardwareType["VirtualMachine"] = "virtual-machine";
|
|
614
642
|
return ZRomulatorSystemHardwareType;
|
|
615
643
|
}({});
|
|
644
|
+
const ZRomulatorSystemHardwareTypeMap = lodashEs.keyBy(Object.values(ZRomulatorSystemHardwareType));
|
|
645
|
+
/**
|
|
646
|
+
* Gets whether a candidate string represents a system hardware type.
|
|
647
|
+
*
|
|
648
|
+
* This check is case sensitive.
|
|
649
|
+
*
|
|
650
|
+
* @param candidate -
|
|
651
|
+
* The candidate to check.
|
|
652
|
+
*
|
|
653
|
+
* @returns
|
|
654
|
+
* True if candidate is a string that represents a system hardware type.
|
|
655
|
+
*/ function isSystemHardwareType(candidate) {
|
|
656
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemHardwareTypeMap, candidate);
|
|
657
|
+
}
|
|
616
658
|
|
|
617
659
|
/**
|
|
618
660
|
* The type of media a system supports.
|
|
619
|
-
*/ var
|
|
661
|
+
*/ var ZRomulatorSystemMediaFormat = /*#__PURE__*/ function(ZRomulatorSystemMediaFormat) {
|
|
662
|
+
/**
|
|
663
|
+
* No idea
|
|
664
|
+
*/ ZRomulatorSystemMediaFormat["Unknown"] = "unknown";
|
|
620
665
|
/**
|
|
621
666
|
* Cartridge based systems.
|
|
622
|
-
*/
|
|
667
|
+
*/ ZRomulatorSystemMediaFormat["Cartridge"] = "cartridge";
|
|
623
668
|
/**
|
|
624
669
|
* Motherboard based systems.
|
|
625
670
|
*
|
|
626
671
|
* Usually for arcades.
|
|
627
|
-
*/
|
|
672
|
+
*/ ZRomulatorSystemMediaFormat["Pcb"] = "pcb";
|
|
628
673
|
/**
|
|
629
674
|
* CD/DVD based systems.
|
|
630
|
-
*/
|
|
675
|
+
*/ ZRomulatorSystemMediaFormat["Cd"] = "cd";
|
|
631
676
|
/**
|
|
632
677
|
* Floppy disk based systems.
|
|
633
|
-
*/
|
|
634
|
-
return
|
|
678
|
+
*/ ZRomulatorSystemMediaFormat["FloppyDisk"] = "floppy-disk";
|
|
679
|
+
return ZRomulatorSystemMediaFormat;
|
|
635
680
|
}({});
|
|
681
|
+
const ZRomulatorSystemMediaFormatMap = lodashEs.keyBy(Object.values(ZRomulatorSystemMediaFormat));
|
|
682
|
+
/**
|
|
683
|
+
* Gets whether a candidate string represents a system media format.
|
|
684
|
+
*
|
|
685
|
+
* This check is case sensitive.
|
|
686
|
+
*
|
|
687
|
+
* @param candidate -
|
|
688
|
+
* The candidate to check.
|
|
689
|
+
*
|
|
690
|
+
* @returns
|
|
691
|
+
* True if candidate is a string that represents a system media format.
|
|
692
|
+
*/ function isSystemMediaFormat(candidate) {
|
|
693
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemMediaFormatMap, candidate);
|
|
694
|
+
}
|
|
636
695
|
|
|
637
696
|
function _define_property(obj, key, value) {
|
|
638
697
|
if (key in obj) {
|
|
@@ -695,7 +754,6 @@ function _define_property(obj, key, value) {
|
|
|
695
754
|
* @returns
|
|
696
755
|
* This instance.
|
|
697
756
|
*/ hardware(type) {
|
|
698
|
-
this._system.classification = helpfulFn.firstDefined({}, this._system.classification);
|
|
699
757
|
this._system.classification.hardwareType = type;
|
|
700
758
|
return this;
|
|
701
759
|
}
|
|
@@ -708,7 +766,6 @@ function _define_property(obj, key, value) {
|
|
|
708
766
|
* @returns
|
|
709
767
|
* This instance.
|
|
710
768
|
*/ mediaFormat(type) {
|
|
711
|
-
this._system.classification = helpfulFn.firstDefined({}, this._system.classification);
|
|
712
769
|
this._system.classification.mediaFormat = type;
|
|
713
770
|
return this;
|
|
714
771
|
}
|
|
@@ -721,12 +778,37 @@ function _define_property(obj, key, value) {
|
|
|
721
778
|
* @returns
|
|
722
779
|
* This instance.
|
|
723
780
|
*/ contentType(type) {
|
|
724
|
-
this._system.classification = helpfulFn.firstDefined({}, this._system.classification);
|
|
725
781
|
this._system.classification.contentType = type;
|
|
726
782
|
return this;
|
|
727
783
|
}
|
|
728
784
|
/**
|
|
729
|
-
* Sets the production
|
|
785
|
+
* Sets the production start value.
|
|
786
|
+
*
|
|
787
|
+
* @param start -
|
|
788
|
+
* The year the system was released into production.
|
|
789
|
+
* Use '?' if you do not know this information.
|
|
790
|
+
*
|
|
791
|
+
* @returns
|
|
792
|
+
* This object.
|
|
793
|
+
*/ productionStart(start) {
|
|
794
|
+
this._system.productionYears.start = start;
|
|
795
|
+
return this;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Sets the production end of life value.
|
|
799
|
+
*
|
|
800
|
+
* @param end -
|
|
801
|
+
* The end of life year. Set to current
|
|
802
|
+
* to mark no end of life.
|
|
803
|
+
*
|
|
804
|
+
* @returns
|
|
805
|
+
* This object.
|
|
806
|
+
*/ productionEnd(end) {
|
|
807
|
+
this._system.productionYears.end = end;
|
|
808
|
+
return this;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Sets the full production run.
|
|
730
812
|
*
|
|
731
813
|
* @param start -
|
|
732
814
|
* The starting year of production.
|
|
@@ -735,14 +817,8 @@ function _define_property(obj, key, value) {
|
|
|
735
817
|
*
|
|
736
818
|
* @returns
|
|
737
819
|
* This object.
|
|
738
|
-
*/ production(start, end) {
|
|
739
|
-
|
|
740
|
-
this._system.productionYears = {
|
|
741
|
-
start,
|
|
742
|
-
end
|
|
743
|
-
};
|
|
744
|
-
this._system.productionYears = lodashEs.omitBy(this._system.productionYears, lodashEs.isUndefined);
|
|
745
|
-
return this;
|
|
820
|
+
*/ production(start = "?", end = "current") {
|
|
821
|
+
return this.productionStart(start).productionEnd(end);
|
|
746
822
|
}
|
|
747
823
|
/**
|
|
748
824
|
* Adds to the extension list.
|
|
@@ -753,10 +829,56 @@ function _define_property(obj, key, value) {
|
|
|
753
829
|
* @returns
|
|
754
830
|
* This object.
|
|
755
831
|
*/ extension(extension) {
|
|
756
|
-
const extensions =
|
|
757
|
-
|
|
832
|
+
const { extensions: current } = this._system;
|
|
833
|
+
const extensions = lodashEs.castArray(extension).map((e)=>helpfulFn.castExtension(e));
|
|
834
|
+
const unique = lodashEs.uniqBy(current.concat(extensions), lodashEs.lowerCase);
|
|
835
|
+
this._system.extensions = unique.filter((e)=>e != null).map((e)=>e?.toLowerCase());
|
|
758
836
|
return this;
|
|
759
837
|
}
|
|
838
|
+
parseId(candidate) {
|
|
839
|
+
const id = lodashEs.get(candidate, "id");
|
|
840
|
+
return isSystemId(id) ? this.id(id) : this;
|
|
841
|
+
}
|
|
842
|
+
parseName(candidate) {
|
|
843
|
+
const name = lodashEs.get(candidate, "name");
|
|
844
|
+
return name != null && typeof name === "string" ? this.name(name) : this;
|
|
845
|
+
}
|
|
846
|
+
parseCompany(candidate) {
|
|
847
|
+
const company = lodashEs.get(candidate, "company");
|
|
848
|
+
return company != null && typeof company === "string" ? this.company(company) : this;
|
|
849
|
+
}
|
|
850
|
+
parseExtensions(candidate) {
|
|
851
|
+
const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string").map((ext)=>helpfulFn.castExtension(ext));
|
|
852
|
+
return this.extension(extensions);
|
|
853
|
+
}
|
|
854
|
+
parseHardwareType(classification) {
|
|
855
|
+
const hardwareType = lodashEs.get(classification, "hardwareType");
|
|
856
|
+
return isSystemHardwareType(hardwareType) ? this.hardware(hardwareType) : this;
|
|
857
|
+
}
|
|
858
|
+
parseMediaFormat(classification) {
|
|
859
|
+
const mediaFormat = lodashEs.get(classification, "mediaFormat");
|
|
860
|
+
return isSystemMediaFormat(mediaFormat) ? this.mediaFormat(mediaFormat) : this;
|
|
861
|
+
}
|
|
862
|
+
parseContentType(classification) {
|
|
863
|
+
const contentType = lodashEs.get(classification, "contentType");
|
|
864
|
+
return isSystemContentType(contentType) ? this.contentType(contentType) : this;
|
|
865
|
+
}
|
|
866
|
+
parseClassification(candidate) {
|
|
867
|
+
const classification = lodashEs.get(candidate, "classification");
|
|
868
|
+
return classification != null && typeof classification === "object" ? this.parseHardwareType(classification).parseMediaFormat(classification).parseContentType(classification) : this;
|
|
869
|
+
}
|
|
870
|
+
parseProductionStart(productionYears) {
|
|
871
|
+
const start = lodashEs.get(productionYears, "start");
|
|
872
|
+
return typeof start === "number" || start === "?" ? this.productionStart(start) : this;
|
|
873
|
+
}
|
|
874
|
+
parseProductionEnd(productionYears) {
|
|
875
|
+
const end = lodashEs.get(productionYears, "end");
|
|
876
|
+
return typeof end === "number" || end === "current" ? this.productionEnd(end) : this;
|
|
877
|
+
}
|
|
878
|
+
parseProductionYears(candidate) {
|
|
879
|
+
const production = lodashEs.get(candidate, "productionYears");
|
|
880
|
+
return production != null && typeof production === "object" ? this.parseProductionStart(production).parseProductionEnd(production) : this;
|
|
881
|
+
}
|
|
760
882
|
/**
|
|
761
883
|
* Parses an unknown object to try and build a system from it.
|
|
762
884
|
*
|
|
@@ -769,20 +891,8 @@ function _define_property(obj, key, value) {
|
|
|
769
891
|
if (candidate == null || typeof candidate !== "object") {
|
|
770
892
|
return this;
|
|
771
893
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
const company = lodashEs.get(candidate, "company");
|
|
775
|
-
const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
776
|
-
if (isSystemId(id)) {
|
|
777
|
-
this.id(id);
|
|
778
|
-
}
|
|
779
|
-
if (name != null && typeof name === "string") {
|
|
780
|
-
this.name(name);
|
|
781
|
-
}
|
|
782
|
-
if (company != null && typeof company === "string") {
|
|
783
|
-
this.company(company);
|
|
784
|
-
}
|
|
785
|
-
return this.extension(extensions);
|
|
894
|
+
this.parseId(candidate).parseName(candidate).parseCompany(candidate).parseExtensions(candidate).parseClassification(candidate).parseProductionYears(candidate);
|
|
895
|
+
return this;
|
|
786
896
|
}
|
|
787
897
|
/**
|
|
788
898
|
* Builds the system instance.
|
|
@@ -796,9 +906,20 @@ function _define_property(obj, key, value) {
|
|
|
796
906
|
constructor(){
|
|
797
907
|
_define_property(this, "_system", {
|
|
798
908
|
id: ZRomulatorSystemId.Nintendo,
|
|
909
|
+
name: "",
|
|
910
|
+
classification: {
|
|
911
|
+
hardwareType: ZRomulatorSystemHardwareType.Unknown,
|
|
912
|
+
mediaFormat: ZRomulatorSystemMediaFormat.Unknown,
|
|
913
|
+
contentType: ZRomulatorSystemContentType.Unknown
|
|
914
|
+
},
|
|
915
|
+
company: "",
|
|
916
|
+
productionYears: {
|
|
917
|
+
start: "?",
|
|
918
|
+
end: "current"
|
|
919
|
+
},
|
|
799
920
|
extensions: [
|
|
800
|
-
"zip",
|
|
801
|
-
"7z"
|
|
921
|
+
".zip",
|
|
922
|
+
".7z"
|
|
802
923
|
]
|
|
803
924
|
});
|
|
804
925
|
}
|
|
@@ -815,10 +936,13 @@ exports.ZRomulatorSystemBuilder = ZRomulatorSystemBuilder;
|
|
|
815
936
|
exports.ZRomulatorSystemContentType = ZRomulatorSystemContentType;
|
|
816
937
|
exports.ZRomulatorSystemHardwareType = ZRomulatorSystemHardwareType;
|
|
817
938
|
exports.ZRomulatorSystemId = ZRomulatorSystemId;
|
|
818
|
-
exports.
|
|
939
|
+
exports.ZRomulatorSystemMediaFormat = ZRomulatorSystemMediaFormat;
|
|
819
940
|
exports.ZRomulatorSystemMediaType = ZRomulatorSystemMediaType;
|
|
820
941
|
exports.isGameMediaType = isGameMediaType;
|
|
821
942
|
exports.isMediaType = isMediaType;
|
|
943
|
+
exports.isSystemContentType = isSystemContentType;
|
|
944
|
+
exports.isSystemHardwareType = isSystemHardwareType;
|
|
822
945
|
exports.isSystemId = isSystemId;
|
|
946
|
+
exports.isSystemMediaFormat = isSystemMediaFormat;
|
|
823
947
|
exports.isSystemMediaType = isSystemMediaType;
|
|
824
948
|
//# sourceMappingURL=index.cjs.map
|
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 { get, 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 * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\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","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","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","company","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","filter","Nintendo"],"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;;;;;;;;;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AAA,CAAA,CACzCgE,MAAM,CAAC,CAAC5B,GAAQA,GAAAA,GAAAA,IAAO,MACvB4B,MAAM,CAAC,CAAC5B,GAAAA,GAAQ,OAAOA,GAAQ,KAAA,QAAA,CAAA;AAElC,QAAA,IAAIhB,WAAWjD,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,IAAI0E,OAAW,IAAA,IAAA,IAAQ,OAAOA,OAAAA,KAAY,QAAU,EAAA;YAClD,IAAI,CAACA,OAAO,CAACA,OAAAA,CAAAA;AACf;QAEA,OAAO,IAAI,CAACU,SAAS,CAACC,UAAAA,CAAAA;AACxB;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC+D,OAAO,CAAA;AACrC;;AA1LA,QAAA,gBAAA,CAAA,IAAA,EAAQA,SAA6B,EAAA;AACnC3E,YAAAA,EAAAA,EAAI+C,mBAAmB+C,QAAQ;YAC/BP,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwLF;;;;;;;;;;;;;;;;;;;;"}
|
|
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 { get, 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 * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\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 *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that 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","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\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\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\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\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\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\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { castExtension } from \"@zthun/helpful-fn\";\nimport { castArray, get, lowerCase, uniqBy } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} 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 * 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: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\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 years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\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.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: ZRomulatorSystemMediaFormat): this {\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.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full 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(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\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: current } = this._system;\n const extensions = castArray(extension).map((e) => castExtension(e));\n const unique = uniqBy(current.concat(extensions), lowerCase);\n\n this._system.extensions = unique\n .filter((e) => e != null)\n .map((e) => e?.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\")\n .map((ext) => castExtension(ext));\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : 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 this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\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","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","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","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","current","map","e","castExtension","unique","uniqBy","lowerCase","filter","toLowerCase","parseId","parseName","parseCompany","parseExtensions","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"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;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACF,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGE;AAAM,SAAA;AAC3C,QAAA,OAAO,IAAI;AACb;IAEOL,KAAgC,GAAA;QACrC,OAAOM,eAAAA,CAAgB,IAAI,CAACH,OAAO,CAAA;AACrC;;AAnBA,QAAAK,kBAAA,CAAA,IAAA,EAAQL,WAAkC,EAAC,CAAA;;AAoB7C;;;;;;;;;;;;;;;ACrBA;;IAGO,IAAKM,kBAAAA,iBAAAA,SAAAA,kBAAAA,EAAAA;AACV;;AAEC,MAAA,kBAAA,CA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