mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 19:38:52 -06:00
refactor: test an entry's build in read_by_build
This commit is contained in:
1 parent
fd3d93a93f
commit
c8270b5361
4 files changed
+14
-26
No files matched your search
@@ -28,7 +28,7 @@ from resolve.standalone import standalone_set as platform_standalone_set
|
||||
from model.declarations import OUTER_ROOTS, outer_layout
|
||||
from core.paths import declared_destination, sanitize_pack_path
|
||||
from resolve.content import declares_shape, shape_fits, size_fits
|
||||
from resolve.validation import deliverable, read_from_save_dir, read_from_system_dir
|
||||
from resolve.validation import deliverable, read_by_build, read_from_save_dir, read_from_system_dir
|
||||
from packs.paths import libretro_systems, save_destination, save_layout
|
||||
from resolve.regions import FILE_GROUP
|
||||
|
||||
@@ -675,10 +675,7 @@ def _seeds_a_scan(f: dict, layout: dict, standalone: bool) -> bool:
|
||||
# A file of the build the platform does not run seeds nothing:
|
||||
# armsx2's proverb.zip is fetched by the Android app into its own
|
||||
# arcade/ folder, and the libretro packs carried it at system/.
|
||||
mode = f.get("mode")
|
||||
if (mode == "standalone" and not standalone) or (
|
||||
mode == "libretro" and standalone
|
||||
):
|
||||
if not read_by_build(f, standalone):
|
||||
return False
|
||||
# The scan walks the BIOS tree: a file read below the save
|
||||
# directory is placed by the gap report's pass.
|
||||
@@ -1707,10 +1704,7 @@ def _copies_entry(f: dict, is_standalone: bool, scope: _CopyScope) -> bool:
|
||||
# (Dolphin's codehandler.bin ships in its Sys tree).
|
||||
if "path" in f and f["path"] is None:
|
||||
return False
|
||||
file_mode = f.get("mode")
|
||||
if file_mode == "standalone" and not is_standalone:
|
||||
return False
|
||||
if file_mode == "libretro" and is_standalone:
|
||||
if not read_by_build(f, is_standalone):
|
||||
return False
|
||||
return read_from_system_dir(f, is_standalone)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from probes.content import Content, load_content, load_file
|
||||
from probes.cores import cached_nightly
|
||||
from probes.entries import entry_dest, held_file, regions_of
|
||||
from probes.host import CONTENT_FILE
|
||||
from resolve.validation import read_by_build
|
||||
|
||||
|
||||
CORES = REPO_ROOT / ".cache" / "region" / "cores"
|
||||
@@ -41,7 +42,7 @@ def region_entries(profile: dict, system: str) -> list[dict]:
|
||||
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"
|
||||
and entry.get("category", "bios") == "bios" and read_by_build(entry, False)
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
from resolve.validation import read_by_build
|
||||
|
||||
|
||||
_directory_members_cache: dict[int, tuple[dict, dict[str, dict[str, str]]]] = {}
|
||||
@@ -78,10 +78,9 @@ def expand_directory_entries(
|
||||
# A file the profile names itself is left to that entry, in the same
|
||||
# build and below the same root: MAME's libretro floppy samples share
|
||||
# their path with the standalone tree RetroPie reads below roms/.
|
||||
other_build = "libretro" if standalone else "standalone"
|
||||
named = {
|
||||
(entry.get("root") or "", destination(entry)) for entry in files
|
||||
if entry.get("type") != "directory" and entry.get("mode") != other_build
|
||||
if entry.get("type") != "directory" and read_by_build(entry, standalone)
|
||||
}
|
||||
expanded: list[dict] = []
|
||||
for entry in files:
|
||||
|
||||
@@ -656,10 +656,7 @@ def outside_gap_scope(file_entry: dict, is_standalone: bool) -> bool:
|
||||
return True
|
||||
if "path" in file_entry and file_entry["path"] is None:
|
||||
return True
|
||||
mode = file_entry.get("mode")
|
||||
if (mode == "standalone" and not is_standalone) or (
|
||||
mode == "libretro" and is_standalone
|
||||
):
|
||||
if not read_by_build(file_entry, is_standalone):
|
||||
return True
|
||||
return not (
|
||||
read_from_system_dir(file_entry, is_standalone)
|
||||
@@ -779,17 +776,14 @@ def opens_by_name(file_entry: dict, profile: dict, standalone: bool = False) ->
|
||||
return True
|
||||
|
||||
|
||||
def read_by_build(entry: dict, standalone: bool) -> bool:
|
||||
"""Whether the build that runs (standalone or libretro) reads the entry."""
|
||||
return entry.get("mode") != ("libretro" if standalone else "standalone")
|
||||
|
||||
|
||||
def filter_files_by_mode(files: list[dict], standalone: bool) -> list[dict]:
|
||||
"""Filter file entries by libretro/standalone mode."""
|
||||
result = []
|
||||
for f in files:
|
||||
fmode = f.get("mode", "")
|
||||
if standalone and fmode == "libretro":
|
||||
continue
|
||||
if not standalone and fmode == "standalone":
|
||||
continue
|
||||
result.append(f)
|
||||
return result
|
||||
return [f for f in files if read_by_build(f, standalone)]
|
||||
|
||||
|
||||
def installed_with_emulator(entry: dict, platform: str = "") -> bool:
|
||||
|
||||
Reference in new issue
Block a user