FF7/Field/BSX
Contents
BSX file structure (thanks to Micky's tool)
File header
The BSX file, after it is decompressed, begin with a header of 12 bytes : <cpp> struct StrBsxHeader {
u32 size_file; // Size of the file u32 offset_models; // Offset to the models section byte unknown[4];
}; </cpp>
Skeleton data section
This section contains the parts of the model's skeleton. For each model, there is :
Offset | Size | Data |
---|---|---|
offset_vertices = offset_vertex + 4 | size_vertices = num_vertex * 8 | Vertices |
offset_texcoords = offset_vertex + offset_texcoord | size_texcoords = num_texcoord * 2 | Textures coord |
offset_qct = offset_vertex + offset_poly | size_qct = 1 + num_quad_color_tex * 0x18 | Quad color textures |
offset_tct = offset_qct + size_qct | size_tct = 1 + num_tri_color_tex * 0x14 | Tri color textures |
offset_qmt = offset_tct + size_tct | size_qmt = 1 + num_quad_mono_tex * 0x0C | Quad mono textures |
offset_tmt = offset_qmt + size_qmt | size_tmt = 1 + num_tri_mono_tex * 0x0C | Tri mono textures |
offset_tm = offset_tmt + size_tmt | size_tm = num_tri_mono * 8 | Tri mono |
offset_qm = offset_tm + size_tm | size_qm = num_quad_mono * 8 | Quad mono |
offset_tc = offset_qm + size_qm | size_tc = num_tri_color * 0x10 | Tri color |
offset_qc = offset_tc + size_tc | size_qc = num_quad_color * 0x14 | Quad color |
Animation data section
First, there are the channels, at offset <cpp>offset_data + 4</cpp>, which size is <cpp>num_channel * 8</cpp>. Then, for each channel :
Offset | Size | Data |
---|---|---|
offset_data + offset_frames_translation | num_frames_translation * num_frames | Translation frames |
offset_data + offset_static_translation | num_static_translation * 2 | Static translation frames |
offset_data + offset_frames_rotation | num_frames_rotation * num_frames | Rotation frames |
Models section
This section begins first with a model header of 16 bytes : <cpp> struct StrModelHeader {
u32 psx_memory; // Memory adress to load the section into, maybe ? u32 num_models; // Number of models u32 size_models; // Size of the models section byte unknown[4];
} </cpp>
Which is followed by num_models number of : <cpp> struct StrModel {
u16 model_id; // ID of the model byte unknown[2]; u32 offset_skeleton; // Offset to the parts, bones and animations of the model byte unknown[15]; byte num_bones; // Number of bones in the model's skeleton byte unknown[11]; byte num_parts; // Number of parts in the model's skeleton byte unknown[11]; byte num_animations; // Number of animations
} </cpp>
Then, for each model, we have the parts, bones and animations (at the offset offset_skeleton) :
<cpp> // Bones (if num_bones > 0) struct StrBone {
byte unknown[4];
} // Parts (if num_parts > 0) struct StrPart {
byte unknown; byte bone_index; // byte num_vertex; // Number of vertices byte num_texcoord; // Number of Texture coord byte num_quad_color_tex; // Number of ? byte num_tri_color_tex; // Number of ? byte num_quad_mono_tex; // Number of ? byte num_tri_mono_tex; // Number of ? byte num_tri_mono; // Number of ? byte num_quad_mono; // Number of ? byte num_tri_color; // Number of ? byte num_quad_color; // Number of ? u16 num_flags; // Number of ? u16 offset_poly; // Relative offset to ? u16 offset_texcoord; // Relative offset to ? u16 offset_flags; // Relative offset to ? u16 offset_control; // Relative offset to ? u16 buffer_size; // Relative offset to ? u32 offset_vertex; // Offset to skeleton data section u32 offset_prec; // Offset to ?
} // Animations (if num_animations > 0) struct StrAnimation {
u16 num_frames; // Number of frames byte num_channel; // Number of channels byte num_frames_translation; // Number of translation frames byte num_static_translation; // Number of static translation frames byte num_frames_rotation; // Number of rotation frames u16 offset_frames_translation; // Relative offset to translation frames u16 offset_static_translation; // Relative offset to statis translation frames u16 offset_frames_rotation; // Relative offset to rotation frames u32 offset_data; // Offset to animation data section
} </cpp>
Rest of the file
The rest of the file is unknown for now.