mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 03:18:52 -06:00
refactor: name the profile kinds in model.profiles
lists_files(profile) answers whether a profile declares files, false for a launcher or an alias, and is_emulator(profile) whether it counts as an emulator, false for an alias or a test core. Eighteen inline checks in model, resolve and packs read them; each keeps the set it tested. model.systems keeps its own check: it sits below model.profiles. No behavior change.
This commit is contained in:
1 parent
b679edb133
commit
899f591575
13 files changed
+46
-25
No files matched your search
@@ -22,6 +22,7 @@ from dataclasses import dataclass
|
||||
|
||||
from core.hashing import parse_hash_list
|
||||
from model.declarations import CONFIGS_ROOT, ROMS_ROOT, declared_root, outer_layout
|
||||
from model.profiles import lists_files
|
||||
from resolve.content import name_match_size_ok
|
||||
from resolve.localfile import resolve_local_file
|
||||
from core.paths import sanitize_pack_path
|
||||
@@ -432,7 +433,7 @@ def _named_profiles(record: dict, profiles: Mapping[str, dict], platform: str) -
|
||||
for part in (e.strip() for e in str(record.get("emulator", "")).split(",")):
|
||||
named = [
|
||||
key for key, profile in profiles.items()
|
||||
if profile.get("type") not in ("alias", "launcher")
|
||||
if lists_files(profile)
|
||||
and (key == part or part in {str(c) for c in profile.get("cores") or []})
|
||||
]
|
||||
own = [k for k in named if platform in (profiles[k].get("built_by") or [])]
|
||||
@@ -1369,7 +1370,7 @@ class LauncherLayer:
|
||||
return sorted(
|
||||
key for key in relevant
|
||||
if (profile := profiles.get(key)) is not None
|
||||
and profile.get("type") not in ("alias", "launcher")
|
||||
and lists_files(profile)
|
||||
and (key == name or name in {str(c) for c in profile.get("cores") or []})
|
||||
)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import re
|
||||
|
||||
from model import region
|
||||
from model.region import NOINTRO
|
||||
from model.profiles import lists_files
|
||||
from resolve.localfile import resolve_local_file
|
||||
|
||||
|
||||
@@ -70,7 +71,7 @@ def build_report(profiles: dict, db: dict) -> dict:
|
||||
|
||||
by_path = {entry.get("path", ""): sha1 for sha1, entry in db["files"].items()}
|
||||
for emu_name, profile in sorted(profiles.items()):
|
||||
if profile.get("type") in ("launcher", "alias"):
|
||||
if not lists_files(profile):
|
||||
continue
|
||||
for f in profile.get("files") or []:
|
||||
if not isinstance(f, dict) or not f.get("region"):
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from model.profiles import lists_files
|
||||
from model.region import WORLD, normalize_declared, rank
|
||||
from resolve.slot import lookup_slot
|
||||
|
||||
@@ -31,7 +32,7 @@ def build_region_index(profiles: dict) -> dict[str, dict]:
|
||||
"""
|
||||
index: dict[str, dict] = {}
|
||||
for emu_name, profile in sorted(profiles.items()):
|
||||
if profile.get("type") in ("launcher", "alias"):
|
||||
if not lists_files(profile):
|
||||
continue
|
||||
for f in profile.get("files") or []:
|
||||
if not isinstance(f, dict):
|
||||
|
||||
@@ -30,6 +30,7 @@ rank: the second core reads it by its own rule, which no rank expresses.
|
||||
from __future__ import annotations
|
||||
|
||||
from model.alternatives import set_keys
|
||||
from model.profiles import lists_files
|
||||
|
||||
BIOS_CATEGORY = "bios"
|
||||
|
||||
@@ -69,7 +70,7 @@ def slot_claims(profiles: dict) -> dict[str, dict[str, dict]]:
|
||||
"""
|
||||
claims: dict[str, dict[str, dict]] = {}
|
||||
for emu_name, profile in sorted(profiles.items()):
|
||||
if profile.get("type") in ("launcher", "alias"):
|
||||
if not lists_files(profile):
|
||||
continue
|
||||
for f in profile.get("files") or []:
|
||||
if not isinstance(f, dict):
|
||||
|
||||
@@ -21,7 +21,7 @@ from resolve.content import (
|
||||
shape_fits,
|
||||
)
|
||||
from resolve.archives import archive_members
|
||||
from model.profiles import CONTENT_CHECKS, entry_system_ids
|
||||
from model.profiles import CONTENT_CHECKS, entry_system_ids, lists_files
|
||||
from core.hashing import compute_hashes, parse_hash_list
|
||||
from core.paths import BIOS_DIR, sanitize_pack_path
|
||||
from core.hashing import md5_composite, parse_md5_list
|
||||
@@ -385,7 +385,7 @@ def build_validation_index(profiles: dict) -> dict[str, dict]:
|
||||
unchecked: set[tuple[str, str, str]] = set()
|
||||
checked: set[tuple[str, str, str]] = set()
|
||||
for emu_name, profile in profiles.items():
|
||||
if profile.get("type") in ("launcher", "alias"):
|
||||
if not lists_files(profile):
|
||||
continue
|
||||
for f in _labels_widened(profile):
|
||||
fname = f.get("name", "")
|
||||
|
||||
Reference in new issue
Block a user