Difference between revisions of "FSKA (File Format)"

From MK8
Jump to navigation Jump to search
m (The textboxes with color were black (for me))
Line 16: Line 16:
 
|-
 
|-
 
| 0x0C || UInt32 || '''Unknown''' (possibly flags, as in other subfiles).
 
| 0x0C || UInt32 || '''Unknown''' (possibly flags, as in other subfiles).
|- bgcolor="#AFA"
+
|- bgcolor="#AAFFAA"
 
| colspan="3" align="center" | '''if BFRES version >= 3.4.0'''
 
| colspan="3" align="center" | '''if BFRES version >= 3.4.0'''
|- bgcolor="#DFD"
+
|- bgcolor="#DDFFDD"
 
| 0x10 || UInt32 || '''Frame count'''.
 
| 0x10 || UInt32 || '''Frame count'''.
|- bgcolor="#DFD"
+
|- bgcolor="#DDFFDD"
 
| 0x14 || UInt16 || '''[[#Bone|Bone]] count'''.
 
| 0x14 || UInt16 || '''[[#Bone|Bone]] count'''.
|- bgcolor="#DFD"
+
|- bgcolor="#DDFFDD"
 
| 0x16 || UInt16 || '''Unknown''', possibly padding.
 
| 0x16 || UInt16 || '''Unknown''', possibly padding.
|- bgcolor="#FAA"
+
|- bgcolor="#FFAAAA"
 
| colspan="3" align="center" | '''else'''
 
| colspan="3" align="center" | '''else'''
|- bgcolor="#FDD"
+
|- bgcolor="#FFDDDD"
 
| 0x10 || UInt16 || '''Frame count'''.
 
| 0x10 || UInt16 || '''Frame count'''.
|- bgcolor="#FDD"
+
|- bgcolor="#FFDDDD"
 
| 0x12 || UInt16 || '''[[#Bone|Bone]] count'''.
 
| 0x12 || UInt16 || '''[[#Bone|Bone]] count'''.
|- bgcolor="#FDD"
+
|- bgcolor="#FFDDDD"
 
| 0x14 || UInt32 || '''Unknown''', possibly padding.
 
| 0x14 || UInt32 || '''Unknown''', possibly padding.
 
|-
 
|-
Line 122: Line 122:
 
|-
 
|-
 
| 0x14 || Single || '''Data value init''', an initial value to offset the data values with.
 
| 0x14 || Single || '''Data value init''', an initial value to offset the data values with.
|- bgcolor="#AFA"
+
|- bgcolor="#AAFFAA"
 
| colspan="3" align="center" | '''if BFRES version >= 3.4.0'''
 
| colspan="3" align="center" | '''if BFRES version >= 3.4.0'''
|- bgcolor="#DFD"
+
|- bgcolor="#DDFFDD"
 
| 0x18 || Single || '''Unknown'''.
 
| 0x18 || Single || '''Unknown'''.
|- bgcolor="#DFD"
+
|- bgcolor="#DDFFDD"
 
| 0x1C || Int32 || '''[[#Key Frames|Key frames]]''' array offset.
 
| 0x1C || Int32 || '''[[#Key Frames|Key frames]]''' array offset.
|- bgcolor="#DFD"
+
|- bgcolor="#DDFFDD"
 
| 0x20 || Int32 || '''[[#Key Data|Key data]]''' array offset.
 
| 0x20 || Int32 || '''[[#Key Data|Key data]]''' array offset.
|- bgcolor="#FAA"
+
|- bgcolor="#FFAAAA"
 
| colspan="3" align="center" | '''else'''
 
| colspan="3" align="center" | '''else'''
|- bgcolor="#FDD"
+
|- bgcolor="#FFDDDD"
 
| 0x18 || Int32 || '''[[#Key Frames|Key frames]]''' array offset.
 
| 0x18 || Int32 || '''[[#Key Frames|Key frames]]''' array offset.
|- bgcolor="#FDD"
+
|- bgcolor="#FFDDDD"
 
