mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-28 09:54:43 +02:00
fe31293566
#1832 reports a Crystal .sav failing to import with "save data checksum invalid (main data checksum mismatch)". The save is fine. It is being measured with the wrong generation's ruler. SaveFileIO.importToSlot sends anything that is not exactly SAVE_SIZE into mainChecksumValid, which is pokered's main-data checksum. Gen 2 carts are MBC3+TIMER, so a real Gold, Silver or Crystal battery save carries an RTC footer: 32786 bytes, never 32768. It misses the size test, falls into the checksum branch, and is told it is damaged by a rule written for a different game. Every real Gen 2 cart save takes that path, every time. The generation check already exists, it just lives too late, inside importSav and behind the size gate that has already rejected the save. This lifts it into SaveConvert.importSupported and exportSupported and asks before the bytes are measured. Both existing guards route through the same predicates now, so the early caller and the late one cannot describe the same game two different ways. Nothing changes for Gen 1, and Gen 2 is still refused, for the real reason and in a sentence a player can do something with. tests/gen2_save_import_message_test.lua covers it. Against the code as it stands it is 20/26, and the failures are the report itself. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>