U8 Archive
Arc File is the *.arc file format used for this game's packed file system. It's derived from Nintendo's archive format, commonly known as U8 Archive. These files are located in the xenon, ps3 and win32 directories on the game disc in a subdirectory called archives.
File System
The internal file system follows an organisational pattern where the directories starting from root are platform identifiers for the file formats contained within them.
| Identifier | Endianness | Purpose |
|---|---|---|
| common | N/A | 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). |
| xenon | Big | 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 | Big | Same as above, but for the PlayStation 3 platform. |
| win32 | Little | Used for files that are read directly into memory and mapped to structures where little-endian byte order is expected for the Windows (x86) platform.
These files would be read manually for endian swapping on big-endian platforms. |
Specification
Arc File is a derivative of Nintendo's archive format, commonly known as U8 Archive. It's the same format, but with an extra field added to each file system node for uncompressed length, as Sonic Team added support for zlib compression to the format.
Header
The header consists of the following data structure:
| Offset | Type | Name | Description |
|---|---|---|---|
| 0x00 | UInt32 | Signature | Always 0x55AA382D (big-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 this game, but this is bogus data from uninitialised memory and should be ignored.
For the sake of tooling heuristics, writing |
File System
The file system consists of an array of the following data structure:
| 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 |
| ||||
| 0x08 | Union (UInt32, UInt32) | Length, NodeCount |
| ||||
| 0x0C | UInt32 | UncompressedLength |
|
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 * 16)
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 compressed using zlib compression and are aligned by 32 bytes per file after the string pool. This compression is optional, and files can be stored uncompressed so long as the uncompressed length field is set to zero.
List of Arc Files
| Name | Description |
|---|---|
| cache.arc | Core render scripts, event playbook, and optical camouflage noise texture |
| download.arc | DLC episode mission and SET data |
| enemy_data.arc | Boss textures and objects |
| enemy.arc | Regular enemy textures and objects |
| event_data.arc | Event-specific textures and objects |
| event.arc | Event-specific sounds, particles, and scripts |
| game.arc | Actor properties, light and camera parameters |
| human.arc | NPC textures, objects, and scripts |
| object.arc | Interactive object textures, objects, and scripts |
| particle_data.arc | Particle textures and objects |
| particle.arc | Particle definitions |
| player_*.arc | Player-specific textures, objects, and animations |
| player.arc | Player scripting and packages |
| 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 |