Actions

Difference between revisions of "Shadow the Hedgehog (game)/Technical information/Spline format"

From Sonic Retro

m (Spline Point (0x20 bytes) =)
m (Black Squirrel moved page Shadow the Hedgehog/Technical information/Spline format to Shadow the Hedgehog (game)/Technical information/Spline format without leaving a redirect: Text replacement - "Shadow the Hedgehog/Technical" to "Shadow the He...)
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{back}}[[Category:Technical information]]
 +
{{cleanup}}
 
{{SCHG ShTH}}
 
{{SCHG ShTH}}
  
 
In Shadow the Hedgehog, splines are stored in PATH.PTP files located inside each stage's stgLLLL_dat.one file.<br />
 
In Shadow the Hedgehog, splines are stored in PATH.PTP files located inside each stage's stgLLLL_dat.one file.<br />
  
== File Format ==
+
==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.
 
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) ===
+
===Section 1 - Header (0x20 bytes)===
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
Line 20: Line 22:
 
| 0x08
 
| 0x08
 
| int
 
| int
| Length of array with spline headers? (sometimes it's a bit different)
+
| Length of section 5 in bytes
 
|-
 
|-
 
| 0x0C
 
| 0x0C
Line 43: Line 45:
 
|}
 
|}
  
All offsets in the file are relative to this point, 0x20.
+
All offsets in the file are relative to this position, 0x20.
  
=== Section 2 - Array of Offsets ===
+
===Section 2 - Array of Offsets===
  
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
 
| 0x00
 
| 0x00
 
| int[]
 
| int[]
| Array with offsets to splines (relative to end of header). Not sure where count is kept, maybe the game just reads it until it finds a 0 since there are a few at the end
+
| 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 ===
+
===Section 3 - Array of Spline entries===
  
=== Spline Header (0x30 bytes) ===
+
====Spline Header (0x30 bytes)====
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
Line 71: Line 77:
 
| 0x08
 
| 0x08
 
| int
 
| int
| Offset to start of point data (relative to end of header)
+
| Offset to start of point data (relative to end of file header)
 
|-
 
|-
 
| 0x0C
 
| 0x0C
 
| byte
 
| byte
| Unknown
+
| Byte Setting 1
 
|-
 
|-
 
| 0x0D
 
| 0x0D
 
| byte
 
| byte
| Unknown
+
| Byte Setting 2
 
|-
 
|-
 
| 0x0E
 
| 0x0E
 
| byte
 
| byte
| Unknown
+
| Byte Setting 3
 
|-
 
|-
 
| 0x0F
 
| 0x0F
 
| byte
 
| byte
| Unknown
+
| Byte Setting 4
 
|-
 
|-
 
| 0x10
 
| 0x10
 
| float[3]
 
| float[3]
| Maximum X, Y and Z values in points
+
| Maximum X, Y and Z values
 
|-
 
|-
 
| 0x1C
 
| 0x1C
 
| int
 
| int
| Unknown
+
| Int Setting
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| float[3]
 
| float[3]
| Minimum X, Y and Z values in points
+
| Minimum X, Y and Z values
 
|-
 
|-
 
| 0x2C
 
| 0x2C
 
| int
 
| int
| Offset to spline name (relative to end of header)
+
| Offset to spline name (relative to end of file header)
 
|}
 
|}
  
=== Spline Point (0x20 bytes) ===
+
====Spline Point (0x20 bytes)====
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
Line 115: Line 121:
 
|-
 
|-
 
| 0x0C
 
| 0x0C
| float
 
| Distance to previous point, first one is 0
 
|-
 
| 0x10
 
 
| float[3]
 
| float[3]
 
| Rotation (X, Y, Z)
 
| Rotation (X, Y, Z)
 +
|-
 +
| 0x18
 +
| float
 +
| Distance to next point, last one is 0
 
|-
 
|-
 
| 0x1C
 
| 0x1C
 
| int
 
| int
| Unknown
+
| Point Settings
 
|}
 
|}
  
=== Section 4 - Array of Spline Names ===
+
===Section 4 - Array of Spline names===
  
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
 
| 0x00
 
| 0x00
 
| string[]
 
| string[]
| Array with spline names, each spline references this by an offset, strings are 0 terminated, no padding is done
+
| 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
 
|-
 
|-
 
| -
 
| -
Line 141: Line 147:
 
|}
 
|}
  
=== Section 5 - Unknown ===
+
===Section 5 - Unknown===
I have no idea what this section does
+
I have no idea what this section does.
 +
 
 +
{| class="prettytable" style="width:auto;"
 +
!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 ===
+
===Section 6 - File Name===
{| class="prettytable"
+
{| class="prettytable" style="width:auto;"
 
!Offset||Type||Description
 
!Offset||Type||Description
 
|-
 
|-
 
| 0x00
 
| 0x00
 
| string
 
| string
| A path to a file name, possibly the file which contained spline data before compilation. Probably ignored by the game.
+
| 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.
 
|}
 
|}
  
{{SCHGuides}}
+
==References==
 +
<references />
 +
 
 +
{{ShadowOmni}}

Revision as of 15:19, 3 April 2020

Back to: Shadow the Hedgehog (game)/Technical information.
Sonicretro-round.svg This article needs cleanup.

This article needs to be edited to conform to a higher standard of article quality.
After the article has been cleaned up, you may remove this message. See How to Edit a Page for help.

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


Shadow the Hedgehog
Shadow title.png

Main page
Comparisons
Maps
Cheat codes
Credits


Manuals
Promotional material
Magazine articles
Reception
Merchandise


Development
Hidden content
Bugs
Technical information