mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-04-13 12:22:33 -05:00
fix: truth mode skipping phases 2-3 due to indent
This commit is contained in:
@@ -1336,148 +1336,148 @@ def generate_pack(
|
|||||||
zf.write(local_path, full_dest)
|
zf.write(local_path, full_dest)
|
||||||
total_files += 1
|
total_files += 1
|
||||||
|
|
||||||
# Core requirements: files platform's cores need but YAML doesn't declare
|
# Core requirements: files platform's cores need but YAML doesn't declare
|
||||||
if emu_profiles is None:
|
if emu_profiles is None:
|
||||||
emu_profiles = load_emulator_profiles(emulators_dir)
|
emu_profiles = load_emulator_profiles(emulators_dir)
|
||||||
if source == "platform":
|
if source == "platform":
|
||||||
core_files = []
|
core_files = []
|
||||||
elif precomputed_extras is not None:
|
elif precomputed_extras is not None:
|
||||||
core_files = precomputed_extras
|
core_files = precomputed_extras
|
||||||
elif system_filter and source != "truth":
|
elif system_filter and source != "truth":
|
||||||
core_files = []
|
core_files = []
|
||||||
else:
|
else:
|
||||||
core_files = _collect_emulator_extras(
|
core_files = _collect_emulator_extras(
|
||||||
config,
|
config,
|
||||||
emulators_dir,
|
emulators_dir,
|
||||||
db,
|
db,
|
||||||
seen_destinations,
|
seen_destinations,
|
||||||
base_dest,
|
base_dest,
|
||||||
emu_profiles,
|
emu_profiles,
|
||||||
target_cores=target_cores,
|
target_cores=target_cores,
|
||||||
include_all=(source == "truth"),
|
include_all=(source == "truth"),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Truth mode + system_filter: filter core files by system ID
|
# Truth mode + system_filter: filter core files by system ID
|
||||||
if system_filter and source == "truth" and core_files:
|
if system_filter and source == "truth" and core_files:
|
||||||
from common import _norm_system_id
|
from common import _norm_system_id
|
||||||
|
|
||||||
norm_filter = {_norm_system_id(s) for s in system_filter} | set(
|
norm_filter = {_norm_system_id(s) for s in system_filter} | set(
|
||||||
system_filter
|
system_filter
|
||||||
)
|
)
|
||||||
emu_system_map: dict[str, set[str]] = {}
|
emu_system_map: dict[str, set[str]] = {}
|
||||||
for _emu_name, _p in (emu_profiles or {}).items():
|
for _emu_name, _p in (emu_profiles or {}).items():
|
||||||
raw = set(_p.get("systems", []))
|
raw = set(_p.get("systems", []))
|
||||||
norm = {_norm_system_id(s) for s in raw}
|
norm = {_norm_system_id(s) for s in raw}
|
||||||
combined = raw | norm
|
combined = raw | norm
|
||||||
emu_system_map[_emu_name] = combined
|
emu_system_map[_emu_name] = combined
|
||||||
_display = _p.get("emulator", "")
|
_display = _p.get("emulator", "")
|
||||||
if _display and _display != _emu_name:
|
if _display and _display != _emu_name:
|
||||||
emu_system_map[_display] = combined
|
emu_system_map[_display] = combined
|
||||||
core_files = [
|
core_files = [
|
||||||
fe
|
fe
|
||||||
for fe in core_files
|
for fe in core_files
|
||||||
if emu_system_map.get(fe.get("source_emulator", ""), set())
|
if emu_system_map.get(fe.get("source_emulator", ""), set())
|
||||||
& norm_filter
|
& norm_filter
|
||||||
]
|
]
|
||||||
core_count = 0
|
core_count = 0
|
||||||
for fe in core_files:
|
for fe in core_files:
|
||||||
if required_only and fe.get("required") is False:
|
if required_only and fe.get("required") is False:
|
||||||
continue
|
continue
|
||||||
dest = _sanitize_path(fe.get("destination", fe["name"]))
|
dest = _sanitize_path(fe.get("destination", fe["name"]))
|
||||||
if not dest:
|
if not dest:
|
||||||
continue
|
continue
|
||||||
# Core extras: _collect_emulator_extras already adjusted
|
# Core extras: _collect_emulator_extras already adjusted
|
||||||
# destinations for slug-based platforms. Apply the effective
|
# destinations for slug-based platforms. Apply the effective
|
||||||
# prefix (base_dest, or inferred from YAML when base_dest is
|
# prefix (base_dest, or inferred from YAML when base_dest is
|
||||||
# empty — e.g. RetroDECK infers "bios").
|
# empty — e.g. RetroDECK infers "bios").
|
||||||
extras_pfx = _detect_extras_prefix(config, base_dest)
|
extras_pfx = _detect_extras_prefix(config, base_dest)
|
||||||
if extras_pfx:
|
if extras_pfx:
|
||||||
if not dest.startswith(f"{extras_pfx}/"):
|
if not dest.startswith(f"{extras_pfx}/"):
|
||||||
full_dest = f"{extras_pfx}/{dest}"
|
full_dest = f"{extras_pfx}/{dest}"
|
||||||
else:
|
else:
|
||||||
full_dest = dest
|
full_dest = dest
|
||||||
else:
|
else:
|
||||||
full_dest = dest
|
full_dest = dest
|
||||||
if full_dest in seen_destinations:
|
if full_dest in seen_destinations:
|
||||||
continue
|
continue
|
||||||
# Skip case-insensitive duplicates (Windows/macOS FS safety)
|
# Skip case-insensitive duplicates (Windows/macOS FS safety)
|
||||||
if full_dest.lower() in seen_lower and case_insensitive:
|
if full_dest.lower() in seen_lower and case_insensitive:
|
||||||
continue
|
continue
|
||||||
# Skip file/directory path conflicts (e.g., SGB1.sfc file vs SGB1.sfc/ dir)
|
# Skip file/directory path conflicts (e.g., SGB1.sfc file vs SGB1.sfc/ dir)
|
||||||
if _has_path_conflict(full_dest, seen_destinations, seen_parents):
|
if _has_path_conflict(full_dest, seen_destinations, seen_parents):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
dest_hint = fe.get("destination", "")
|
dest_hint = fe.get("destination", "")
|
||||||
local_path, status = resolve_file(
|
local_path, status = resolve_file(
|
||||||
fe,
|
fe,
|
||||||
db,
|
db,
|
||||||
bios_dir,
|
bios_dir,
|
||||||
zip_contents,
|
zip_contents,
|
||||||
dest_hint=dest_hint,
|
dest_hint=dest_hint,
|
||||||
data_dir_registry=data_registry,
|
data_dir_registry=data_registry,
|
||||||
)
|
)
|
||||||
if status in ("not_found", "external", "user_provided"):
|
if status in ("not_found", "external", "user_provided"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if local_path.endswith(".zip"):
|
if local_path.endswith(".zip"):
|
||||||
_normalize_zip_for_pack(local_path, full_dest, zf)
|
_normalize_zip_for_pack(local_path, full_dest, zf)
|
||||||
else:
|
else:
|
||||||
zf.write(local_path, full_dest)
|
zf.write(local_path, full_dest)
|
||||||
seen_destinations.add(full_dest)
|
seen_destinations.add(full_dest)
|
||||||
_register_path(full_dest, seen_destinations, seen_parents)
|
_register_path(full_dest, seen_destinations, seen_parents)
|
||||||
if case_insensitive:
|
if case_insensitive:
|
||||||
seen_lower.add(full_dest.lower())
|
seen_lower.add(full_dest.lower())
|
||||||
core_count += 1
|
core_count += 1
|
||||||
total_files += 1
|
total_files += 1
|
||||||
|
|
||||||
# Data directories from _data_dirs.yml
|
# Data directories from _data_dirs.yml
|
||||||
for sys_id, system in sorted(pack_systems.items()):
|
for sys_id, system in sorted(pack_systems.items()):
|
||||||
for dd in system.get("data_directories", []):
|
for dd in system.get("data_directories", []):
|
||||||
ref_key = dd.get("ref", "")
|
ref_key = dd.get("ref", "")
|
||||||
if not ref_key or not data_registry or ref_key not in data_registry:
|
if not ref_key or not data_registry or ref_key not in data_registry:
|
||||||
continue
|
continue
|
||||||
entry = data_registry[ref_key]
|
entry = data_registry[ref_key]
|
||||||
allowed = entry.get("for_platforms")
|
allowed = entry.get("for_platforms")
|
||||||
if allowed and platform_name not in allowed:
|
if allowed and platform_name not in allowed:
|
||||||
continue
|
continue
|
||||||
local_path = entry.get("local_cache", "")
|
local_path = entry.get("local_cache", "")
|
||||||
if not local_path or not os.path.isdir(local_path):
|
if not local_path or not os.path.isdir(local_path):
|
||||||
print(
|
print(
|
||||||
f" WARNING: data directory '{ref_key}' not cached at {local_path} -run refresh_data_dirs.py"
|
f" WARNING: data directory '{ref_key}' not cached at {local_path} -run refresh_data_dirs.py"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
dd_dest = dd.get("destination", "")
|
dd_dest = dd.get("destination", "")
|
||||||
if base_dest and dd_dest:
|
if base_dest and dd_dest:
|
||||||
dd_prefix = f"{base_dest}/{dd_dest}"
|
dd_prefix = f"{base_dest}/{dd_dest}"
|
||||||
elif base_dest:
|
elif base_dest:
|
||||||
dd_prefix = base_dest
|
dd_prefix = base_dest
|
||||||
else:
|
else:
|
||||||
dd_prefix = dd_dest
|
dd_prefix = dd_dest
|
||||||
for root, _dirs, filenames in os.walk(local_path):
|
for root, _dirs, filenames in os.walk(local_path):
|
||||||
for fname in filenames:
|
for fname in filenames:
|
||||||
src = os.path.join(root, fname)
|
src = os.path.join(root, fname)
|
||||||
rel = os.path.relpath(src, local_path)
|
rel = os.path.relpath(src, local_path)
|
||||||
full = f"{dd_prefix}/{rel}"
|
full = f"{dd_prefix}/{rel}"
|
||||||
if full in seen_destinations or (
|
if full in seen_destinations or (
|
||||||
full.lower() in seen_lower and case_insensitive
|
full.lower() in seen_lower and case_insensitive
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
if _has_path_conflict(full, seen_destinations, seen_parents):
|
if _has_path_conflict(full, seen_destinations, seen_parents):
|
||||||
continue
|
continue
|
||||||
seen_destinations.add(full)
|
seen_destinations.add(full)
|
||||||
_register_path(full, seen_destinations, seen_parents)
|
_register_path(full, seen_destinations, seen_parents)
|
||||||
if case_insensitive:
|
if case_insensitive:
|
||||||
seen_lower.add(full.lower())
|
seen_lower.add(full.lower())
|
||||||
zf.write(src, full)
|
zf.write(src, full)
|
||||||
total_files += 1
|
total_files += 1
|
||||||
|
|
||||||
# README.txt for users -personalized step-by-step per platform
|
# README.txt for users -personalized step-by-step per platform
|
||||||
num_systems = len(pack_systems)
|
num_systems = len(pack_systems)
|
||||||
readme_text = _build_readme(
|
readme_text = _build_readme(
|
||||||
platform_name, platform_display, base_dest, total_files, num_systems,
|
platform_name, platform_display, base_dest, total_files, num_systems,
|
||||||
source=source,
|
source=source,
|
||||||
)
|
)
|
||||||
zf.writestr("README.txt", readme_text)
|
zf.writestr("README.txt", readme_text)
|
||||||
|
|
||||||
files_ok = sum(1 for s in file_status.values() if s == "ok")
|
files_ok = sum(1 for s in file_status.values() if s == "ok")
|
||||||
files_untested = sum(1 for s in file_status.values() if s == "untested")
|
files_untested = sum(1 for s in file_status.values() if s == "untested")
|
||||||
|
|||||||
Reference in New Issue
Block a user