Spiff wrote:Thanks for doing this Trav, I've looked and looked and looked at the .res files and yet they still make zero sense to me.
first few bytes will be ascii signature for "Haven Signature 1"
next two bytes are resource version
Then layers. Each layer is:
NULL terminated layer name
next four bytes is the size of the layer (number of bytes left to read)
remaining bytes for that layer is binary data for whatever loftar has put in there. Could be an image, could be some audio, could be some code, could be an anim.
All the different layer types are defined in Resource.java as subclasses of Layer. They have constructors which take the byte array and handle deserialisation and they have an init method in case any non deserialization related initialization is required (eg, Animation layers will probably need to build up a list of Image layers that have already been deserialized)
Order of layers is not supposed to be important.
EDIT - probably worth mentioning is that Loftar uses unsigned bytes in his storage, whereas java only supports signed bytes (or vice versa I forget) so that's what all the Utils.ubyte16c(byte[]) is about