mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 04:48:54 -06:00
refactor: read entry systems with entry_system_ids
This commit is contained in:
1 parent
91b27854c8
commit
0107ac8062
4 files changed
+11
-28
No files matched your search
@@ -23,13 +23,13 @@ from core.hashing import file_digest
|
||||
from core.paths import REPO_ROOT
|
||||
from core.statefile import now_iso, save_state
|
||||
from model import measurements as mr
|
||||
from model.profiles import entry_system_ids
|
||||
from probes import rules
|
||||
from probes.profileedit import ProfileEditError, write_fields
|
||||
from probes.content import Content, ContentStore, load_content, load_file
|
||||
from probes.cores import Core, Cores
|
||||
from probes.entries import (
|
||||
entry_dest,
|
||||
entry_systems,
|
||||
held_file,
|
||||
is_bios,
|
||||
profile_digest,
|
||||
@@ -342,7 +342,7 @@ class Campaign:
|
||||
libretro = filter_files_by_mode(profile.get("files") or [], standalone=False)
|
||||
keep = {id(e) for e in libretro}
|
||||
return [(i, e) for i, e in enumerate(profile.get("files") or [])
|
||||
if id(e) in keep and system in entry_systems(e, profile) and is_bios(e)]
|
||||
if id(e) in keep and system in entry_system_ids(e, profile) and is_bios(e)]
|
||||
|
||||
def boot_entry(self, entries: list[tuple[int, dict]], content: Content) -> tuple[int, dict] | None:
|
||||
held = [(i, e) for i, e in entries if region_matches(e, content.region) and self.local_file(e)]
|
||||
|
||||
@@ -35,14 +35,6 @@ def held_file(entry: dict, db: dict, root: Path) -> Path | None:
|
||||
return local if local.is_file() else None
|
||||
|
||||
|
||||
def entry_systems(entry: dict, profile: dict) -> list[str]:
|
||||
if entry.get("systems"):
|
||||
return list(entry["systems"])
|
||||
if entry.get("system"):
|
||||
return [entry["system"]]
|
||||
return list(profile.get("systems") or [])
|
||||
|
||||
|
||||
def entry_dest(entry: dict) -> str:
|
||||
"""Where the core reads the entry, relative to its system directory."""
|
||||
path = entry.get("path")
|
||||
|
||||
@@ -13,6 +13,7 @@ from collections.abc import Callable, Iterable
|
||||
from pathlib import Path
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
from model.profiles import entry_system_ids
|
||||
from core_probe import BUILTIN
|
||||
from probes.content import Content, load_content, load_file
|
||||
from probes.cores import cached_nightly
|
||||
@@ -36,14 +37,12 @@ REGION_WORDS = {"japan": "Japanese", "north-america": "US", "europe": "European"
|
||||
|
||||
def region_entries(profile: dict, system: str) -> list[dict]:
|
||||
"""The BIOS entries of a system that a `region:` ties to territories."""
|
||||
out = []
|
||||
for entry in profile.get("files") or ():
|
||||
systems = entry.get("systems") or ([entry["system"]] if entry.get("system")
|
||||
else profile.get("systems") or [])
|
||||
if (system in systems and regions_of(entry) and "world" not in regions_of(entry)
|
||||
and entry.get("category", "bios") == "bios" and entry.get("mode") != "standalone"):
|
||||
out.append(entry)
|
||||
return out
|
||||
return [
|
||||
entry for entry in profile.get("files") or ()
|
||||
if system in entry_system_ids(entry, profile)
|
||||
and regions_of(entry) and "world" not in regions_of(entry)
|
||||
and entry.get("category", "bios") == "bios" and entry.get("mode") != "standalone"
|
||||
]
|
||||
|
||||
|
||||
def plan_variants(entries: Iterable[dict], region: str,
|
||||
|
||||
Reference in new issue
Block a user