Jump to content

U8 Archive: Difference between revisions

From HedgeDocs
Hyper (talk | contribs)
No edit summary
Hyper (talk | contribs)
mNo edit summary
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:Arc File}}
'''''U8 Archive''''' is a hierarchical archive format developed by Nintendo during the GameCube era and was predominantly used on the Wii.


'''''Arc File''''' is the file format used for this game's packed filesystem. It's derived from Nintendo's archive format, commonly known as '''U8 Archive'''. These files are located in the <code>xenon</code>, <code>ps3</code> and <code>win32</code> directories on the game disc in a subdirectory called <code>archives</code>.
== Titles using U8 Archive ==
 
== Filesystem ==
The internal filesystem follows an organisational pattern where the directories starting from root are platform identifiers for the file formats contained within them.
{| class="wikitable"
{| class="wikitable"
|+
|+
!Identifier
!Game
!Endianness
!Platforms
!Purpose
!Usage
|-
|-
|common
|Sonic Heroes
|N/A
|PlayStation 2
|Used for files where endianness is non-applicable (e.g. files that are read manually in a specific byte order irrespective of the current platform).
| rowspan="2" |Used as the packed file system.
|-
|-
|xenon
|[[Sonic the Hedgehog (2006)]]
|Big
|Xbox 360, PlayStation 3
|Used for files that are read directly into memory and mapped to structures where big-endian byte order is expected for the Xbox 360 platform.
|-
|-
|ps3
|Sonic and the Secret Rings
|Big
| rowspan="3" |Wii
|Same as above, but for the PlayStation 3 platform.
| rowspan="2" |Used for operating system only.
|-
|-
|win32
|Sonic and the Black Knight
|Little
|-
|Used for files that are read directly into memory and mapped to structures where little-endian byte order is expected for the x86 Windows platform. These files would be read manually for endian swapping on big-endian platforms.
|[[Sonic Colors]]
|Used as the packed file system.
|-
|Sonic Colors: Ultimate
|Windows, Xbox One, PlayStation 4, Switch
|Used as the packed file system for data not covered by Godot.
|}
|}


== Specification ==
== Specification ==
TBD
=== Header ===
 
The header consists of the following data structure:
== List of Arc Files ==
{| class="wikitable"
{| class="wikitable"
|+
|+Length: 0x20
!Offset
!Type
!Name
!Name
!Description
!Description
|-
|-
|cache.arc
|0x00
|Core render scripts, event playbook, and optical camouflage noise texture
|UInt32
|Signature
|Always 0x55AA382D (big-endian) or 0x2D38AA55 (little-endian).
|-
|-
|download.arc
|0x04
|DLC episode mission and SET data
|UInt32
|FSTableOffset
|The offset of the file system table.
|-
|-
|enemy_data.arc
|0x08
|Boss textures and objects
|UInt32
|FSTableLength
|The length of the file system table (including the string pool).
|-
|-
|enemy.arc
|0x0C
|Regular enemy textures and objects
|UInt32
|DataOffset
|The offset of the file data.
|-
|-
|event_data.arc
|0x10
|Event-specific textures and objects
|UInt32[4]
|Reserved
|These fields appear to be populated in archives for '''Sonic the Hedgehog (2006)''', but this is bogus data from uninitialised memory and should be ignored.
For the sake of tooling heuristics, writing <code>0xE4F91300</code> (big-endian) to index 0 and <code>0x78013800</code> (big-endian) to index 3 would be ideal for detecting whether an archive is from that game specifically.
|}
 
=== File System ===
The file system consists of an array of the following data structure:
{| class="wikitable"
|+Length: 0x0C (or 0x10 for Sonic the Hedgehog (2006))
!Offset
!Type
!Name
!Description
|-
|-
|event.arc
|0x00
|Event-specific sounds, particles, and scripts
|Boolean (UInt8)
|IsDirectory
|Determines whether this node is a directory.
|-
|-
|game.arc
|0x01
|Actor properties, light and camera parameters
|UInt24
|NameOffset
|The offset of this node's name in the string pool.
If root, always zero.
|-
|-
|human.arc
|0x04
|NPC textures, objects, and scripts
|Union (UInt32, UInt32)
|DataOffset, ParentIndex
|
{| class="wikitable"
|+
|File
|The offset of this file's data.
|-
|-
|object.arc
|Directory
|Interactive object textures, objects, and scripts
|The index of the parent node for this directory.
If root, always zero.
|}
|-
|-
|particle_data.arc
|0x08
|Particle textures and objects
|Union (UInt32, UInt32)
|Length, NodeCount
|
{| class="wikitable"
|+
|File
|The length of this file's data.
|-
|-
|particle.arc
|Directory
|Particle definitions
|The total number of nodes in this directory.
If root, the total number of nodes in this archive.
|}
|-
|-
|player_*.arc
|0x0C
|Player-specific textures, objects, and animations
|UInt32
|UncompressedLength
|This field is unique to archives for '''Sonic the Hedgehog (2006)'''.
{| class="wikitable"
|+
|File
|The uncompressed length of this file's data.
This field can be set to zero to disable compression for this file, allowing its data to be stored uncompressed.
|-
|-
|player.arc
|Directory
|Player scripting and packages
|Undefined.
|-
Much like the reserved bytes in the header, this field will appear to be populated, but again, this is bogus data from uninitialised memory.
|radarmap.arc
|}
|Mini-map objects, colour textures, and icons
|-
|scripts.arc
|Most Lua scripting, SETs and paths
|-
|shader_lt.arc
|Multiplayer shaders
|-
|shader.arc
|Singleplayer shaders
|-
|sound.arc
|Common sound banks
|-
|sprite.arc
|UI textures, layouts, and animations
|-
|stage_*.arc
|Stage-specific textures and objects
|-
|stage.arc
|Reflection areas and stage collision
|-
|system.arc
|
|-
|text.arc
|Font textures, maps, and string tables
|}
|}
The total number of nodes to read is determined by the root node's <code>NodeCount</code> field. As this is a hierarchical file system, nodes should be read recursively to build the file system correctly.
The first node '''must''' be a root node defined as a directory, with the <code>NodeCount</code> field set to the total number of nodes in the archive. This is necessary for determining the length of the file system table.
=== String Pool ===
The string pool offset can be calculated after reading the root node and using the following expression:<syntaxhighlight lang="text">
FSTableOffset + (Root.NodeCount * FSNodeSize) // FSNodeSize = 0x0C (or 0x10 for Sonic the Hedgehog (2006))
</syntaxhighlight>Each string in the pool is ASCII-encoded and null-terminated, the offsets to which are relative to the start of the pool.
The string pool '''must''' have a single null terminator at the beginning for the root node, as it does not have a name.
=== File Data ===
Files are aligned by 32 bytes per file after the string pool.
In '''Sonic the Hedgehog (2006)''', files may be compressed using [[wikipedia:Zlib|zlib]]. This compression is optional, and files can be stored uncompressed so long as <code>UncompressedLength</code> is set to zero.
[[Category:File Formats]]

Latest revision as of 20:37, 2 December 2025

U8 Archive is a hierarchical archive format developed by Nintendo during the GameCube era and was predominantly used on the Wii.

Titles using U8 Archive

Game Platforms Usage
Sonic Heroes PlayStation 2 Used as the packed file system.
Sonic the Hedgehog (2006) Xbox 360, PlayStation 3
Sonic and the Secret Rings Wii Used for operating system only.
Sonic and the Black Knight
Sonic Colors Used as the packed file system.
Sonic Colors: Ultimate Windows, Xbox One, PlayStation 4, Switch Used as the packed file system for data not covered by Godot.

Specification

Header

The header consists of the following data structure:

Length: 0x20
Offset Type Name Description
0x00 UInt32 Signature Always 0x55AA382D (big-endian) or 0x2D38AA55 (little-endian).
0x04 UInt32 FSTableOffset The offset of the file system table.
0x08 UInt32 FSTableLength The length of the file system table (including the string pool).
0x0C UInt32 DataOffset The offset of the file data.
0x10 UInt32[4] Reserved These fields appear to be populated in archives for Sonic the Hedgehog (2006), but this is bogus data from uninitialised memory and should be ignored.

For the sake of tooling heuristics, writing 0xE4F91300 (big-endian) to index 0 and 0x78013800 (big-endian) to index 3 would be ideal for detecting whether an archive is from that game specifically.

File System

The file system consists of an array of the following data structure:

Length: 0x0C (or 0x10 for Sonic the Hedgehog (2006))
Offset Type Name Description
0x00 Boolean (UInt8) IsDirectory Determines whether this node is a directory.
0x01 UInt24 NameOffset The offset of this node's name in the string pool.

If root, always zero.

0x04 Union (UInt32, UInt32) DataOffset, ParentIndex
File The offset of this file's data.
Directory The index of the parent node for this directory.

If root, always zero.

0x08 Union (UInt32, UInt32) Length, NodeCount
File The length of this file's data.
Directory The total number of nodes in this directory.

If root, the total number of nodes in this archive.

0x0C UInt32 UncompressedLength This field is unique to archives for Sonic the Hedgehog (2006).
File The uncompressed length of this file's data.

This field can be set to zero to disable compression for this file, allowing its data to be stored uncompressed.

Directory Undefined.

Much like the reserved bytes in the header, this field will appear to be populated, but again, this is bogus data from uninitialised memory.

The total number of nodes to read is determined by the root node's NodeCount field. As this is a hierarchical file system, nodes should be read recursively to build the file system correctly.

The first node must be a root node defined as a directory, with the NodeCount field set to the total number of nodes in the archive. This is necessary for determining the length of the file system table.

String Pool

The string pool offset can be calculated after reading the root node and using the following expression:

FSTableOffset + (Root.NodeCount * FSNodeSize) // FSNodeSize = 0x0C (or 0x10 for Sonic the Hedgehog (2006))

Each string in the pool is ASCII-encoded and null-terminated, the offsets to which are relative to the start of the pool.

The string pool must have a single null terminator at the beginning for the root node, as it does not have a name.

File Data

Files are aligned by 32 bytes per file after the string pool.

In Sonic the Hedgehog (2006), files may be compressed using zlib. This compression is optional, and files can be stored uncompressed so long as UncompressedLength is set to zero.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.