Difference between revisions of "Sonic Adventure DX: PC/Model Locations"
From Sonic Retro
MainMemory (talk | contribs) m (→Sonic) |
MainMemory (talk | contribs) |
||
Line 79: | Line 79: | ||
| 62DE54 | | 62DE54 | ||
| None | | None | ||
+ | |} | ||
+ | |||
+ | ==Format== | ||
+ | Remember: all pointers are 4 Bytes, and need to have a key subtracted from them to find the correct location in a file.<br /> | ||
+ | For sonic.exe, subtract 0x00400000.<br /> | ||
+ | For chrmodels.dll, subtract 0x10000000.<br /> | ||
+ | For the dreamcast version, subtract 0x0C900000.<br /> | ||
+ | <br /> | ||
+ | Note: these are listed in the order they will appear in the file. However, it is likely that you will start at the [[#OBJECT Struct|OBJECT Struct]]. | ||
+ | |||
+ | ===MESH Struct=== | ||
+ | The game loads as many of these structs as indicated in the attach struct. The format is as follows. | ||
+ | {| class="prettytable" | ||
+ | !offset||Type||Description||Notes | ||
+ | |- | ||
+ | | 0 | ||
+ | | Byte | ||
+ | | Material ID | ||
+ | | | ||
+ | |- | ||
+ | | 1 | ||
+ | | Byte | ||
+ | | Poly Type | ||
+ | | Always use $C0 (strips) | ||
+ | |- | ||
+ | | 2 | ||
+ | | Short | ||
+ | | Poly Total | ||
+ | | This is how many strips to load | ||
+ | |- | ||
+ | | 4 | ||
+ | | Pointer | ||
+ | | [[#Poly Data|Polys]] | ||
+ | | Read notes on poly data | ||
+ | |- | ||
+ | | 8 | ||
+ | | Padding (0x8) | ||
+ | | PNormal and Pattr | ||
+ | | Unused by sadx, but are part of official sega model format | ||
+ | |- | ||
+ | | 10 | ||
+ | | Pointer | ||
+ | | Vertex Colors | ||
+ | | | ||
+ | |- | ||
+ | | 14 | ||
+ | | Pointer | ||
+ | | UV Coordinates | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ===VERTEX Struct=== | ||
+ | A Float[3] for each vertex, times the total specified in the [[#ATTACH Struct|ATTACH Struct]]. | ||
+ | |||
+ | ===ATTACH Struct=== | ||
+ | As a rule, data sets occur in the reverse order that these pointers do. In a non-hacked model, the model data always starts with the material structs and goes down the file to the vertex struct, with the exception of the vertex struct. The verts occur right after the mesh struct and the normals are the last data set before the attach struct. The tools sonic team used strictly followed that rule, but the game can operate outside of that constraint so make sure your pointers are always accurate. A crashing game usually means a bad pointer! | ||
+ | |||
+ | {| class="prettytable" | ||
+ | !Offset||Type||Description||Notes | ||
+ | |- | ||
+ | | 0 | ||
+ | | Pointer | ||
+ | | [[#VERTEX Struct|Vertices]] | ||
+ | | | ||
+ | |- | ||
+ | | 4 | ||
+ | | Pointer | ||
+ | | [[#VERTEX Struct|Normals]] | ||
+ | | If this is null, the model doesn't use normals. | ||
+ | |- | ||
+ | | 8 | ||
+ | | 4 Bytes | ||
+ | | Vertex/Normal Total | ||
+ | | | ||
+ | |- | ||
+ | | C | ||
+ | | Pointer | ||
+ | | [[#MESH Struct|Meshes]] | ||
+ | | | ||
+ | |- | ||
+ | | 10 | ||
+ | | Pointer | ||
+ | | [[#MATERIAL Struct|Materials]] | ||
+ | | | ||
+ | |- | ||
+ | | 14 | ||
+ | | 2 Bytes | ||
+ | | Mesh Total | ||
+ | | | ||
+ | |- | ||
+ | | 16 | ||
+ | | 2 Bytes | ||
+ | | Material Total | ||
+ | | | ||
+ | |- | ||
+ | | 18 | ||
+ | | Float[3] | ||
+ | | Center | ||
+ | | | ||
+ | |- | ||
+ | | 24 | ||
+ | | Float | ||
+ | | Radius | ||
+ | | | ||
+ | |- | ||
+ | | 28 | ||
+ | | 4 Bytes | ||
+ | | Null | ||
+ | | | ||
+ | |} | ||
+ | |||
+ | ===OBJECT Struct=== | ||
+ | {| class="prettytable" | ||
+ | !Offset||Type||Description||Notes | ||
+ | |- | ||
+ | | 0 | ||
+ | | 4 Bytes | ||
+ | | Flags | ||
+ | | ??? | ||
+ | |- | ||
+ | | 4 | ||
+ | | Pointer | ||
+ | | [[#ATTACH Struct|Attach]] | ||
+ | | | ||
+ | |- | ||
+ | | 8 | ||
+ | | Float[3] | ||
+ | | Position | ||
+ | | | ||
+ | |- | ||
+ | | 14 | ||
+ | | 4 Bytes[3] | ||
+ | | Rotation | ||
+ | | only read first 2 bytes of each | ||
+ | |- | ||
+ | | 20 | ||
+ | | Float[3] | ||
+ | | Scale | ||
+ | | | ||
+ | |- | ||
+ | | 30 | ||
+ | | Pointer | ||
+ | | [[#OBJECT Struct|OBJECT Child]] | ||
+ | | | ||
+ | |- | ||
+ | | 34 | ||
+ | | Pointer | ||
+ | | [[#OBJECT Struct|OBJECT Relate]] | ||
+ | | | ||
|} | |} | ||
{{SCHGuides}} | {{SCHGuides}} | ||
[[Category:Sonic Community Hacking Guide]] | [[Category:Sonic Community Hacking Guide]] |
Revision as of 18:31, 21 December 2009
This article is a work in progress. Its content and location may change completely and frequently until this notice is removed. |
Template:SCHG SADX:PC This page is about models.
Locations
sonic.exe
Key=0x00400000
Dr. Eggman (Cutscenes)
Address | Description | Parent | Child | Sibling |
---|---|---|---|---|
49C830 | Root of Model | None | 49C734 | None |
CHRMODELS.DLL
Key=0x10000000
Sonic
Address | Description | Parent | Child | Sibling |
---|---|---|---|---|
55E76C | Tail | 55E7D0 | None | None |
569594 | Head | 56998C | 565C34 | None |
56AD48 | Body | 56ADE4 | 569E20 | None |
56AF50 | Root of Model (No model data) | None | 56AF1C | None |
5729CC | Root of Model (Rolling) (No model data) | None | 572998 | None |
58F808 | Head (Metal) | 58FAAC | 58DB0C | None |
591068 | Root of Model (Metal) (No model data) | None | 591034 | None |
62C4CC | Head (Super) | 62C8C4 | 628B54 | None |
62DE88 | Root of Model (Super) (No model data) | None | 62DE54 | None |
Format
Remember: all pointers are 4 Bytes, and need to have a key subtracted from them to find the correct location in a file.
For sonic.exe, subtract 0x00400000.
For chrmodels.dll, subtract 0x10000000.
For the dreamcast version, subtract 0x0C900000.
Note: these are listed in the order they will appear in the file. However, it is likely that you will start at the OBJECT Struct.
MESH Struct
The game loads as many of these structs as indicated in the attach struct. The format is as follows.
offset | Type | Description | Notes |
---|---|---|---|
0 | Byte | Material ID | |
1 | Byte | Poly Type | Always use $C0 (strips) |
2 | Short | Poly Total | This is how many strips to load |
4 | Pointer | Polys | Read notes on poly data |
8 | Padding (0x8) | PNormal and Pattr | Unused by sadx, but are part of official sega model format |
10 | Pointer | Vertex Colors | |
14 | Pointer | UV Coordinates |
VERTEX Struct
A Float[3] for each vertex, times the total specified in the ATTACH Struct.
ATTACH Struct
As a rule, data sets occur in the reverse order that these pointers do. In a non-hacked model, the model data always starts with the material structs and goes down the file to the vertex struct, with the exception of the vertex struct. The verts occur right after the mesh struct and the normals are the last data set before the attach struct. The tools sonic team used strictly followed that rule, but the game can operate outside of that constraint so make sure your pointers are always accurate. A crashing game usually means a bad pointer!
Offset | Type | Description | Notes |
---|---|---|---|
0 | Pointer | Vertices | |
4 | Pointer | Normals | If this is null, the model doesn't use normals. |
8 | 4 Bytes | Vertex/Normal Total | |
C | Pointer | Meshes | |
10 | Pointer | Materials | |
14 | 2 Bytes | Mesh Total | |
16 | 2 Bytes | Material Total | |
18 | Float[3] | Center | |
24 | Float | Radius | |
28 | 4 Bytes | Null |
OBJECT Struct
Offset | Type | Description | Notes |
---|---|---|---|
0 | 4 Bytes | Flags | ??? |
4 | Pointer | Attach | |
8 | Float[3] | Position | |
14 | 4 Bytes[3] | Rotation | only read first 2 bytes of each |
20 | Float[3] | Scale | |
30 | Pointer | OBJECT Child | |
34 | Pointer | OBJECT Relate |