Actions

SCHG

Difference between revisions of "Sonic Heroes/EXE Editing"

From Sonic Retro

(Material Functions)
(Material Functions)
Line 213: Line 213:
 
|1B
 
|1B
 
|Byte
 
|Byte
|Vertex Alpha
+
|Vertex Alpha Enabling
 
|00 = Disabled<br>01 = Enabled
 
|00 = Disabled<br>01 = Enabled
 
|0024C9B0 (EXE)<br>0064C9B0 (RAM)
 
|0024C9B0 (EXE)<br>0064C9B0 (RAM)
Line 262: Line 262:
 
!Offsets||RAM Offsets||Default Values||Applies on||Notes
 
!Offsets||RAM Offsets||Default Values||Applies on||Notes
 
|-
 
|-
|0001BA94 - Z-testing<br>0001BA9E - Z-writing<br>0001BAA9 - Fog<br>0001BAB3 - Culling<br>0001BACC - Source Blend #1<br>0001BAD5 - Destination Blend #1<br>0001BAD9 - Source Blend #2<br>0001BAE3 - Destination Blend #2
+
|0001BA94 - Z-testing<br>0001BA9E - Z-writing<br>0001BAA9 - Fog Enabling<br>0001BAB3 - Culling<br>0001BACC - Source Blend #1<br>0001BAD5 - Destination Blend #1<br>0001BAD9 - Source Blend #2<br>0001BAE3 - Destination Blend #2
|0041BA94 - Z-testing<br>0041BA9E - Z-writing<br>0041BAA9 - Fog<br>0041BAB3 - Culling<br>0041BACC - Source Blend #1<br>0041BAD5 - Destination Blend #1<br>0041BAD9 - Source Blend #2<br>0041BAE3 - Destination Blend #2
+
|0041BA94 - Z-testing<br>0041BA9E - Z-writing<br>0041BAA9 - Fog Enabling<br>0041BAB3 - Culling<br>0041BACC - Source Blend #1<br>0041BAD5 - Destination Blend #1<br>0041BAD9 - Source Blend #2<br>0041BAE3 - Destination Blend #2
 
|0001BA94 - 00<br>0001BA9E - 00<br>0001BAA9 - 00<br>0001BAB3 - 01<br>0001BAD5 - 02<br>0001BAD5 - 06<br>0001BAD9 - 05<br>0001BAE3 - 02
 
|0001BA94 - 00<br>0001BA9E - 00<br>0001BAA9 - 00<br>0001BAB3 - 01<br>0001BAD5 - 02<br>0001BAD5 - 06<br>0001BAD9 - 05<br>0001BAE3 - 02
 
|Warp Effects
 
|Warp Effects
Line 297: Line 297:
 
|Thunder lightening with skulls
 
|Thunder lightening with skulls
 
|
 
|
 +
|-
 +
|002396AD - Source Blend<br>002396B6 - Destination Blend<br>002396BF - Culling<br>002396CB - Null Material<br>002396D4 - Vertex Alpha Enabling<br>002396DD - Fog Enabling
 +
|006396AD - Source Blend<br>006396B6 - Destination Blend<br>006396BF - Culling<br>006396CB - Null Material<br>006396D4 - Vertex Alpha Enabling<br>006396DD - Fog Enabling
 +
|002396AD - 05<br>002396B6 - 02<br>002396BF - 01<br>002396CB - 00<br>002396D4 - 01<br>002396DD - 00
 +
|Character Trail Effects
 
|}
 
|}
  
 
{{SCHGuides}}
 
{{SCHGuides}}
 
[[Category:Sonic Community Hacking Guide]]
 
[[Category:Sonic Community Hacking Guide]]

Revision as of 23:44, 13 February 2017

SCHG: Sonic Heroes
Main Article
Mechanic Editing

DOL Editing
EXE Editing
Music Pointers
Object Parameter Data
Relocatable Editing (PC)
File Offsets

Model Editing
Collision Format
Model Format
Level Editing

Camera Editing
Event Editing
ID list
Indirect Editing
Light Editing
Level List
Object Editing
Object Porting
Spline Editing
Texture Animation Editing
Visibility Editing

Particle Editing
Particle Editing
Sound Editing
Music List

Sound Editing
Voices

SCHG How-Tos

Custom Object Material Effect Tutorial
Level Editing Tutorial


The main EXE of the PC game is Tsonic_win.exe. The EXE is little endian. The pointer key is 0x400000; to find where a pointer points to, you must subtract that from its value.

Start/End Positions

Start Positions

