mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-25 13:19:03 -05:00
fix: name the selection mode in --from-md5 packs
BizHawk is both a platform and a profile display name: --from-md5 with --platform bizhawk and with --emulator bizhawk wrote one file in two layouts. The emulator mode now carries _Emulator in the name.
This commit is contained in:
1 parent
a3e625cd6a
commit
4fec09a014
2 files changed
+32
-1
No files matched your search
@@ -2154,6 +2154,11 @@ def generate_md5_pack(
|
||||
plat_file_index.setdefault(alias.lower(), []).append(fe)
|
||||
|
||||
context_name = plat_display if platform_name else (emu_display or "Custom")
|
||||
# The selection mode is part of the name, as for --system: BizHawk is
|
||||
# both a platform and a profile display name, and the two layouts
|
||||
# (Firmware/ under the platform, the profile's paths under the core)
|
||||
# wrote one file, the second run replacing the first without a word.
|
||||
mode_part = "_Emulator" if emulator_name and not platform_name else ""
|
||||
# --standalone changes the destination layout, so a run with it must not
|
||||
# take the name of a run without it.
|
||||
custom_tags = "".join(
|
||||
@@ -2168,7 +2173,8 @@ def generate_md5_pack(
|
||||
"\n".join(sorted(f"{kind}:{value.lower()}" for kind, value in hashes)).encode()
|
||||
).hexdigest()[:8]
|
||||
zip_name = (
|
||||
f"{_name_part(context_name, '_')}_Custom_{selection}{custom_tags}_BIOS_Pack.zip"
|
||||
f"{_name_part(context_name, '_')}{mode_part}_Custom_{selection}{custom_tags}"
|
||||
"_BIOS_Pack.zip"
|
||||
)
|
||||
zip_path = os.path.join(output_dir, zip_name)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
@@ -2744,6 +2744,31 @@ class TestE2E(unittest.TestCase):
|
||||
self.assertIn("bios/scph5501.bin", names)
|
||||
self.assertIn("Custom", os.path.basename(zip_path))
|
||||
|
||||
# A profile displayed under the platform's own name: BizHawk is
|
||||
# both. The two layouts must not write one file.
|
||||
emu_dir = os.path.join(tmpdir, "emulators-md5")
|
||||
os.makedirs(emu_dir)
|
||||
with open(os.path.join(emu_dir, "testplat.yml"), "w") as f:
|
||||
yaml.dump({
|
||||
"emulator": "TestPlat", "type": "standalone",
|
||||
"systems": ["sony-playstation"],
|
||||
"files": [{"name": "scph5501.bin", "md5": h["md5"]}],
|
||||
}, f)
|
||||
emu_zip = generate_md5_pack(
|
||||
hashes=[("md5", h["md5"])],
|
||||
db=db,
|
||||
bios_dir=bios_dir,
|
||||
output_dir=out_dir,
|
||||
zip_contents=zip_contents,
|
||||
emulator_name="testplat",
|
||||
emulators_dir=emu_dir,
|
||||
)
|
||||
self.assertIsNotNone(emu_zip)
|
||||
self.assertNotEqual(os.path.basename(emu_zip), os.path.basename(zip_path))
|
||||
self.assertTrue(os.path.exists(zip_path))
|
||||
with zipfile.ZipFile(emu_zip) as zf:
|
||||
self.assertIn("scph5501.bin", zf.namelist())
|
||||
|
||||
def test_143_from_md5_not_in_repo(self):
|
||||
"""--from-md5 reports files in DB but missing from repo."""
|
||||
import contextlib
|
||||
|
||||
Reference in new issue
Block a user