Extracting models from binary files
Posted: Sun Apr 26, 2020 6:23 pm
I am trying to build a tool to export and import binary models from an old DX9 game. The models are packed in a single file and I have managed to extract the relevant parts in hexadecimal.
The data below corresponds to a simple rectangle plane in the game. (First image is the Vertex Buffer and the second image is the Indices)
Vertex Buffer
Indices
By analyzing the Vertex buffer, I have concluded that it was using the following format. Basically the stride is 24 bytes.
I believe the vertex buffer is not in the correct format since i am getting NAN values when I convert them to 32bit floats. Any idea how I can convert these vertices and indices to any 3D file format so that I can open them using blender or 3DS?
The data below corresponds to a simple rectangle plane in the game. (First image is the Vertex Buffer and the second image is the Indices)
Vertex Buffer
Code: Select all
[8B F6 00 00] [65 09 03 00] [80 FF 80 FF] [FF FF FF FF] [00 00 00 00] [00 00 00 00]
[8B F6 00 00] [9B F6 03 00] [80 FF 80 FF] [FF FF FF FF] [00 00 00 00] [00 00 80 3F]
[75 09 00 00] [65 09 03 00] [80 FF 80 FF] [FF FF FF FF] [00 00 80 3F] [00 00 00 00]
[75 09 00 00] [9B F6 03 00] [80 FF 80 FF] [FF FF FF FF] [00 00 80 3F] [00 00 80 3F]
Code: Select all
[00 00] [01 00] [02 00] [03 00] [02 00] [01 00]
Code: Select all
struct CUSTOMVERTEX
{
CUSTOMVERTEX(FLOAT fx, FLOAT fy, FLOAT fz, DWORD dwcolor, FLOAT fu, FLOAT fv) :
X(fx), Y(fy), Z(fz), COLOR(dwcolor), U(fu), V(fv) {}
FLOAT X, Y, Z;
DWORD COLOR;
FLOAT U, V;
};