Confirm custom Huffman trees still incompatible with original nuke1

Tested custom trees with the custom master fix in place — the original
still hangs.  The tree incompatibility is a separate issue from the
SuperMaster path hang (both are real problems, both are now understood).

Custom trees give ~40% better compression for text data (1066 vs 1688
bytes for textfile.txt) but are incompatible with nuke1's assumptions.
Default tree retained for backward compatibility.

Updated roadmap to separate the backward compat (done) from the tree
optimization (remaining).
This commit is contained in:
Eremey Valetov
2026-03-29 15:36:48 -04:00
parent 6e62a7aa28
commit 75a5ea541e
2 changed files with 15 additions and 11 deletions

View File

@@ -21,14 +21,16 @@
Reverse direction is a known limitation: the original UC2 Pro
cannot read UC2 v3 archives due to compression bitstream
differences.)
- [x] Single-file backward compatibility with original UC2 Pro
(listing + extraction verified in DOSBox-X)
- [x] Single-file backward compatibility with original UC2 Pro
(listing + extraction verified in automated DOSBox-X test).
- [x] Multi-file backward compatibility with original UC2 Pro
(listing + extraction verified for 4 files in automated
DOSBox-X test). Fix: always assign custom master indices
(>= 2), never SuperMaster (0), matching the original's behavior.
- [x] Backward compatibility with original UC2 Pro (listing +
extraction verified for multi-file archives in both directions
in automated DOSBox-X test).
- [ ] Custom Huffman tree compatibility with original UC2 Pro.
Currently uses the default tree for all blocks (~40% worse
compression for text, ~0% for random data). Our treegen
produces valid trees but the original's nuke1 ASM kernel
depends on the exact tree shapes from the original TreeGen.
Improving this requires bit-exact treegen or understanding
nuke1's tree assumptions.
- [ ] Give UC2 a voice: status and progress messages with personality,
continuing the original's tradition ("Do not worry, you have got
the tree", "decompression always lightspeed", FAST/TIGHT/S-TIGHT

View File

@@ -697,9 +697,11 @@ static int flush_block(struct compressor *c, int is_last)
u8 lengths[NumSymbols];
/* Use the default tree for backward compatibility with the original
UC2 Pro's ASM decompressor kernel. Custom trees from our treegen
cause the original to hang (the tree encoding is valid but the
ASM kernel has undocumented assumptions about tree shapes). */
UC2 Pro's ASM decompressor (nuke1). Custom trees from our treegen
produce valid bitstreams but nuke1 hangs on them — the original's
tree generation (TREEGEN.CPP) produces different Huffman code
assignments that nuke1 depends on. The default tree gives ~40%
worse compression but full backward compatibility. */
uc2_default_lengths(lengths);
/* Emit block-present flag */