The SAVE FILES card only accepted saves of exactly 32768 bytes and
refused anything else. importToSlot now classifies a non-32768 file by
the integrity of its main-data checksum instead:
- Oversize + valid checksum -> an emulator RTC footer, so the launcher
asks for confirmation, then truncates to 32768 on force.
- Oversize + invalid checksum -> rejected.
- Undersize + valid checksum -> imports zero-padded; otherwise refused.
Adds the "Oversized save file" confirm modal, a new vendor-oracle test
built by gen1lib (PKHeX-derived) run as its own Lua 5.4 tier, oversize/
truncated policy tests, and the LUA54 wiring in test.sh.
# Conflicts:
# src/import/LauncherView.lua
Auditing the reporter's PKHeX screenshots against the emitted bytes
turned up three fidelity bugs in the .sav export:
- Name fields on a templateless export stayed zero-filled after the
$50 terminator; every real save the naming screen wrote $50-pads
the tail, and the zero tail is what PKHeX rendered as "JOHN{}".
encodeName now pads zero tail bytes with $50 (nonzero template
bytes still survive untouched).
- wOptions was never written, dropping text speed / battle style /
battle effects on export. Templateless exports now pack it from
save.options (the recomp's textSpeed 1/3/5 are pokered's exact
values); with a template the cartridge's own byte still wins.
- The party/box catch-rate byte was always re-derived from the
current species, but Gen1 freezes it at catch time (evolution does
not update it), which is why PKHeX demanded "a preevolution catch
rate". Pokemon.new now stamps the as-caught catchRate and
Evolution.apply's in-place mutation preserves it.
The reported emulator crash itself is not addressed here: the encoder
is byte-identical to the reporter's version, and a byte-level audit
(offsets vs Bulbapedia's save map, all three checksums, a real
gameplay save round-trip, pokered's LoadMapData regenerating every
zeroed cache) shows the current export is structurally valid.