mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: leave bizhawk's declared sha1 to bizhawk
This commit is contained in:
1 parent
4727734c24
commit
e787fcee8e
2 files changed
+19
-2
No files matched your search
@@ -11,7 +11,7 @@ from __future__ import annotations
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .base_exporter import BaseExporter
|
from .base_exporter import BaseExporter
|
||||||
from .baseline import NativeFile, NativeSystem, Report
|
from .baseline import NativeFile, NativeSystem, Report, _hash_values
|
||||||
|
|
||||||
SOURCE_URL = (
|
SOURCE_URL = (
|
||||||
"https://raw.githubusercontent.com/TASEmulators/BizHawk/master"
|
"https://raw.githubusercontent.com/TASEmulators/BizHawk/master"
|
||||||
@@ -80,7 +80,10 @@ class Exporter(BaseExporter):
|
|||||||
seen: dict[str, list[NativeFile]] = {}
|
seen: dict[str, list[NativeFile]] = {}
|
||||||
for system in systems.values():
|
for system in systems.values():
|
||||||
for fe in system.files:
|
for fe in system.files:
|
||||||
if fe.hash("sha1"):
|
# A SHA1 BizHawk declares is BizHawk's own code, the authority
|
||||||
|
# for its cores: the truth's MSX.rom came from FBNeo and would
|
||||||
|
# have made MSXHawk refuse the dump it accepts.
|
||||||
|
if fe.hash("sha1") and not _hash_values(fe.platform or {}, "sha1"):
|
||||||
seen.setdefault(fe.name.casefold(), []).append(fe)
|
seen.setdefault(fe.name.casefold(), []).append(fe)
|
||||||
resolved: dict[str, NativeFile] = {}
|
resolved: dict[str, NativeFile] = {}
|
||||||
for name, entries in seen.items():
|
for name, entries in seen.items():
|
||||||
|
|||||||
@@ -205,6 +205,20 @@ class OneMd5FormatsAddWhole(unittest.TestCase):
|
|||||||
self.assertTrue(Batocera.writable(single))
|
self.assertTrue(Batocera.writable(single))
|
||||||
|
|
||||||
|
|
||||||
|
class BizHawkKeepsItsOwnHashes(unittest.TestCase):
|
||||||
|
def test_a_declared_sha1_is_not_replaced(self):
|
||||||
|
"""FBNeo's MSX.rom replaced the SHA1 MSXHawk accepts in BizHawk's code."""
|
||||||
|
sha_bizhawk, sha_fbneo = "4" * 40, "e" * 40
|
||||||
|
fe = NativeFile("MSX.rom", "MSX.rom", "MSX", platform={"sha1": sha_bizhawk},
|
||||||
|
truth={"sha1": sha_fbneo}, corrections=["sha1"])
|
||||||
|
exporter = BizHawk()
|
||||||
|
source = f'FirmwareAndOption("{sha_bizhawk.upper()}", 32768, "MSX", "b", "MSX.rom", "d");\n'
|
||||||
|
produced = exporter.render({"MSX": NativeSystem("MSX", files=[fe])}, None,
|
||||||
|
{exporter.native_filename(): source})
|
||||||
|
self.assertIn(sha_bizhawk.upper(), produced[exporter.native_filename()])
|
||||||
|
self.assertFalse(exporter.states(fe, "sha1"))
|
||||||
|
|
||||||
|
|
||||||
class ModelKeepsOneFileOneEntry(unittest.TestCase):
|
class ModelKeepsOneFileOneEntry(unittest.TestCase):
|
||||||
def test_a_list_of_sizes_is_not_one_size(self):
|
def test_a_list_of_sizes_is_not_one_size(self):
|
||||||
"""A profile may accept several revisions; int() on the list crashed."""
|
"""A profile may accept several revisions; int() on the list crashed."""
|
||||||
|
|||||||
Reference in new issue
Block a user