CANM (File Format)

From Luma's Workshop
Jump to navigation Jump to search
This page is in progress and may contain incomplete information or editor's notes.

CANM (Camera ANiMation) is a file format which specifies cameras used for scenario intros and cutscenes. The scenario intro cameras are present in the files "/Stage/camera/StartScenarioX.bcsv" (where X is the scenario ID) inside the main zone map archive. The file format support both key frames and full frames. It is unknown whether any files are stored as full frames.

Header

The file format starts with the following header:

Offset Type Description
0x00 Char[4] File magic. Always "ANDO" in ASCII.
0x04 Char[4] Frame type. Either "CKAN" for key frames or "CANM" for full frames.
0x08 Int32 Unknown. Must be non-zero, otherwise the game will refuse to load the file.
0x0C Int32 Unknown.
0x10 Int32 Unknown.
0x14 Int32 Unknown, doesn't seem to be read by the game.
0x18 Int32 Frame count.
0x1C UInt32 Frame info size.

Frame Info

The frame info specifies how the frame data is stored. The section consists of multiple component infos which specifies how each component are stored. The components which are stored are position X, position Y, position Z, watch position X, watch position Y, watch position Z, twist and fovy, and they are stored in the order specified before. Note that twist and fovy are stored in degrees.

Component Info

The component specifies how a specific component is stored. The structure depends on whether the file contains key frames or full frames.

Key
Offset Type Description
0x00 Int32 Key frame count.
0x04 Int32 First value index. Index of the first float value in the frame data.
0x08 Int32 Slope type. Specifies if the slopes are symmetric (0) or if they are stored piece-wise (1). Note that game treats the value 0 as symmetric and all other values as piece-wise.
Full
Offset Type Description
0x00 Int32 Frame count. Specifies how many frame values are stored.
0x04 Int32 First value index. Index of the first float value in the frame data.

Frame Structure

For full frames, each float simply represents the value at a specific frame and frame count specifies how many floats are stored. For key frames, the data storage is slightly more complicated and depends on the key frame count. If the key frame count is one, only a single value is stored which represents the value the component will have for all frames. Otherwise structure of each key frame depends on the slope type. The structure for each slope type is specified below.

Symmetric
Offset Type Description
0x00 Float Key frame.
0x04 Float Value.
0x08 Float Slope.
Piece-wise
Offset Type Description
0x00 Float Key frame.
0x04 Float Value.
0x08 Float In slope.
0x0C Float Out slope.

Frame Data

The frame data section stores all float values. It has the following layout:

Offset Type Description
0x00 UInt32 Frame data size. Size of the float data in bytes.
0x04 Float[] Frame data.

The float data always end with the bytes 3D CC CC CD 4E 6E 6B 28. The first four bytes form the float 0.1. It is unknown why this data is stored. It is including in the frame data size.

After the float data the integer -1 is always stored as an Int32, again, for unknown reason. This data is not included in the frame data size.