diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 82f02f52..b16846c4 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -2250,7 +2250,19 @@ def _render_emulator_file( if fsha256: details.append(f"SHA256: {_hash_spans(fsha256)}") if fadler32: - details.append(f"Adler32: `{fadler32}`") + # Printed as the downloads spell a hash, one per code span: the list + # repr read `['0x66f334fe', ...]`. Dolphin hashes its DSP ROMs over + # byte-swapped 16-bit words, so the raw Adler-32 the downloads carry + # for the same file differs, and the card says which one it lists. + values = fadler32 if isinstance(fadler32, list) else [fadler32] + shown = ", ".join(f"`{str(v).lower().removeprefix('0x')}`" for v in values) + if f.get("adler32_byteswap"): + details.append( + f"Adler32 over the file's 16-bit words byte-swapped: {shown} " + "(the Adler-32 in the downloads is the file's own and differs)" + ) + else: + details.append(f"Adler32: {shown}") if aliases: details.append(f"Aliases: {', '.join(f'`{a}`' for a in aliases)}") if priority is not None: diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 6c35d962..f22226e1 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -4451,5 +4451,25 @@ class BundledFilesAreNotToSource(unittest.TestCase): self.assertEqual([row["status"] for row in rows], ["bundled"]) + +class AdlerValuesReadLikeTheDownloads(unittest.TestCase): + """The Dolphin card read Adler32: `['0x66f334fe', '0xe789b5a5']`, a list + repr no download spells, and never said the values are taken over the + byte-swapped ROM, so the raw ea3734fe in files.csv matched neither.""" + + def test_values_and_the_swap_are_stated(self): + from scripts.generate_site import _render_emulator_file + + entry = {"name": "dsp_rom.bin", "path": "dsp_rom.bin", + "known_hash_adler32": ["0x66f334fe", "0xE789B5A5"], + "adler32_byteswap": True} + text = "\n".join(_render_emulator_file( + entry, {"files": [entry]}, None, [entry], lambda f: True, "file-dsp", + )) + self.assertIn("`66f334fe`, `e789b5a5`", text) + self.assertIn("byte-swapped", text) + self.assertNotIn("['", text) + + if __name__ == "__main__": unittest.main()