mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-11 12:33:53 -06:00
fix: place libretro dolphin files where it reads
This commit is contained in:
1 parent
48b00730ff
commit
b173a2a851
9 files changed
+215
-81
No files matched your search
@@ -0,0 +1,79 @@
|
||||
"""A profile's path: is where the libretro core reads the file.
|
||||
|
||||
pack_structure prefixed files as well as data directories: PPSSPP's
|
||||
`PPSSPP/ppge_atlas.zim` became PPSSPP/PPSSPP/, while the platform packs,
|
||||
which never read the field, put libretro Dolphin's IPL, DSP ROMs, fonts,
|
||||
segaboot and Wii user files at the root of system/. libretro Dolphin reads
|
||||
Sys from system/dolphin-emu/Sys and keeps User in the save directory.
|
||||
"""
|
||||
|
||||
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"))
|
||||
|
||||
from packpaths import _resolve_destination # noqa: E402
|
||||
from validation import outside_gap_scope, read_from_system_dir # noqa: E402
|
||||
|
||||
|
||||
class PathIsTheDestination(unittest.TestCase):
|
||||
def test_no_prefix_on_a_file(self):
|
||||
entry = {"name": "ppge_atlas.zim", "path": "PPSSPP/ppge_atlas.zim"}
|
||||
self.assertEqual(_resolve_destination(entry, False), "PPSSPP/ppge_atlas.zim")
|
||||
dual = {"name": "IPL.bin", "path": "dolphin-emu/Sys/GC/USA/IPL.bin",
|
||||
"standalone_path": "GC/USA/IPL.bin"}
|
||||
self.assertEqual(_resolve_destination(dual, False), "dolphin-emu/Sys/GC/USA/IPL.bin")
|
||||
self.assertEqual(_resolve_destination(dual, True), "GC/USA/IPL.bin")
|
||||
|
||||
|
||||
class LoadFromPerBuild(unittest.TestCase):
|
||||
ENTRY = {"name": "SYSCONF", "path": "Wii/shared2/sys/SYSCONF",
|
||||
"load_from": {"libretro": "save_dir"}}
|
||||
|
||||
def test_each_build_reads_its_own_place(self):
|
||||
self.assertFalse(read_from_system_dir(self.ENTRY, False))
|
||||
self.assertTrue(read_from_system_dir(self.ENTRY, True))
|
||||
self.assertTrue(outside_gap_scope(self.ENTRY, False))
|
||||
self.assertFalse(outside_gap_scope(self.ENTRY, True))
|
||||
|
||||
def test_a_plain_value_holds_for_both(self):
|
||||
entry = {"name": "x", "load_from": "save_dir"}
|
||||
self.assertFalse(read_from_system_dir(entry, False))
|
||||
self.assertFalse(read_from_system_dir(entry, True))
|
||||
|
||||
|
||||
class RetroArchCarriesDolphinWhereItReads(unittest.TestCase):
|
||||
"""Reads the repository: skips when the database is absent."""
|
||||
|
||||
def test_no_dolphin_file_at_the_root(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
|
||||
|
||||
config = load_platform_config("retroarch")
|
||||
extras = _collect_emulator_extras(
|
||||
config, "emulators", load_database("database.json"), set(),
|
||||
config.get("base_destination", ""), load_emulator_profiles("emulators"),
|
||||
)
|
||||
dolphin = [
|
||||
e["destination"] for e in extras
|
||||
if e.get("source_emulator") in ("Dolphin", "Ishiiruka")
|
||||
]
|
||||
self.assertTrue(dolphin)
|
||||
self.assertEqual(
|
||||
[d for d in dolphin if not d.startswith("dolphin-emu/Sys/")], []
|
||||
)
|
||||
self.assertIn("dolphin-emu/Sys/Triforce/segaboot.gcm", dolphin)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user