Do some more file format spelunking

`WarHammer.ani` turns out to be a regular `obj` file; `WarHammer.idx`
is partially decoded, but I'm struggling to link it to the former in
a reasonable way at the moment.
This commit is contained in:
2020-04-15 00:27:43 +01:00
parent e2ad8f61c1
commit acb7882549
7 changed files with 413 additions and 196 deletions

View File

@@ -6,6 +6,7 @@ import (
"image"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
@@ -19,8 +20,9 @@ type SpriteHeader struct {
Width uint16
Height uint16
Padding1 uint32 // I don't think this is used. Could be wrong.
PixelSize uint32 // Size of PixelData, excluding this sprite header
Padding2 uint64 // I don't think this is used either. Could be wrong.
PixelSize uint32
Unknown1 [4]byte // ??? Only observed in `WarHammer.ani` so far
Padding2 uint32 // I don't think this is used either. Could be wrong.
}
func (s SpriteHeader) Check(expectedSize uint32) error {
@@ -28,6 +30,12 @@ func (s SpriteHeader) Check(expectedSize uint32) error {
return fmt.Errorf("Sprite header padding contains unknown values: %d %d", s.Padding1, s.Padding2)
}
// TODO: WarHammer.ani sets Unknown1 to this for all 188,286 sprites. I am
// very interested in seeing if there are any others
if s.Unknown1[0] != 212 || s.Unknown1[1] != 113 || s.Unknown1[2] != 59 || s.Unknown1[3] != 1 {
log.Printf("Value of Unknown1 field: %v", s.Unknown1)
}
// Remove 24 bytes from passed-in size to account for the header
if s.PixelSize != expectedSize-24 {
return fmt.Errorf("Advertised pixel size: %d differs from expected: %v", s.PixelSize, expectedSize-24)