mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-19 16:17:49 -06:00
fix: place openmsx system ROMs through filepool
openMSX reads share/systemroms below OPENMSX_HOME or ~/.openMSX and every filepool entry by SHA1. The profile paths drop RetroBat's openmsx/ prefix and declare those directories and the filepool. Batocera's config_directories reads the filepool lines its generator writes, KNULLI reuses it. RetroBat records OPENMSX_HOME, RetroPie the moveConfigDir of ~/.openMSX that its systemroms link lies in, and the configure --prefix of xroar that its roms link lies in. Batocera and KNULLI system ROMs move from openmsx/share/systemroms to openmsx/, beside the files their own lists declare, RetroPie's to BIOS/openmsx, the folder linked as share/systemroms.
This commit is contained in:
1 parent
cd38b9ed10
commit
e6dbbe69ed
13 files changed
+394
-60
No files matched your search
@@ -29,6 +29,7 @@ from scraper.batocera_launchers import ( # noqa: E402
|
||||
Configgen,
|
||||
Launcher,
|
||||
LauncherShapeError,
|
||||
config_directories,
|
||||
duckstation,
|
||||
extract_launchers,
|
||||
hatari,
|
||||
@@ -521,6 +522,49 @@ class LexaloffleBinaries(unittest.TestCase):
|
||||
lexaloffle(lexaloffle_tree(text))
|
||||
|
||||
|
||||
OPENMSX = f"{GENERATORS}/openmsx/openmsxGenerator.py"
|
||||
OPENMSX_FILEPOOL = ''' def generate(self, system, rom):
|
||||
with settings_tcl.open("a") as file:
|
||||
file.write("filepool add -path /userdata/bios/Machines -types system_rom -position 1\\n")
|
||||
file.write("filepool add -path /userdata/bios/openmsx -types system_rom -position 2\\n")'''
|
||||
|
||||
|
||||
class ConfigDirectories(unittest.TestCase):
|
||||
"""A BIOS directory written into the emulator's config, at batocera-43.1."""
|
||||
|
||||
def test_each_filepool_line_hands_its_directory(self):
|
||||
cg = configgen({OPENMSX: placed({1: "class OpenmsxGenerator:", 86: OPENMSX_FILEPOOL})})
|
||||
records = [r.entry() for r in config_directories(cg, ("openmsx.openmsxGenerator",))]
|
||||
self.assertEqual(
|
||||
[(r["emulator"], r["kind"], r["search_dir"], r["source_ref"]) for r in records],
|
||||
[
|
||||
("openmsx", "passes_path", "/userdata/bios/Machines", f"{OPENMSX}:88"),
|
||||
("openmsx", "passes_path", "/userdata/bios/openmsx", f"{OPENMSX}:89"),
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
records[1]["passes_to"],
|
||||
"written: filepool add -path /userdata/bios/openmsx -types system_rom -position 2",
|
||||
)
|
||||
|
||||
def test_a_saved_setting_hands_its_directory(self):
|
||||
amiberry = f"{GENERATORS}/amiberry/amiberryGenerator.py"
|
||||
text = placed({
|
||||
1: "from pathlib import Path\n_BIOS_DIR = Path('/userdata/bios/amiga')",
|
||||
10: "def generate():\n amiberryconf.save('rom_path', _BIOS_DIR)",
|
||||
})
|
||||
(record,) = config_directories(configgen({amiberry: text}), ("amiberry.amiberryGenerator",))
|
||||
self.assertEqual(
|
||||
(record.search_dir, record.passes_to, record.source_ref),
|
||||
("/userdata/bios/amiga", "rom_path", f"{amiberry}:11"),
|
||||
)
|
||||
|
||||
def test_a_generator_handing_no_bios_directory_raises(self):
|
||||
cg = configgen({OPENMSX: "def generate():\n file.write('savestate x')\n"})
|
||||
with self.assertRaises(LauncherShapeError):
|
||||
config_directories(cg, ("openmsx.openmsxGenerator",))
|
||||
|
||||
|
||||
class ExtractionNeverEmpty(unittest.TestCase):
|
||||
def test_a_generator_of_unknown_shape_stops_the_whole_scrape(self):
|
||||
find = DUCKSTATION_FIND.replace("def find_bios(", "def locate_bios(")
|
||||
|
||||
@@ -145,6 +145,9 @@ OPENMSX = """
|
||||
{ "Philips_VG_8020", new string[] { "vg8020_basic-bios1.rom" } },
|
||||
{ "Pioneer_PX-7", new string[] { "px-7_basic-bios1.rom", "px-7_pbasic.rom" } }
|
||||
};
|
||||
|
||||
string sharePath = Path.Combine(AppConfig.GetFullPath("bios"), "openmsx");
|
||||
ret.EnvironmentVariables["OPENMSX_HOME"] = sharePath;
|
||||
"""
|
||||
|
||||
DUCKSTATION = """
|
||||
@@ -390,12 +393,21 @@ class NamesInLauncherOrder(unittest.TestCase):
|
||||
[
|
||||
("-machine Philips_VG_8020", ["vg8020_basic-bios1.rom"]),
|
||||
("-machine Pioneer_PX-7", ["px-7_basic-bios1.rom", "px-7_pbasic.rom"]),
|
||||
("environment OPENMSX_HOME", []),
|
||||
],
|
||||
)
|
||||
self.assertEqual(records[0]["search_dir"], "bios/openmsx/share/systemroms")
|
||||
self.assertFalse(records[0]["case_insensitive"])
|
||||
self.assertEqual(records[1]["source_ref"], f"{G}/OpenMSX.Generator.cs:1-4, 10")
|
||||
|
||||
def test_openmsx_home_is_handed_as_a_directory(self):
|
||||
# OPENMSX_HOME is the user directory openMSX reads share/systemroms below.
|
||||
records = rl.openmsx(_sources(**{f"{G}/OpenMSX.Generator.cs": OPENMSX}))
|
||||
home = records[-1]
|
||||
self.assertEqual(home["kind"], "passes_path")
|
||||
self.assertEqual(home["search_dir"], "bios/openmsx")
|
||||
self.assertEqual(home["source_ref"], f"{G}/OpenMSX.Generator.cs:13-14")
|
||||
|
||||
def test_duckstation_reads_the_standalone_feature_not_the_core(self):
|
||||
search, option = rl.duckstation(
|
||||
_sources(**{f"{G}/Duckstation.Generator.cs": DUCKSTATION, rl.FEATURES: FEATURES})
|
||||
|
||||
@@ -315,6 +315,59 @@ UAE4ALL = module("uae4all", """
|
||||
""", 60)
|
||||
|
||||
|
||||
OPENMSX = module("openmsx", """
|
||||
function configure_openmsx() {
|
||||
mkUserDir "$home/.openMSX/share/systemroms"
|
||||
moveConfigDir "$home/.openMSX" "$configdir/msx/openmsx"
|
||||
moveConfigDir "$configdir/msx/openmsx/share/systemroms" "$home/RetroPie/BIOS/openmsx"
|
||||
moveConfigDir "$home/.unrelated" "$configdir/msx/other"
|
||||
}
|
||||
""", 74)
|
||||
|
||||
|
||||
XROAR = module("xroar", """
|
||||
function build_xroar() {
|
||||
./configure --prefix="$md_inst" "${params[@]}"
|
||||
}
|
||||
|
||||
function configure_xroar() {
|
||||
mkdir -p "$md_inst/share/xroar"
|
||||
ln -snf "$biosdir" "$md_inst/share/xroar/roms"
|
||||
}
|
||||
""", 36)
|
||||
|
||||
|
||||
class ReachingLinks(unittest.TestCase):
|
||||
"""The directory outside BIOS that a whole-directory link is read from."""
|
||||
|
||||
def test_openmsx_user_directory_holds_the_systemroms_link(self):
|
||||
found = records({f"{EMULATORS}/openmsx.sh": OPENMSX}, "openmsx")
|
||||
links = [r for r in found if r["kind"] == "links"]
|
||||
self.assertEqual(
|
||||
[(r["search_dir"], r["passes_to"], r["source_ref"]) for r in links],
|
||||
[
|
||||
(
|
||||
"$home/RetroPie/BIOS/openmsx",
|
||||
"$configdir/msx/openmsx/share/systemroms is a symlink to it",
|
||||
f"{EMULATORS}/openmsx.sh:77",
|
||||
),
|
||||
(
|
||||
"$configdir/msx/openmsx",
|
||||
"$home/.openMSX is a symlink to it",
|
||||
f"{EMULATORS}/openmsx.sh:76",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
def test_xroar_install_prefix_holds_the_roms_link(self):
|
||||
found = records({f"{EMULATORS}/xroar.sh": XROAR}, "xroar")
|
||||
prefix = [r for r in found if r["kind"] == "passes_path"]
|
||||
self.assertEqual(
|
||||
[(r["search_dir"], r["passes_to"], r["source_ref"]) for r in prefix],
|
||||
[("$md_inst", "${prefix} of configure --prefix", f"{EMULATORS}/xroar.sh:37")],
|
||||
)
|
||||
|
||||
|
||||
class WorkingDirectory(unittest.TestCase):
|
||||
def test_drastic_reads_below_the_folder_its_script_enters(self):
|
||||
found = records({f"{EMULATORS}/drastic.sh": DRASTIC}, "drastic")
|
||||
|
||||
@@ -497,3 +497,43 @@ class Scrapers(unittest.TestCase):
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
|
||||
class OpenmsxOnEachPlatform(unittest.TestCase):
|
||||
"""openMSX finds system ROMs by SHA1 in share/systemroms below its user
|
||||
directory and in every filepool entry. RetroBat sets OPENMSX_HOME to
|
||||
bios/openmsx, RetroPie links share/systemroms of its user directory to
|
||||
BIOS/openmsx, Batocera and KNULLI add bios/Machines and bios/openmsx to
|
||||
the filepool and list their own files in bios/openmsx."""
|
||||
|
||||
EXPECTED = {
|
||||
"batocera": {"share/systemroms": ("", "openmsx")},
|
||||
"knulli": {"share/systemroms": ("", "openmsx")},
|
||||
"retrobat": {"": ("", "openmsx")},
|
||||
"retropie": {"share/systemroms": ("", "openmsx")},
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.profile = load_emulator_profiles(str(REPO_ROOT / "emulators"))["openmsx"]
|
||||
|
||||
def test_each_platform_hands_openmsx_its_folder(self) -> None:
|
||||
for platform, expected in self.EXPECTED.items():
|
||||
with self.subTest(platform=platform):
|
||||
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
|
||||
self.assertEqual(
|
||||
standalone_bindings_for("openmsx", self.profile, standalone_set(cfg)),
|
||||
expected,
|
||||
)
|
||||
|
||||
def test_every_system_rom_lands_in_bios_openmsx(self) -> None:
|
||||
for platform in self.EXPECTED:
|
||||
with self.subTest(platform=platform):
|
||||
cfg = load_platform_config(platform, str(REPO_ROOT / "platforms"))
|
||||
(view, _standalone), = platform_layouts(
|
||||
"openmsx", self.profile, standalone_set(cfg)
|
||||
)
|
||||
for entry in view["files"]:
|
||||
self.assertNotIn("unplaced", entry)
|
||||
self.assertTrue(
|
||||
entry["standalone_path"].startswith("openmsx/"), entry["standalone_path"]
|
||||
)
|
||||
Reference in new issue
Block a user