List of single player start positions begins at 0x3C2FC8. Each level array has the first 4 bytes setting the level number at the first byte and five 0x1C entries for the four teams and Super Hard (although the Super Hard entry seems to be ignored, it uses Team Sonic's instead). Note that the level IDs used are not the same ones as the level and object lists, they are the ones used in RAM, for example Seaside Hill is 02

Start position entry:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Offset Type Description
0x00 Float X Position
0x04 Float Y Position
0x08 Float Z Position
0x0C Word Pitch (direction)
0x14 Byte Mode
00: Normal
01: Running
02: Rail
0x18 Word Hold time
Time spent running

Ending Positions

List of ending positions begins at 0x3C45B8. These are the places where each team does their victory animation and the results are displayed, after the mission is finished. Each level array has the first 4 bytes setting the level number at the first byte and five 0x14 entries for the four teams and Super Hard. This section has data for single player and multiplayer modes.

End position entry:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Offset Type Description
0x00 Float X Position
0x04 Float Y Position
0x08 Float Z Position
0x0C Word Camera pitch
Angle from which the characters are seen
0x0E Word ? (Always FF FF)
0x10 Long Null

Multiplayer Positions

List of multiplayer start positions begins at 0x3C5E18, after the ending positions. This section has data for the Team Battles and each multiplayer level. The entries are the same as single player start positions, but only have two position entries instead of 5, for the first and second players.

List of multiplayer "bragging" positions begins at 0x3C6380, after the multiplayer start positions. These are the positions where each team makes a comment to the other one, before the multiplayer match starts. This section only has data for each multiplayer level, not the Team Battles. The entries follow the same format as single player ending positions, with five entries.

Splines (incomplete)

Splines set path data for autoloops, rails and probably other path data. The arrays for each level are located in various different places in the EXE. What is known is that each level has a list of pointers. Each pointer points to a spline header, which is defined below. Each spline header points to its list of vertices.

A search reveals there are apparently 62 autoloops and 1075 rails in the entire game. It's possible that some paths are made of multiple splines though.

Grand Metropolis pointer list starts at 0x4B5B60. There are 12 pointers in it. It's not known what points to this list yet. The headers for the splines themselves are just before this pointer list.

Header entry:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Offset Type Description
0x00 Word Always 01 00
0x02 Word Number of vertices
0x04 Float Total length of spline
0x08 Pointer (Long) Pointer to first vertex of spline
0x0C Pointer (Long) Type of spline
0x433970 (Autoloop)
0x4343F0 (Rail)

Point entry:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Offset Type Description
0x00 Long Unknown flags (speed?)
0x04 Float Distance to next point
Last one is 0
0x08 Float X Position
0x0C Float Y Position
0x10 Float Z Position


Material Functions

A number of code sections contain additional materials/graphic codes rendered via Renderware engine that provides special effects to an object such as Espio's invisibility. Function entry:

Regular Material function:

6A 00 6A 00
Offset Type Description
0x00 and 0x02 Byte Always 6A
0x01 Byte Material value
0x03 Byte Material function type

4 Byte Material function:

68 00000000
Offset Type Description
0x00 Byte Always 68
0x01 4 Bytes Material value (Example: AB000000)

A list of material types are implemented in the EXE.

Hexadecimal values Alternative Hexidecial values Hexadecimal type Description Values Call Address Alternative Call Address Examples
01 Byte Null 00 (values upon this will crash the game) 0024C9B0 (EXE)
0064C9B0 (RAM)
6A 00 6A 01
08 Byte Z-buffer writing 00 = Disabled
01 = Enabled
0024C9B0 (EXE)
0064C9B0 (RAM)
6A 01 6A 08
0A & 0B 13 & 14 Byte Source Blend
Destination Blend
01 = rwBLENDZERO
02 = rwBLENDONE
03 = rwBLENDSRCCOLOR
04 = rwBLENDINVSRCCOLOR
05 = rwBLENDSRCALPHA
06 = rwBLENDINVSRCALPHA
07 = rwBLENDDESTALPHA
08 = rwBLENDINVDESTALPHA
09 = rwBLENDDESTCOLOR
0A = rwBLENDINVDESTCOLOR
0B = rwBLENDSRCALPHASAT
0024C9B0 (EXE)
0064C9B0 (RAM)
00247980 (EXE)
00647980 (RAM)
6A 05 6A 0A
6A 06 6A 0B

6A 05 6A 13
6A 06 6A 14
0C 1B Byte Vertex Alpha Enabling 00 = Disabled
01 = Enabled
0024C9B0 (EXE)
0064C9B0 (RAM)
00247980 (EXE)
00647980 (RAM)
6A 01 6A 0C
0E Byte Fog 00 = Disabled
01 = Enabled
0024C9B0 (EXE)
0064C9B0 (RAM)
6A 00 6A 0E
14 16 Byte Cull Mode 01 = None
02 = Back
03 = Front
0024C9B0 (EXE)
0064C9B0 (RAM)
00247980 (EXE)
00647980 (RAM)
6A 02 6A 14
6A 02 6A 16
19 Byte Alpha Testing 01 = rwALPHATESTFUNCTIONNEVER
02 = rwALPHATESTFUNCTIONLESS
03 = rwALPHATESTFUNCTIONEQUAL
04 = rwALPHATESTFUNCTIONLESSEQUAL
05 = rwALPHATESTFUNCTIONGREATER
06 = rwALPHATESTFUNCTIONNOTEQUAL
07 = rwALPHATESTFUNCTIONGREATEREQUAL
08 = rwALPHATESTFUNCTIONALWAYS
00247980 (EXE)
00647980 (RAM)
6A 08 6A 19
000000AB 4 Bytes Blend Equation 01 = Add
02 = Subtract
03 = Reverse Subtract
04 = Min
05 = Max
00247980 (EXE)
00647980 (RAM)
6A 01 68 AB000000

Known Offsets

A list shows offsets for special material effects that were discovered in the EXE.

Offsets RAM Offsets Default Values Applies on Notes
0001BA94 - Z-testing
0001BA9E - Z-writing
0001BAA9 - Fog Enabling
0001BAB3 - Culling
0001BACC - Source Blend #1
0001BAD5 - Destination Blend #1
0001BAD9 - Source Blend #2
0001BAE3 - Destination Blend #2
0041BA94 - Z-testing
0041BA9E - Z-writing
0041BAA9 - Fog Enabling
0041BAB3 - Culling
0041BACC - Source Blend #1
0041BAD5 - Destination Blend #1
0041BAD9 - Source Blend #2
0041BAE3 - Destination Blend #2
0001BA94 - 00
0001BA9E - 00
0001BAA9 - 00
0001BAB3 - 01
0001BAD5 - 02
0001BAD5 - 06
0001BAD9 - 05
0001BAE3 - 02
Warp Effects
0001E0D1 - Source Blend
0001E0DA - Destination Blend
0041E0D1 - Source Blend
0041E0DA - Destination Blend
0001E0D1 - 05
0001E0DA - 06
Main HUD interface
001D2B99 - Source Blend
001D2BA2 - Destination Blend
005D2B99 - Source Blend
005D2BA2 - Destination Blend
001D2B99 - 05
001D2BA2 - 02
Espio's Invisibility
000FEE13 - Source Blend
000FEE1C - Destination Blend
000FEE25 - Culling
004FEE13 - Source Blend
004FEE1C - Destination Blend
004FEE25 - Culling
000FEE13 - 02
000FEE1C - 02
000FEE25 - 01
Mystic Mansion Lights
00103401 - Source Blend
00103409 - Destination Blend
00103412 - Culling
00503401 - Source Blend
00503409 - Destination Blend
00503412 - Culling
00103401 - 02
00103409 - 02
00103412 - 01
Teleporter Switch Glowing Symbols
00107BE4 - Source Blend
00107BED - Destination Blend
00107BF6 - Culling
00507BE4 - Source Blend
00507BED - Destination Blend
00507BF6 - Culling
00107BE4 - 05
00107BED - 02
00107BF6 - 01
Thunder lightening with skulls
002396AD - Source Blend
002396B6 - Destination Blend
002396BF - Culling
002396CB - Null Material
002396D4 - Vertex Alpha Enabling
002396DD - Fog Enabling
006396AD - Source Blend
006396B6 - Destination Blend
006396BF - Culling
006396CB - Null Material
006396D4 - Vertex Alpha Enabling
006396DD - Fog Enabling
002396AD - 05
002396B6 - 02
002396BF - 01
002396CB - 00
002396D4 - 01
002396DD - 00
Character Trail Effects
Sonic Community Hacking Guide
General
Sonic Music Hacking Guide | SonED2 Manual
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic Eraser | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Nick Arcade prototype) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (8-bit) | Sonic 2 & Knuckles | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Sonic 3 | Sonic & Knuckles | Sonic the Hedgehog 3 & Knuckles | Sonic & Knuckles Collection | Sonic Crackers | Sonic 3D: Flickies' Island | Chaotix | Sonic R PC | Sonic Jam 6 | Sonic Advance | Sonic Advance 2 | Sonic Advance 3 | Sonic Battle | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Shuffle | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Shadow the Hedgehog | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Lost World | Sonic Forces
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 | Subroutine Equivalency List | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | VDP Documentation | Official Sega 32X Documentation | Official Mega-CD Documentation | Official Sega Mega Drive Documentation