Filetype:File Archive

From Imagisphere
Jump to navigation Jump to search

This page is a work in progress.
As a result, the layout and/or content herein may be subject to change.

The FARC (File ARChive) format is a big-endian archive structure used by LittleBigPlanet games to store assets. It is characterized by a footer located at the end of the file which contains metadata and an entry table, while the actual file data is stored in a flat region starting from the beginning of the file.

Structure

The file is divided into two main regions: the Data Region at the start and the Footer at the end.

Footer

The footer is located at the end of the file and contains the magic value, entry count, and the entry table.

Magic

The footer begins with the 4-byte ASCII magic value FARC.

Entry Count

Immediately following the magic is a 32-bit unsigned integer in big-endian format indicating the number of files stored in the archive.

Entry Table

The entry table is stored in reverse order (i.e., the last entry in the table corresponds to the first file in the archive). Each entry in the table is 28 bytes long and contains the following fields:

Offset (relative) Length Type Description
0 20 u8[20] SHA1: The SHA-1 hash of the file content.
20 4 u32 Offset: The absolute offset of the file data from the start of the file (0x0).
24 4 u32 Size: The size of the file data in bytes.

Data Region

The data region spans from the beginning of the file (0x0) to the start of the footer. It contains the raw, uncompressed data for all files in the archive, stored contiguously.

Layout Diagram

+-----------------------+
|      Data Region      |
|   (File 0 Raw Data)   |
|   (File 1 Raw Data)   |
|         ...           |
+-----------------------+
|      Entry Table      |
|   (Entry N-1)         |
|   (Entry N-2)         |
|         ...           |
|   (Entry 0)           |
+-----------------------+
|      Entry Count      | (4 bytes, u32)
+-----------------------+
|      Magic ("FARC")   | (4 bytes, ASCII)
+-----------------------+

Example

An example of a parsed entry:

  • SHA1: a4e8420cc72103ad594afcd7093aa50caa26176f
  • Offset: 0
  • Size: 123456