fix: count only the hash changes an export writes

RomM kept hashes the truth contradicts beside the corrected one, RetroDECK kept a cleared md5, Recalbox counted changes on an element it writes back whole, and two record formats counted fills no record could hold.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 20:36:47 +02:00
1 parent a913fbf539
commit eac2eaec83
7 files changed
+116 -3

No files matched your search

+6
View File
@@ -247,6 +247,12 @@ class Exporter(BaseExporter):
(field, value) for field, value in by_key[keys[0]].items()
if field in cls.carries() and not (field == "system" and declared)
)
# A hash of theirs that ours no longer carries is one the truth
# contradicts: kept, it went on rejecting the dump the emulator
# loads while the summary counted it cleared.
for field in ("md5", "sha256"):
if field in cls.carries() and field not in by_key[keys[0]]:
combined.pop(field, None)
if _md5_set(entry.get("md5")) == _md5_set(combined.get("md5")):
combined["md5"] = entry.get("md5")
elif isinstance(entry.get("md5"), list) and isinstance(combined.get("md5"), str):