mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 09:56:23 +00:00
* feat(artifacts): inventory Nintendo 64 ROM images and normalize byte order offline An n64-rom image is recognized from the first word in z64 (80 37 12 40), v64 (37 80 40 12), or n64 (40 12 37 80) order plus a 4-byte-aligned boot address in KSEG0 or KSEG1. The reader normalizes the cartridge header and serves header.bin, ipl3.bin, and program.z64 in big-endian order, swapping v64 and n64 bytes and recording that swap as decoded. It names the IPL3/CIC variant from the CRC32 of bytes 0x40..0x1000 and, for a known variant, recomputes the CRC pair over the 1 MiB window; a mismatch, unknown CIC, short window, or non-zero reserved header bytes leave coverage unknown, and a file above 64 MiB is refused before any swap. Comparison ignores n64-rom and n64-rom-entry metadata so dump order is not treated as a content change, and decoded members share the idle-abort helper the Switch executable reader now calls. * fix(n64): admit members before reading and follow each byte order's swap unit Charge artifact_limits.expanded_bytes from the file size and byte order before the checksum window is read and swapped. The member layout now has one owner, n64RomRegions, which the parser and the allowance both use. The length rule follows the order's swap unit, as in mupen64plus-core: a z64 image of any length needs no swap, a v64 image needs an even length and an n64 image a multiple of 4. The guide now says that a printable destination byte outside the known table keeps its code with a null destination_name. * refactor(n64): name header fields from the spec and share the boot-address check Header offsets, the first-word magics, the CIC 6105 table offset and the KSEG bounds are now named constants with their reference sources, and recognition and parsing share one boot-address decision. A closed-form test checks the cartridge checksum on an all-zero window for every CIC, derived from the checksum routine rather than from n64CartridgeCrc. * fix(n64): keep the present bytes of a final partial word in the checksum window The checksum routine now reads one defined window, n64ChecksumWindow: the image through 0x101000 with only the bytes past a shorter file taken as zero. A z64 or v64 image that ends inside a word keeps that word's bytes instead of losing the whole word. The limitation now says how many bytes were assumed. --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>