mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-19 07:12:36 -05:00
feat: add --source and --all-variants flags
This commit is contained in:
+52
-10
@@ -2275,8 +2275,19 @@ def _run_manifest_mode(
|
|||||||
if os.path.exists(registry_path):
|
if os.path.exists(registry_path):
|
||||||
with open(registry_path) as _rf:
|
with open(registry_path) as _rf:
|
||||||
registry = yaml.safe_load(_rf) or {}
|
registry = yaml.safe_load(_rf) or {}
|
||||||
|
|
||||||
|
if args.all_variants:
|
||||||
|
variants = [
|
||||||
|
("full", False), ("full", True),
|
||||||
|
("platform", False), ("platform", True),
|
||||||
|
("truth", False), ("truth", True),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
variants = [(args.source, args.required_only)]
|
||||||
|
|
||||||
|
for source, required_only in variants:
|
||||||
for group_platforms, representative in groups:
|
for group_platforms, representative in groups:
|
||||||
print(f"\nGenerating manifest for {representative}...")
|
print(f"\nGenerating manifest for {representative} [source={source}]...")
|
||||||
try:
|
try:
|
||||||
tc = target_cores_cache.get(representative) if args.target else None
|
tc = target_cores_cache.get(representative) if args.target else None
|
||||||
manifest = generate_manifest(
|
manifest = generate_manifest(
|
||||||
@@ -2289,8 +2300,13 @@ def _run_manifest_mode(
|
|||||||
zip_contents=zip_contents,
|
zip_contents=zip_contents,
|
||||||
emu_profiles=emu_profiles,
|
emu_profiles=emu_profiles,
|
||||||
target_cores=tc,
|
target_cores=tc,
|
||||||
|
source=source,
|
||||||
|
)
|
||||||
|
source_suffix = {"platform": "_platform", "truth": "_truth"}.get(source, "")
|
||||||
|
req_suffix = "_required" if required_only else ""
|
||||||
|
out_path = os.path.join(
|
||||||
|
args.output_dir, f"{representative}{source_suffix}{req_suffix}.json"
|
||||||
)
|
)
|
||||||
out_path = os.path.join(args.output_dir, f"{representative}.json")
|
|
||||||
_write_manifest_if_changed(out_path, manifest)
|
_write_manifest_if_changed(out_path, manifest)
|
||||||
print(
|
print(
|
||||||
f" {out_path}: {manifest['total_files']} files, "
|
f" {out_path}: {manifest['total_files']} files, "
|
||||||
@@ -2299,7 +2315,10 @@ def _run_manifest_mode(
|
|||||||
# Create aliases for grouped platforms (e.g., lakka -> retroarch)
|
# Create aliases for grouped platforms (e.g., lakka -> retroarch)
|
||||||
for alias_plat in group_platforms:
|
for alias_plat in group_platforms:
|
||||||
if alias_plat != representative:
|
if alias_plat != representative:
|
||||||
alias_path = os.path.join(args.output_dir, f"{alias_plat}.json")
|
alias_path = os.path.join(
|
||||||
|
args.output_dir,
|
||||||
|
f"{alias_plat}{source_suffix}{req_suffix}.json",
|
||||||
|
)
|
||||||
alias_manifest = dict(manifest)
|
alias_manifest = dict(manifest)
|
||||||
alias_manifest["platform"] = alias_plat
|
alias_manifest["platform"] = alias_plat
|
||||||
alias_cfg = load_platform_config(alias_plat, args.platforms_dir)
|
alias_cfg = load_platform_config(alias_plat, args.platforms_dir)
|
||||||
@@ -2470,17 +2489,27 @@ def _run_platform_packs(
|
|||||||
system_filter,
|
system_filter,
|
||||||
):
|
):
|
||||||
"""Generate ZIP packs for platform groups and verify."""
|
"""Generate ZIP packs for platform groups and verify."""
|
||||||
|
if args.all_variants:
|
||||||
|
variants = [
|
||||||
|
("full", False), ("full", True),
|
||||||
|
("platform", False), ("platform", True),
|
||||||
|
("truth", False), ("truth", True),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
variants = [(args.source, args.required_only)]
|
||||||
|
|
||||||
|
for source, required_only in variants:
|
||||||
for group_platforms, representative in groups:
|
for group_platforms, representative in groups:
|
||||||
variants = [p for p in group_platforms if p != representative]
|
aliases = [p for p in group_platforms if p != representative]
|
||||||
if variants:
|
if aliases:
|
||||||
all_names = [
|
all_names = [
|
||||||
load_platform_config(p, args.platforms_dir).get("platform", p)
|
load_platform_config(p, args.platforms_dir).get("platform", p)
|
||||||
for p in group_platforms
|
for p in group_platforms
|
||||||
]
|
]
|
||||||
label = " / ".join(all_names)
|
label = " / ".join(all_names)
|
||||||
print(f"\nGenerating pack for {label}...")
|
print(f"\nGenerating pack for {label} [source={source}]...")
|
||||||
else:
|
else:
|
||||||
print(f"\nGenerating pack for {representative}...")
|
print(f"\nGenerating pack for {representative} [source={source}]...")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tc = target_cores_cache.get(representative) if args.target else None
|
tc = target_cores_cache.get(representative) if args.target else None
|
||||||
@@ -2497,7 +2526,8 @@ def _run_platform_packs(
|
|||||||
data_registry=data_registry,
|
data_registry=data_registry,
|
||||||
emu_profiles=emu_profiles,
|
emu_profiles=emu_profiles,
|
||||||
target_cores=tc,
|
target_cores=tc,
|
||||||
required_only=args.required_only,
|
required_only=required_only,
|
||||||
|
source=source,
|
||||||
)
|
)
|
||||||
print(f" Split into {len(zip_paths)} packs")
|
print(f" Split into {len(zip_paths)} packs")
|
||||||
else:
|
else:
|
||||||
@@ -2513,10 +2543,11 @@ def _run_platform_packs(
|
|||||||
data_registry=data_registry,
|
data_registry=data_registry,
|
||||||
emu_profiles=emu_profiles,
|
emu_profiles=emu_profiles,
|
||||||
target_cores=tc,
|
target_cores=tc,
|
||||||
required_only=args.required_only,
|
required_only=required_only,
|
||||||
system_filter=system_filter,
|
system_filter=system_filter,
|
||||||
|
source=source,
|
||||||
)
|
)
|
||||||
if not args.split and zip_path and variants:
|
if not args.split and zip_path and aliases:
|
||||||
rep_cfg = load_platform_config(representative, args.platforms_dir)
|
rep_cfg = load_platform_config(representative, args.platforms_dir)
|
||||||
ver = rep_cfg.get("version", rep_cfg.get("dat_version", ""))
|
ver = rep_cfg.get("version", rep_cfg.get("dat_version", ""))
|
||||||
ver_tag = f"_{ver.replace(' ', '')}" if ver else ""
|
ver_tag = f"_{ver.replace(' ', '')}" if ver else ""
|
||||||
@@ -2599,6 +2630,17 @@ def main():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Only include required files, skip optional",
|
help="Only include required files, skip optional",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--source",
|
||||||
|
choices=["platform", "truth", "full"],
|
||||||
|
default="full",
|
||||||
|
help="File source: platform (YAML only), truth (emulator profiles), full (both)",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--all-variants",
|
||||||
|
action="store_true",
|
||||||
|
help="Generate all 6 source x required combinations",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--split", action="store_true", help="Generate one ZIP per system/manufacturer"
|
"--split", action="store_true", help="Generate one ZIP per system/manufacturer"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user