thtk
thtk copied to clipboard
thanm fails on th143 bestshot.anm
I was notified by someone that thanm crashes when trying to extract images from bestshot.anm. Listing the archive spec also fails the same way. After a bit of digging looks like this was known from 9811c4ff1acb65d650349127951ed32adf186b1b but I guess I'll throw it out here anyways.
Leaves me wondering what a "best shot" even means here considering th125 doesn't have a file like this and the screenshot images are almost definitely stored in the savedata files. The anm file is also quite small so it couldn't contain much.
The issue there is that this one ANM breaks the heuristic used to distinguish between pre-TH11 and post-TH11 formats. Due to having a width of 0, all bytes at structure offsets 8-12 (the zero1
and w
fields) are zero in this file, leading to it being mistakenly treated as a pre-TH11 file, where rt_textureslot
is always zero.
I thought about this for a while, but due to the way the structure fields are laid out, I couldn't come up with anything better that wouldn't break under other circumstances either.
Meanwhile, here's the spec of bestshot.anm. Creating a new ANM from that should work fine, as well as using thcrap's upcoming ANM header patching feature.
@muter3000 you have implemented a version selection parameter for th185 (https://github.com/thpatch/thtk/pull/101), could you extend that feature to fix this?
btw that version select thing needs to be reimplemented because I haven't ported it to the new codebase when I merged #86 (which has a workaround for th18 btw 3adc7a9deb3e12f1ca20821477ccbe5c142266e8). I'll do that soon™
I'm thinking of actually requiring a version to be specified to avoid problems like this