The tie vertex element is 16 bytes and the layout cycles; correct e5cd3df
Picking up aftere5cd3df, which retracted the 16-byte tie vertex element for want of a detectable stride. There is one, at 64 bytes, and it beats a shuffle control by a factor of ten: regions with a signature 7,314 of 15,219 same test on shuffled bytes 731 of 15,219 stride 64 6,463 of the 7,314 Range: every tie vertex region on all 27 levels, 15,219 regions. A byte offset counts as constant at stride s when every unit of length s agrees there, with at least three units, an exact divide, and at least eight constant bytes. Dumping the regions shows four *different* 16-byte layouts repeating at +00 +10 +20 +30: one is a small i16 followed by two zeroes, one carries 255,-1 mid-element, the other two carry neither. So the element is 16 bytes and the layout cycles with period four. That is a partial retraction of a retraction:e5cd3dfwas right that the four layouts differ, and right that pooling them spans the whole i16 range. It was wrong to conclude that 16 is not the stride. Four tests still do not separate the four layouts, and the table records all four because the negative is the finding: LOD1/LOD2 sharing is 16.1/16.2/16.2/ 16.3 percent across the four groups, f32-in-band is 23 percent in all four (which is what uniform random gives), and i32-in-band is 0/2/6/0. The position stays unnamed. Also clears the clippy warnings that had accumulated on main from the disassembly work: doc_lazy_continuation on three prose blocks, two negated-comparison guards in gs.rs, a doc-then-item blank line twice over, a useless usize::from, and an as_chunks that needs 1.88 while the workspace declares 1.85 -- replaced with chunks_exact rather than moving the MSRV. Clippy is clean. Suite with the disc: 67 disc tests, 156 gc-formats, 22 gc-trace, 23 gc-engine, 19 gc-game; without it, 67 disc tests skip early and report the same count.
This commit is contained in:
@@ -103,10 +103,10 @@ pub fn parse_overlay_sections(overlay: &[u8]) -> Result<Vec<OverlaySection>> {
|
||||
if pos + 16 > overlay.len() {
|
||||
break;
|
||||
}
|
||||
let dest = b.peek_u32(pos, "overlay section dest")? as u32;
|
||||
let dest = b.peek_u32(pos, "overlay section dest")?;
|
||||
let size = b.peek_u32(pos + 4, "overlay section size")? as usize;
|
||||
let kind = b.peek_u32(pos + 8, "overlay section kind")? as u32;
|
||||
let entry = b.peek_u32(pos + 12, "overlay section entry")? as u32;
|
||||
let kind = b.peek_u32(pos + 8, "overlay section kind")?;
|
||||
let entry = b.peek_u32(pos + 12, "overlay section entry")?;
|
||||
if out.first().is_some_and(|f| f.entry != entry) {
|
||||
break;
|
||||
}
|
||||
@@ -200,8 +200,9 @@ impl LevelOverlay {
|
||||
}
|
||||
// lvl.vtbl update targets inside .text.
|
||||
if let Some(v) = ov.sections.get(3) {
|
||||
let entries = v.data.as_chunks::<12>().0;
|
||||
for e in entries {
|
||||
// `chunks_exact` rather than `as_chunks`: the latter is 1.88 and the
|
||||
// workspace declares 1.85. Same twelve-byte records.
|
||||
for e in v.data.chunks_exact(12) {
|
||||
let u = u32::from_le_bytes(e[4..8].try_into().unwrap());
|
||||
if u >= text_start && u < end && u % 4 == 0 {
|
||||
ov.starts.insert(u);
|
||||
@@ -659,8 +660,9 @@ mod tests {
|
||||
let mut overlays = Vec::with_capacity(27);
|
||||
for lv in 0..27usize {
|
||||
let ov = std::fs::read(data.join(format!("level{lv}/overlay.bin")))
|
||||
.expect(&format!("level{lv}/overlay.bin"));
|
||||
let secs = parse_overlay_sections(&ov).expect(&format!("level{lv} section parse"));
|
||||
.unwrap_or_else(|_| panic!("level{lv}/overlay.bin"));
|
||||
let secs =
|
||||
parse_overlay_sections(&ov).unwrap_or_else(|_| panic!("level{lv} section parse"));
|
||||
let lvl = LevelOverlay::from_sections(secs).expect("LevelOverlay::from_sections");
|
||||
overlays.push(lvl.unwrap_or_else(|| panic!("level {lv}: no .text section")));
|
||||
}
|
||||
@@ -697,7 +699,7 @@ mod tests {
|
||||
1,
|
||||
"level {i}: ref_fn 0x{ref_fn:x} found {} copies (expected 1), first={:x?}",
|
||||
copies.len(),
|
||||
copies.first().map(|a| *a as u32)
|
||||
copies.first().copied()
|
||||
);
|
||||
}
|
||||
eprintln!("mask: ref_fn 0x{ref_fn:x} found exactly once on all 26 other overlays");
|
||||
|
||||
Reference in New Issue
Block a user