Capcom's MtFramework MOD format research
Apr 8, 2016 12:26:19 GMT 10
JacobMrox, , and 3 more like this
Post by bastien on Apr 8, 2016 12:26:19 GMT 10
Here's documentation about Capcom's MOD format compiled from various sources, mostly research by Surveyor, revelation, chrrox, Rick and shadowmoy among others.
The research back in 2008 was useful to make good enough importers, for example, Noesis has been supporting Resident Evil 5 since then. However, the situation for exporters is a little more complicated, since some unknowns make developing tools a bit of a pain, resulting in unstable hacks to fill the unknowns, or in limitations for quality mods (e.g. materials).
The goal of this post is to continue the research to fill the unknowns, updating it with new discoveries. My focus right now is Resident Evil 5, since I'm developing a tool for a simpler import/export workflow, that hopefully can be done for other RE games. Below there's information about the structures and points I got stuck in. The more the format is figured out, the better tools can be developed.
Previous discussions:
Current tools:
----Structures (last updated: 2016-04-04)-----
Mod version 156 (Resident Evil 5)
Mod version 210 (Resident Evil 0HD, 1HD, Revelations)
Bone
BoneMap
Group
Material
Mesh156
Mesh210
TODO: add structures of vertices
The research back in 2008 was useful to make good enough importers, for example, Noesis has been supporting Resident Evil 5 since then. However, the situation for exporters is a little more complicated, since some unknowns make developing tools a bit of a pain, resulting in unstable hacks to fill the unknowns, or in limitations for quality mods (e.g. materials).
The goal of this post is to continue the research to fill the unknowns, updating it with new discoveries. My focus right now is Resident Evil 5, since I'm developing a tool for a simpler import/export workflow, that hopefully can be done for other RE games. Below there's information about the structures and points I got stuck in. The more the format is figured out, the better tools can be developed.
Previous discussions:
Current tools:
----Structures (last updated: 2016-04-04)-----
Mod version 156 (Resident Evil 5)
| name | type | size |
|----------------------|------------|---------------------------------------------------------|
| id_magic | char[4] | 4 |
| version | ubyte | 1 |
| version_rev | ubyte | 1 |
| bone_count | ushort | 2 |
| mesh_count | ushort | 2 |
| material_count | ushort | 2 |
| vertex_count | ushort | 2 |
| face_count | ushort | 2 |
| edge_count | ushort | 2 |
| vertex_buffer_size | uint | 4 |
| vertex_buffer_2_size | uint | 4 |
| texture_count | uint | 4 |
| group_count | uint | 4 |
| bones_offset | uint | 4 |
| groups_offset | uint | 4 |
| materials_offset | uint | 4 |
| meshes_offset | uint | 4 |
| vertex_buffer_offset | uint | 4 |
| index_buffer_offset | uint | 4 |
| reserved_01 | uint | 4 |
| reserved_02 | uint | 4 |
| sphere_xyzw | float[4] | 16 |
| box_min_xyzw | float[4] | 16 |
| box_max_xyzw | float[4] | 16 |
| unk_01 | uint | 4 |
| unk_02 | uint | 4 |
| unk_03 | uint | 4 |
| unk_04 | uint | 4 |
| unk_05 | uint | 4 |
| unk_06 | uint | 4 |
| unk_07 | uint | 4 |
| unk_08 | uint | 4 |
| unk_09 | uint | 4 |
| unk_10 | uint | 4 |
| unk_11 | uint | 4 |
| reserved_03 | uint | 4 |
| unk_12 | ubyte[] | mod.bones_array_offset - 176 if mod.unk_08 else 0 |
| bones | Bone[] | mod.bone_count * sizeof(Bone) |
| bones_unk_1 | float[][] | float * 16 * mod.bone_count |
| bones_unk_2 | float[][] | float * 16 * mod.bone_count |
| unk_13 | ubyte[] | 256 if mod.bone_map_count else 0 |
| bone_maps | BoneMap[] | mod.bone_map_count * sizeof(BoneMap) |
| groups | Group[] | mod.group_count * sizeof(Group) |
| textures | char[] | char * 64 * mod.texture_count |
| materials | Material[] | mod.material_count * sizeof(Material) |
| meshes | Mesh156[] | mod.mesh_count * sizeof(Mesh156) |
| meshes_unk_buffer | ubyte | sum(mesh.vertex_group_count for mesh in mod.meshes) + 4 |
| vertex_buffer | ubyte[] | mod.vertex_buffer_size |
| vertex_buffer_2 | ubyte[] | mod.vertex_buffer_2_size |
| index_buffer | ushort[] | 2 * (mod.face_count) - 1 |
Mod version 210 (Resident Evil 0HD, 1HD, Revelations)
| name | type | size |
|----------------------|------------|-----------------------------------------------------|
| id_magic | char[4] | 4 |
| version | ubyte | 1 |
| version_rev | ubyte | 1 |
| bone_count | ushort | 2 |
| mesh_count | ushort | 2 |
| material_count | ushort | 2 |
| vertex_count | ushort | 2 |
| face_count | ushort | 2 |
| edge_count | ushort | 2 |
| vertex_buffer_size | uint | 4 |
| vertex_buffer_2_size | uint | 4 |
| group_count | uint | 4 |
| bones_offset | uint | 4 |
| groups_offset | uint | 4 |
| materials_offset | uint | 4 |
| meshes_offset | uint | 4 |
| vertex_buffer_offset | uint | 4 |
| index_buffer_offset | uint | 4 |
| file_size | uint | 4 |
| sphere_xyzw | float[4] | 16 |
| box_min_xyzw | float[4] | 16 |
| box_max_xyzw | float[4] | 16 |
| unk_01 | uint | 4 |
| unk_02 | uint | 4 |
| unk_03 | uint | 4 |
| unk_04 | uint | 4 |
| unk_05 | uint | 4 |
| bones | Bone[] | mod.bone_count * sizeof(Bone) |
| bones_unk_1 | float[][] | float * 16 * mod.bone_count |
| bones_unk_2 | float[][] | float * 16 * mod.bone_count |
| unk_07 | ubyte[] | 256 if mod.bone_map_count else 0 |
| groups | Group[] | mod.group_count * sizeof(Group) |
| materials | uint[][32] | 32 * 4 * mod.material_count |
| meshes | Mesh210[] | mod.mesh_count * sizeof(Mesh210) |
| meshes_unk_buffer | ubyte | sum(mesh.vertex_group_count for mesh in mod.meshes) |
| vertex_buffer | ubyte[] | mod.vertex_buffer_size |
| vertex_buffer_2 | ubyte[] | mod.vertex_buffer_2_size |
| index_buffer | ushort[] | 2 * (mod.face_count) - 1 |
| file_padding | ubyte[] | TODO |
Bone
| name | type | size |
|--------------------------|----------|------|
| anim_map_index | ubyte | 1 |
| parent_index | ubyte | 1 |
| mirror_index | ubyte | 1 |
| bone_map_index | ubyte | 1 |
| unk_01 | float | 4 |
| unk_02 | float | 4 |
| location_relative_parent | float[3] | 12 |
BoneMap
| name | type | size |
|--------|-----------|------|
| size | uint | 1 |
| values | ubyte[32] | 32 |
Group
| name | type | size |
|-------------|-------|------|
| group_index | uint | 4 |
| unk_01 | float | 4 |
| unk_02 | float | 4 |
| unk_03 | float | 4 |
| unk_04 | float | 4 |
| unk_05 | float | 4 |
| unk_06 | float | 4 |
| unk_07 | float | 4 |
Material
| name | type | size |
|------------------|-----------|------|
| unk_01 | uint | 4 |
| unk_02 | uint | 4 |
| unk_03 | uint | 4 |
| unk_04 | uint | 4 |
| unk_05 | uint | 4 |
| unk_06 | uint | 4 |
| texture_indices | uint[8] | 32 |
| unk_color_values | float[26] | 104 |
Mesh156
| name | type | size |
|----------------------|--------|------|
| group_index | ushort | 2 |
| material_index | ushort | 2 |
| constant | ubyte | 1 |
| leven_of_detail | ubyte | 1 |
| unk_01 | ubyte | 1 |
| vertex_format | ubyte | 1 |
| vertex_stride | ubyte | 1 |
| unk_02 | ubyte | 1 |
| unk_03 | ubyte | 1 |
| unk_04 | ubyte | 1 |
| vertex_count | ushort | 2 |
| vertex_index_end | ushort | 2 |
| vertex_index_start_1 | uint | 4 |
| vertex_offset | uint | 4 |
| unk_05 | uint | 4 |
| face_index | uint | 4 |
| face_count | uint | 4 |
| face_offset | uint | 4 |
| unk_06 | ubyte | 1 |
| unk_07 | ubyte | 1 |
| vertex_index_start_2 | ushort | 2 |
| vertex_group_count | ubyte | 2 |
| bone_map_index | ubyte | 1 |
| unk_08 | ubyte | 1 |
| unk_09 | ubyte | 1 |
| unk_10 | ushort | 2 |
| unk_11 | ushort | 2 |
Mesh210
| name | type | size |
|--------------------|--------|------|
| unk_01 | ushort | 2 |
| vertex_count | ushort | 2 |
| unk_02 | ubyte | 1 |
| material_index | ubyte | 1 |
| leven_of_detail | ubyte | 1 |
| unk_03 | ubyte | 1 |
| unk_04 | ubyte | 1 |
| vertex_stride | ubyte | 1 |
| unk_05 | ubyte | 1 |
| vertex_index | uint | 4 |
| vertex_offset | uint | 4 |
| vertex_format | uint | 4 |
| face_index | uint | 4 |
| face_count | uint | 4 |
| face_offset | uint | 4 |
| bone_map_index | ubyte | 1 |
| vertex_group_count | ubyte | 1 |
| unk_06 | ubyte | 1 |
| unk_07 | ubyte | 1 |
| unk_08 | ubyte | 1 |
| unk_09 | ushort | 2 |
| unk_10 | ushort | 2 |
| unk_11 | uint | 4 |
TODO: add structures of vertices