Actions

Shadow the Hedgehog (game)/Technical information/Spline format

From Sonic Retro

Revision as of 16:32, 24 March 2020 by Black Squirrel (talk | contribs) (Text replacement - " Format==" to " format==")
Shadow the Hedgehog technical information
Main Article
Level Editing
Stage parameters
Stage ID list
Object layout format
Effect data
Spline format
Misc
Cutscene ID list

In Shadow the Hedgehog, splines are stored in PATH.PTP files located inside each stage's stgLLLL_dat.one file.

File format

The layout file is composed of 6 sections: the header, the array of offsets to spline entries, the array of splines, the array of spline names, and two unknown sections.

Section 1 - Header (0x20 bytes)

Offset Type Description
0x00 int Total length of file in bytes
0x04 int Offset to section 5 (relative to end of header)
0x08 int Length of section 5 in bytes
0x0C int Unknown
0x10 int Unknown
0x14 int Unknown
0x18 int Unknown
0x1C int Unknown

All offsets in the file are relative to this position, 0x20.

Section 2 - Array of Offsets

Offset Type Description
0x00 int[] Array with offsets to splines (relative to end of file header). The length of the array isn't kept anywhere, it ends with a null int.
- byte[] Padding with null bytes until file is aligned to 0x10

Section 3 - Array of Spline Entries

Spline Header (0x30 bytes)

Offset Type Description
0x00 int Amount of points in spline
0x04 float Total length of spline
0x08 int Offset to start of point data (relative to end of file header)
0x0C byte Byte Setting 1
0x0D byte Byte Setting 2
0x0E byte Byte Setting 3
0x0F byte Byte Setting 4
0x10 float[3] Maximum X, Y and Z values
0x1C int Int Setting
0x20 float[3] Minimum X, Y and Z values
0x2C int Offset to spline name (relative to end of file header)

Spline Point (0x20 bytes)

Offset Type Description
0x00 float[3] Position (X, Y, Z)
0x0C float[3] Rotation (X, Y, Z)
0x18 float Distance to next point, last one is 0
0x1C int Point Settings

Section 4 - Array of Spline Names

Offset Type Description
0x00 string[] Array with spline names, each spline references this by an offset, strings are 0 terminated, no padding is done for alignment until the last one
- byte[] Padding until file is 4-byte aligned

Section 5 - Unknown

I have no idea what this section does.

Offset Type Description
0x00 byte[] Array with one byte for each spline in the file. The first one is 0x40 and the rest are 0x41.
- byte[][] Either two or three bytes for each spline in the file. If the first byte is less than 0x80, there are two bytes. If the first byte is 0x80 or above, there are three bytes. The last of the two or three bytes is always 0x49.
- byte[] Padding until file is 4-byte aligned
- byte[8] 8 null bytes. They do not count towards the total section size specified in the header.

Section 6 - File Name

Offset Type Description
0x00 string A path to a file name, possibly the file which contained spline data before compilation. Probably ignored by the game. Zero-terminated.
- byte[]? The length of the previous string including the zero terminator is always a multiple of 0x04, so I wouldn't know if there would be more bytes to align the file to 0x04 after that as they aren't needed.

References


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