Actions

SCHG

Difference between revisions of "Sonic Adventure DX: PC/Model Locations"

From Sonic Retro

m (Format: +<br />)
(Format: finished?)
Line 149: Line 149:
 
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!<br />
 
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!<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]].
 
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]].
 +
 +
===MATERIAL 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
 +
| 4 Bytes
 +
| Diffuse Color
 +
| in BRGA format
 +
|-
 +
| 4
 +
| 4 Bytes
 +
| Specular Color
 +
| in BRGA format
 +
|-
 +
| 8
 +
| 4 Bytes
 +
| Unknown
 +
|
 +
|-
 +
| C
 +
| Byte
 +
| Texture ID
 +
|
 +
|-
 +
| D
 +
| 4 Bytes?
 +
| Unknown
 +
|
 +
|-
 +
| 11
 +
| Byte
 +
| Unknown
 +
|
 +
|-
 +
| 12
 +
| Byte
 +
| UV Clamping
 +
|
 +
|-
 +
| 13
 +
| Byte
 +
| End of MATERIAL Struct
 +
| Always $94
 +
|}
 +
 +
===POLY Struct===
 +
A byte indicating the number of strips to load, a byte indicating the direction to read the strips in, followed by an array of shorts indicating which vertices to use.
 +
 +
===VColor Struct===
 +
An array of BGRA colors for each vertex in the strip.
 +
 +
===UV Struct===
 +
An array of two shorts representing the U and V coordinates for each vertex in the strip.
  
 
===MESH Struct===
 
===MESH Struct===
Line 172: Line 227:
 
| 4
 
| 4
 
| Pointer
 
| Pointer
| [[#Poly Data|Polys]]
+
| [[#POLY Struct|Polys]]
 
| Read notes on poly data
 
| Read notes on poly data
 
|-
 
|-
Line 195: Line 250:
  
 
===ATTACH Struct===
 
===ATTACH Struct===
 
 
{| class="prettytable"
 
{| class="prettytable"
 
!Offset||Type||Description||Notes
 
!Offset||Type||Description||Notes

Revision as of 12:55, 4 March 2010

Exclamation.svg 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
55F330 Left Shoe Toe
55F948 Left Shoe Heel
560DD0 Right Shoe Toe
5613F8 Right Shoe Heel
563D0C Right Arm Elbow
565C34 Eye Globe
569594 Head 56998C 565C34 None
5698F0 Right Eye
569CE8 Left Eye
56AD48 Body 56ADE4 569E20 None
56AF50 Root of Model (No model data) None 56AF1C None
5812AC Cutscene Head
Rolling
5729CC Root of Model (No model data) None 572998 None
Metal Sonic
58F808 Head 58FAAC 58DB0C None
591068 Root of Model (No model data) None 591034 None
Super Sonic
62C4CC Head 62C8C4 628B54 None
62DE88 Root of Model (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 DLL files, subtract 0x10000000.
For the dreamcast version, subtract 0x0C900000.

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!
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.

MATERIAL 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 4 Bytes Diffuse Color in BRGA format
4 4 Bytes Specular Color in BRGA format
8 4 Bytes Unknown
C Byte Texture ID
D 4 Bytes? Unknown
11 Byte Unknown
12 Byte UV Clamping
13 Byte End of MATERIAL Struct Always $94

POLY Struct

A byte indicating the number of strips to load, a byte indicating the direction to read the strips in, followed by an array of shorts indicating which vertices to use.

VColor Struct

An array of BGRA colors for each vertex in the strip.

UV Struct

An array of two shorts representing the U and V coordinates for each vertex in the strip.

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

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
Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information