mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-12 04:53:52 -06:00
chore: merge voxatron split and emulator folders
This commit is contained in:
commit
8633db0a22
19 files changed
+478
-171
No files matched your search
@@ -57,7 +57,8 @@ NAMED_FOR_A_LAUNCHER = {
|
||||
# Profiles whose entries still rest on a launcher, with the fact that blocks
|
||||
# reading the emulator itself.
|
||||
LAUNCHER_SOURCED = {
|
||||
"lexaloffle": "PICO-8 and Voxatron are sold binaries, and no copy of either is held to read",
|
||||
"lexaloffle": "PICO-8 is a sold binary, and no copy is held to read",
|
||||
"voxatron": "Voxatron is a sold binary, and no copy is held to read",
|
||||
}
|
||||
|
||||
_SENTENCE = re.compile(r"(?<=[.!?])\s+(?=[A-Z0-9(\"'])")
|
||||
|
||||
@@ -262,6 +262,7 @@ class AProgramRunFromItsFolder(unittest.TestCase):
|
||||
"biosplat": [{**run, "names": ["prog/prog"], "search_dir": "/userdata/bios"}],
|
||||
"romsplat": [{**run, "names": ["prog"], "search_dir": "/storage/roms/prog"}],
|
||||
"exeplat": [{**run, "names": ["prog"], "search_dir": "<emulator folder>"}],
|
||||
"emuplat": [{**run, "names": ["prog"], "search_dir": '<GetPath("prog")>'}],
|
||||
"plainplat": [],
|
||||
}
|
||||
for name, records in launchers.items():
|
||||
@@ -275,6 +276,10 @@ class AProgramRunFromItsFolder(unittest.TestCase):
|
||||
**{name: {"config": f"{name}.yml"} for name in launchers},
|
||||
"romsplat": {"config": "romsplat.yml",
|
||||
"roms_directory": {"path": "/storage/roms", "bios_folder": "bios"}},
|
||||
"emuplat": {"config": "emuplat.yml", "emulators_directory": {
|
||||
"launcher_spelling": '<GetPath("{key}")>', "bios_folder": "bios",
|
||||
"searched": ["frontend/{key}", "emulators/{key}"],
|
||||
"default": "emulators/{key}", "config": "frontend/launcher.cfg"}},
|
||||
}}))
|
||||
(self.emulators / "prog.yml").write_text(yaml.safe_dump({
|
||||
"emulator": "Prog", "type": "standalone", "cores": ["prog"],
|
||||
@@ -363,6 +368,71 @@ class AProgramRunFromItsFolder(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
install._check_roms_directory({"files": files})
|
||||
|
||||
def test_run_from_an_emulator_folder_the_registry_describes(self) -> None:
|
||||
self.assertEqual(self.pack("emuplat"), [])
|
||||
manifest = self.manifest("emuplat")
|
||||
self.assertEqual(
|
||||
sorted((f["dest"], f.get("root")) for f in manifest["files"]),
|
||||
[("prog/prog", "emulators"), ("prog/prog.dat", "emulators")],
|
||||
)
|
||||
self.assertEqual(manifest["emulators_directory"]["default"], "emulators/{key}")
|
||||
self.assertTrue(all(u["in_pack"] is False for u in self.verify("emuplat")))
|
||||
|
||||
def test_the_installer_follows_the_launcher_search(self) -> None:
|
||||
import install
|
||||
|
||||
manifest = self.manifest("emuplat")
|
||||
install._check_emulators_directory(manifest)
|
||||
files = list(manifest["files"])
|
||||
home = self.root / "Frontend"
|
||||
bios = home / "bios"
|
||||
bios.mkdir(parents=True)
|
||||
# Not the platform's folder: no launcher config beside it.
|
||||
kept, left = install.place_emulator_entries(files, bios, manifest, "emuplat", say=False)
|
||||
self.assertEqual((kept, {o["reason"] for o in left}), ([], {"no_emulators_directory"}))
|
||||
(home / "frontend").mkdir()
|
||||
(home / "frontend" / "launcher.cfg").write_text("other=x\n")
|
||||
kept, left = install.place_emulator_entries(files, bios, manifest, "emuplat", say=False)
|
||||
self.assertEqual((len(kept), left), (2, []))
|
||||
entry = next(f for f in kept if f["dest"] == "prog/prog")
|
||||
self.assertEqual(install._entry_place(bios, entry), (home / "emulators" / "prog", "prog"))
|
||||
# The first searched place that exists wins.
|
||||
(home / "frontend" / "prog").mkdir()
|
||||
install.place_emulator_entries(files, bios, manifest, "emuplat", say=False)
|
||||
self.assertEqual(install._entry_place(bios, entry)[0], home / "frontend" / "prog")
|
||||
# A key the launcher config sets moves the folder: left out.
|
||||
(home / "frontend" / "launcher.cfg").write_text("prog=D:\\Prog\n")
|
||||
kept, left = install.place_emulator_entries(files, bios, manifest, "emuplat", say=False)
|
||||
self.assertEqual((kept, len(left)), ([], 2))
|
||||
|
||||
|
||||
class EachProgramItsOwnProfile(unittest.TestCase):
|
||||
"""PICO-8 and Voxatron are two programs: a platform running one gets its files only."""
|
||||
|
||||
def test_only_the_platforms_that_run_voxatron_get_it(self) -> None:
|
||||
from common import list_registered_platforms, resolve_platform_cores
|
||||
|
||||
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
|
||||
runs = {
|
||||
name: {k for k in ("lexaloffle", "voxatron")
|
||||
if k in resolve_platform_cores(
|
||||
load_platform_config(name, str(REPO_ROOT / "platforms")), profiles)}
|
||||
for name in list_registered_platforms(str(REPO_ROOT / "platforms"))
|
||||
}
|
||||
self.assertEqual(
|
||||
{name for name, found in runs.items() if "voxatron" in found}, {"batocera", "knulli"}
|
||||
)
|
||||
self.assertTrue(all("lexaloffle" in runs[name] for name in (
|
||||
"batocera", "knulli", "rocknix", "retrodeck", "retrobat", "recalbox")))
|
||||
|
||||
def test_a_standalone_emulator_is_run(self) -> None:
|
||||
from common import resolve_platform_cores
|
||||
|
||||
profiles = {"emu": {"emulator": "Emu", "type": "standalone", "cores": ["emu"],
|
||||
"systems": ["sys"], "files": []}}
|
||||
config = {"cores": ["other"], "standalone_cores": ["emu"], "systems": {}}
|
||||
self.assertEqual(resolve_platform_cores(config, profiles), {"emu"})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user