RARC stands for Revolution ARChive. These files make up a majority of the files that you see on the game's disc, under the extension .arc. RARC files are archives, containing multiple files and folders inside. This format was also used on the Nintendo GameCube.
Below you'll find helpful tables on how the file is structured
Each RARC starts with a header
|0x00||String||"RARC" in ASCII|
|0x04||UInt32||Size of the entire file|
|0x08||UInt32||Data Header Offset (Always 0x20)|
|0x0C||UInt32||Offset to the File Data section minus 0x20|
|0x10||UInt32||Length of the File Data section|
|0x14||UInt32||Size of all the MRAM Files in the File Data section|
|0x18||UInt32||Size of all the ARAM Files in the File Data section|
|0x1C||UInt32||Size of all the DVD Files in the File Data section|
This section has information on the entire archive
|0x00||UInt32||The number of Directory Nodes|
|0x04||UInt32||Offset to the Directory Nodes section minus 0x20 (always 0x20)|
|0x08||UInt32||The number of File Nodes|
|0x0C||UInt32||Offset to the File Nodes section minus 0x20|
|0x10||UInt32||Size of the String Table|
|0x14||UInt32||String Table offset minus 0x20|
|0x18||UInt16||The next available File Index|
|0x1A||bool||Keeps the File ID's Synced (Always 0x01, or TRUE in SMG)|
|0x1B||UInt8||Padding, All 0x00's|
Directory Node section
This section is a list of information for each folder (or, subdirectory) in the archive.
Each list entry looks like this:
|0x00||String||The first 4 characters in the Directory's name in all caps.|
Example: "RootFolder" = "ROOT", and "Tmp" = "TMP " (Names less than 4 characters are padded to 4 characters with spaces)
|0x04||UInt32||Offset to the Directory's name in the String Table|
|0x08||UInt16||Hash of the Directory's name|
|0x0A||UInt16||The number of File Nodes in this directory|
|0x0C||UInt32||Offset to the first File Node in the File Nodes section|
File Node section
This section is a list of information for each file in the archive. It also contains entries for directories so we can know which directory belongs where.
Each list entry looks like this:
|0x00||UInt16||Node Index (0xFFFF if this entry represents a subdirectory)|
|0x02||UInt16||Hash of the Node's name|
|0x04||UInt8 Bitfield||Defines certain Node Attributes. See the Node Attributes table below.|
|0x06||UInt16||Offset to the Node's name in the String Table|
|0x08||UInt32||If this node represents a file: Offset to the File's Data in the File Data section.|
If this node represents a directory: Directory Node section index to use
|0x0C||UInt32||If this node represents a file: Size of the File's Data.|
If this node represents a directory: The size of the Directory Node (always 0x10)
|0x01||FILE||This node is a File|
|0x02||DIRECTORY||This node is a Directory|
|0x04||COMPRESSED||This node's file is compressed|
|0x10||PRELOAD_TO_MRAM||Set the file to be loaded into Main RAM|
|0x20||PRELOAD_TO_ARAM||Set the file to be loaded into Auxiliary RAM (GameCube only)|
|0x40||LOAD_FROM_DVD||Set the file to be loaded right off the DVD when needed|
|0x80||YAZ0_COMPRESSED||This node's file is specifically YAZ0 compressed. Enable the COMPRESSED flag as well when using this|
Among the File Nodes are nodes for a ".." and "." directory. The "." entry points to the current directory, and the ".." directory points to the parent directory (or 0xFFFFFFFF if the current directory is the topmost directory).
This section is composed of NULL-terminated ASCII strings. The above information references these strings.
File Data section
This section is a chunk of all the data that files in the archive contain. Files are sorted in a specific order, and are padded to the nearest 32 byte boundary.
The sorting order is MRAM Files then ARAM Files then DVD Files.