Wax Issue
Karjala22 opened this issue · comments
Hi,
I've noticed the magic number for some waxes does not match the 0x00100100 spec. In the attached example the magic is 0x00011000 (69632). I am seeing this across multiple (custom) waxes uploaded over the decades to DF-21.net.
This failed the magic number
This passes the magic number
Here are some examples of this issue. (adding c3po.wax for comparison with good magic)..
Hypothesis, since this is happening on only custom assets (usually batched by specific authors) I am guessing this is a BIG vs LITTLE endian issue? Because if you convert the endian-ness they match each other (maybe due to development of wax on different OS?).
Adding an additional check for a reverse of the raw magic bytes fixed it on my end.
BTW, this may be the reason some of the BM control numbers are out of sync.
Thanks,
Karjala
I am guessing this is a BIG vs LITTLE endian issue?
Because if you convert the endian-ness they match each other (maybe due to development of wax on different OS?).
Agreed.
I know that Dark Forces was also on the Macintosh (OS 9 era), and that several development tools were made for the Mac.
It was likely one of those tools made for Mac, but it could have been a DOS/Windows tool.
I pushed a commit for this and will probably merge it soon enough.
BTW, this may be the reason some of the BM control numbers are out of sync.
I haven't found any issue related to endianess in BMs thus far, with regards to #1.
The control bytes embedded in the compressed data are only one byte in size each, so they can't be affected by endianess.
The pixels are similarly one byte each.
My current idea is that the control bytes are wrong in some cases because the compression algorithm was likely buggy, and this creates different issues for each image.
I would be surprised if these buggy BMs display properly in the game, or if they had the same appearance for each launch of the game.
Hi Nicholas,
Confirm 5af6d4e fixes it (that's actually how I wrote it on my end :) ).
Thank you!
Karjala