| 0x1C || Int32 || '''[[#Key Data|Key data]]''' array offset.
 
| 0x1C || Int32 || '''[[#Key Data|Key data]]''' array offset.
 
|}
 
|}

Revision as of 13:33, 24 May 2017

Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

The FSKA subfile stores animations which control how to transform bones of a model over time. It appears as a subfile of a BFRES file in the 2:nd index group. Unless otherwise noted, all offsets in the file are relative to themselves.

Header (FSKA)

An FSKA file begins with an 0x24 byte header that starts with the file identifier, followed by info about the image.

Offset Type Description
0x00 String File magic. Always FSKA in ASCII.
0x04 Int32 Filename offset. The name of this file.
0x08 Int32 End of String table offset.
0x0C UInt32 Unknown (possibly flags, as in other subfiles).
if BFRES version >= 3.4.0
0x10 UInt32 Frame count.
0x14 UInt16 Bone count.
0x16 UInt16 Unknown, possibly padding.
else
0x10 UInt16 Frame count.
0x12 UInt16 Bone count.
0x14 UInt32 Unknown, possibly padding.
0x18 UInt32 Unknown.
0x1C UInt32 Unknown.
0x20 Int32 Bone array offset.

After this follows something like a UInt16 array of unknown length (around 38 to 42 elements), each mostly having values 0x0000 or 0xFFFF. It might be possible the first ones are an offset to user data like in other subfile formats.

Bone

This section describes how a bone of the model has to be transformed over time. It appears in an array of bones following and referenced by the header.

Offset Type Description
0x00 UInt32 Unknown.
0x04 Int32 Bone name offset of the bone to be transformed.
0x08 UInt16 Unknown.
0x0A Byte Track count. Might be 0 if the bone is not changed at all.
0x0B Byte Unknown, possibly padding.
0x0C UInt32 Unknown.
0x10 Int32 Track array offset.
0x14 Int32 Base transform structure offset.

Base Transform

This structure stores how a bone is transformed in its initial state, and is referenced by each Bone section once.

Offset Type Description
0x00 Single[3] Scale Vector 3 floats. The amount to scale the bone by.
0x0C Single[4] Rotation Vector, normally stored as euler rotation (X, Y, Z in radians) but it can be stored as a quaternion. The last float is not used by euler rotation and is therefore set to 1f.
0x1C Single[3] Translation Vector 3 floats. The amount to translate the bone by.

Track

This section controls how a specific transformation is applied on a bone over time. Tracks are referenced in an array by the Bone section; there might be no tracks if the bone will not be animated.

Offset Type Description
0x00 UInt16 Data type of the key frames and key data array.
0x02 UInt16 Key count.
0x04 UInt32 Animation type.
Value Description
0x04 X Scale
0x08 Y Scale
0x0C Z Scale
0x10 X Translate
0x14 Y Translate
0x18 Z Translate
0x20 X Rotate
0x24 Y Rotate
0x28 Z Rotate
0x08 UInt32 Unknown.
0x0C Single Number of frames the animation plays.
0x10 Single Data value scale, a factor to scale the data values with.
0x14 Single Data value init, an initial value to offset the data values with.
if BFRES version >= 3.4.0
0x18 Single Unknown.
0x1C Int32 Key frames array offset.
0x20 Int32 Key data array offset.
else
0x18 Int32 Key frames array offset.
0x1C Int32 Key data array offset.

Key Frames

The key frame array is of length and element type given by the header:

Data Types Key Frame Element Type
0x02, 0x05, 0x06, 0x09, 0x0A UInt16 >> 5
else Byte

The resulting values of the elements specify the frame at which the key with the same index in the key data array is placed.

Key Data

Each key in the key array consists of 4 unknown values of different type dependent upon the data type specified in the header:

Data Types Key Data Element Type
0x02 Single
0x05 Int16
0x06 Int16
0x09, 0x0A Byte

Tools

The following tools can handle FSKA files: