dm2-graphics: docs: ENT1 type headers are (field letter, byte width) descriptors, not per-type record counts #192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Both
crates/dm2-graphics/src/ent1.rs(TypeHeader { letter, count }, "ASCII letter code … plus the count of entries of that type") anddocs/formats/graphics-dat.md("type-header records: (type_letter_code, count) pairs") mislabel the ENT1 type headers.The engine reads them as field descriptors: (field letter, byte width) pairs that define the layout of every entry record.
DM2_LOAD_ENT1matches each header letter against the canonical field listT I D S P F G, records the field's byte width (v1e09c0) and running offset (v1e09b2), and sums the widths into the record stride (v1e09ae) —[SKPROJECT] v5/bgdat.cpp:909-926;DM2_QUERY_GDAT_ENTRY_VALUE(bgdat.cpp:516-527) then reads each field at its declared offset/width.All 16 fixture archives declare
T,I,D,S,F,G,Pwith widths1,1,1,1,1,1,2— which is exactly why the crate's hardcoded 8-byteGraphicFileEntry(cls1..cls6 + u16 data) works. The "count" reading is self-evidently wrong from the data:('P', 2)would mean "2 records of type P" in a table with thousands.Two consequences beyond the doc fix:
Ent1::parsenever validates the declared layout. An archive with reordered or re-sized fields (the engine would handle it) would be silently misparsed. Cheap guard: error (or warn) unless the headers match the canonicalT1 I1 D1 S1 F1 G1 P2shape.Fixed by #208 (merged into
main).