mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-16 08:23:28 -05:00
fix: seed agnostic scans from the running build
This commit is contained in:
1 parent
98c21f19f7
commit
81b8dac434
2 files changed
+60
-1
No files matched your search
+10
-1
@@ -278,12 +278,21 @@ def _agnostic_scan_extras(
|
||||
agnostic_votes.get(directory + "/", 0) + 1
|
||||
)
|
||||
|
||||
standalone = runs_standalone(emu_name, profile, standalone_set or set())
|
||||
for f in profile.get("files", []):
|
||||
if not is_profile_agnostic and not f.get("agnostic"):
|
||||
continue
|
||||
fname = f.get("name", "")
|
||||
if not fname:
|
||||
continue
|
||||
# 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
|
||||
):
|
||||
continue
|
||||
# An agnostic BIOS mode says the BIOS filename is free, not that
|
||||
# every file the emulator loads is. A free filename still has a
|
||||
# known shape, and that shape is what identifies a candidate: an
|
||||
@@ -325,7 +334,7 @@ def _agnostic_scan_extras(
|
||||
# Into the directory the seed entry names, not the root:
|
||||
# yaps2 reads its BIOS from pcsx2/bios/.
|
||||
seed = f.get("path") or ""
|
||||
if runs_standalone(emu_name, profile, standalone_set or set()):
|
||||
if standalone:
|
||||
seed = f.get("standalone_path") or seed
|
||||
folder = seed.rsplit("/", 1)[0] if "/" in seed else ""
|
||||
dest = f"{folder}/{scan_name}" if folder else scan_name
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
"""A filename-agnostic scan seeds only from the build the platform runs.
|
||||
|
||||
armsx2 declares bios_mode: agnostic, and its proverb.zip is a standalone
|
||||
file the Android app fetches into its arcade/ folder. The scan never read
|
||||
`mode:` and put it at system/proverb.zip in every pack running armsx2 as a
|
||||
libretro core, while verify set the entry aside. Reads the repository.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
|
||||
|
||||
class ScanFollowsTheBuild(unittest.TestCase):
|
||||
def test_no_standalone_seed_in_a_libretro_pack(self):
|
||||
if not (REPO_ROOT / "database.json").exists():
|
||||
self.skipTest("database.json is not built")
|
||||
previous = os.getcwd()
|
||||
os.chdir(REPO_ROOT)
|
||||
self.addCleanup(os.chdir, previous)
|
||||
from common import load_database, load_emulator_profiles, load_platform_config
|
||||
from packextras import _collect_emulator_extras
|
||||
|
||||
profiles = load_emulator_profiles("emulators")
|
||||
entry = next(
|
||||
(f for f in profiles.get("armsx2", {}).get("files", [])
|
||||
if f.get("name") == "proverb.zip"),
|
||||
None,
|
||||
)
|
||||
if entry is None or entry.get("mode") != "standalone":
|
||||
self.skipTest("armsx2 no longer declares a standalone proverb.zip")
|
||||
config = load_platform_config("retroarch")
|
||||
extras = _collect_emulator_extras(
|
||||
config, "emulators", load_database("database.json"), set(),
|
||||
config.get("base_destination", ""), profiles,
|
||||
)
|
||||
self.assertNotIn(
|
||||
("proverb.zip", "ARMSX2"),
|
||||
{(e["name"], e.get("source_emulator")) for e in extras},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user