Anonymous

Changes

From Final Fantasy Inside

FF7/Field/BSX

6,550 bytes added, 16:34, 4 March 2010
no edit summary
= BSX file structure (thanks to [http://forums.qhimm.com/index.php?topic=8969.msg122920#msg122920 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 :

{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
! style="background:rgb(204,204,204)" align="center" | Offset
! style="background:rgb(204,204,204)" align="center" | Size
! style="background:rgb(204,204,204)" align="center" | Data
|-
|style="background:rgb(255,255,255)" | offset_vertices = offset_vertex + 4
|style="background:rgb(255,255,255)" | size_vertices = num_vertex * 8
|style="background:rgb(255,255,255)" | Vertices
|-
|style="background:rgb(255,255,255)" | offset_texcoords = offset_vertex + offset_texcoord
|style="background:rgb(255,255,255)" | size_texcoords = num_texcoord * 2
|style="background:rgb(255,255,255)" | Textures coord
|-
|style="background:rgb(255,255,255)" | offset_qct = offset_vertex + offset_poly
|style="background:rgb(255,255,255)" | size_qct = 1 + num_quad_color_tex * 0x18
|style="background:rgb(255,255,255)" | Quad color textures
|-
|style="background:rgb(255,255,255)" | offset_tct = offset_qct + size_qct
|style="background:rgb(255,255,255)" | size_tct = 1 + num_tri_color_tex * 0x14
|style="background:rgb(255,255,255)" | Tri color textures
|-
|style="background:rgb(255,255,255)" | offset_qmt = offset_tct + size_tct
|style="background:rgb(255,255,255)" | size_qmt = 1 + num_quad_mono_tex * 0x0C
|style="background:rgb(255,255,255)" | Quad mono textures
|-
|style="background:rgb(255,255,255)" | offset_tmt = offset_qmt + size_qmt
|style="background:rgb(255,255,255)" | size_tmt = 1 + num_tri_mono_tex * 0x0C
|style="background:rgb(255,255,255)" | Tri mono textures
|-
|style="background:rgb(255,255,255)" | offset_tm = offset_tmt + size_tmt
|style="background:rgb(255,255,255)" | size_tm = num_tri_mono * 8
|style="background:rgb(255,255,255)" | Tri mono
|-
|style="background:rgb(255,255,255)" | offset_qm = offset_tm + size_tm
|style="background:rgb(255,255,255)" | size_qm = num_quad_mono * 8
|style="background:rgb(255,255,255)" | Quad mono
|-
|style="background:rgb(255,255,255)" | offset_tc = offset_qm + size_qm
|style="background:rgb(255,255,255)" | size_tc = num_tri_color * 0x10
|style="background:rgb(255,255,255)" | Tri color
|-
|style="background:rgb(255,255,255)" | offset_qc = offset_tc + size_tc
|style="background:rgb(255,255,255)" | size_qc = num_quad_color * 0x14
|style="background:rgb(255,255,255)" | 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 :

{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
! style="background:rgb(204,204,204)" align="center" | Offset
! style="background:rgb(204,204,204)" align="center" | Size
! style="background:rgb(204,204,204)" align="center" | Data
|-
|style="background:rgb(255,255,255)" | offset_data + offset_frames_translation
|style="background:rgb(255,255,255)" | num_frames_translation * num_frames
|style="background:rgb(255,255,255)" | Translation frames
|-
|style="background:rgb(255,255,255)" | offset_data + offset_static_translation
|style="background:rgb(255,255,255)" | num_static_translation * 2
|style="background:rgb(255,255,255)" | Static translation frames
|-
|style="background:rgb(255,255,255)" | offset_data + offset_frames_rotation
|style="background:rgb(255,255,255)" | num_frames_rotation * num_frames
|style="background:rgb(255,255,255)" | 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 skeleton data section
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 basic informations about the parts, bones and animations :

So, for each model, we have :
<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 part data
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
}
</cpp>

== Rest of the file ==

The rest of the file is unknown for now.