Anonymous

Changes

From Final Fantasy Inside

FF7/Field/BSX

No change in size, 17:24, 13 April 2013
<cpp> doesn't exists anymore
The BSX file, after it is decompressed, begin with a header of 8 bytes :
<cpppre>
struct StrBsxHeader {
u32 size_file; // Size of the file
u32 offset_models; // Offset to the models section
};
</cpppre>
Note: The end of the BSX Header is directly before the beginning of the Skeleton Data Section.
Structures:
<cpppre>
typedef struct {
s16 x, z, y;
} Vertex;// sizeof = 0x06
</cpppre><cpppre>
typedef struct {
u8 red, green, blue;
u8 unknown; // alpha? padding?
} Color;// sizeof = 0x04
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[4];
u8 texCoordId[4];
} ColorTexturedQuad;// sizeof = 0x18
</cpppre>
'''Note for quads:''' it is possible that the vertices are not in the correct order for display, If you see they display wrong, try swapping the last two vertices.
<cpppre>
typedef struct {
u8 vertexIndex[3];
u8 padding2;
} ColorTexturedTriangle;// sizeof = 0x14
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[4];
u8 texCoordId[4];
} MonochromeTexturedQuad;// sizeof = 0x0C
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[3];
u8 padding2;
} MonochromeTexturedTriangle;// sizeof = 0x0C
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[3];
Color color;
} MonochromeTriangle;// sizeof = 0x08
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[4];
Color color;
} MonochromeQuad;// sizeof = 0x08
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[3];
Color color[3];
} ColorTriangle;// sizeof = 0x10
</cpppre><cpppre>
typedef struct {
u8 vertexIndex[4];
Color color[4];
} ColorQuad;// sizeof = 0x14
</cpppre><cpppre>
typedef struct {
u8 x, y;
} TextureCoord;// sizeof = 0x02
</cpppre>
== Animation Data Section ==
First, there are the channels, at offset <cpppre>offset_data + 4</cpppre>, which size is <cpppre>num_channel * 8</cpppre>. Then, for each channel :
{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
|}
<cpppre>
typedef struct {
u8 flag;
u8 unknown; // padding?
} FrameTranslation; // sizeof = 8
</cpppre>
<cpppre>
typedef struct {
s16 translation;
} StaticTranslation;
</cpppre>
== Models Section ==
This section begins first with a model header of 16 bytes:
<cpppre>
struct StrModelHeader {
u32 psx_memory; // Memory address to load the section into, maybe ?
u32 unknown_pointer; // "Pointer to something. We copy environment settings for models to where it points."
}
</cpppre>
[Edit by Lazy Bastard]: Actually, it looks like "unknown_pointer" above is the buffer size for model textures. When adding
Which is followed by num_models number of :
<cpppre>
struct StrModel {
u16 model_id; // ID of the model
byte num_animations; // Additional number of animations
} // sizeof = 48
</cpppre>
Please note that this is additional number of animations in case of settings for models that has BCX file. They load BCX animations, parts and bones first, then add BSX parts. For example cloud's sword in some fields added to normal BCX cloud file.
Then, for each model, we have the parts, bones and animations (at the offset offset_skeleton) :
<cpppre>
// Bones (if num_bones > 0)
struct StrBone {
u32 offset_data; // Offset to animation data section, substract by 0x80000000 to obtain the right offset
}
</cpppre>
This section begins first with a texture section header of 8 bytes:
<cpppre>
struct TexSectionHeader {
u32 unknown1;
byte unknown2[3];
}
</cpppre>
And just after, a list of texture header for each texture:
<cpppre>
struct TexHeader {
u16 width, height;
u32 offset_data; // relative to texture_pointer
}
</cpppre>
And finally, these headers are followed by texture data.
Anonymous user