Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

← Gotcha Force

This article is about the AFS file format. See AFS (Gotcha Force) for current research on Gotcha Force AFS.


This file format is almost completely documented.
The structure of this file is well known.


The AFS file format allows to pack a group of files sometimes in folders in one unique file. There is no compression. Each element (packed files or AFS system files) is aligned to block of 0x800 bytes. Except for packed files AFS system files are in Little Endian.

An AFS file can be divided into 4 parts:

  1. The Header:
Offset Value Observation
0x0 u32 Magic number = "AFS\x00" or "AFS\x20"
0x4 u32 Total number of packed files
  1. The Table Of Content (TOC):
    • It's an array of couples:
      • 4 bytes: file offset
      • 4 bytes: file length
    • After this array we can find 3 configurations:
      • We find the offset of the Filename Directory (FD) (4 bytes) and its length (4 bytes).
      • We find a padding (NULL bytes) and then the offset of the FD (4 bytes) and its length (4 bytes).
      • There is no FD (no offset nor length).
  2. The files area containing all packed files
  3. Le Filename Directory (FD) where we found for each file:
    • 32 bytes: file name or path padded with NULL bytes
    • 2 bytes: years
    • 2 bytes: months
    • 2 bytes: days
    • 2 bytes: hours
    • 2 bytes: minutes
    • 2 bytes: seconds
    • 4 bytes: in some AFS we found the length of the file, in some others we found file_offset, file_len, file_offset, file_len ... for every file entry of the FD taking TOC entries in the order. And finally in some AFS this field has a fixed value or random values.

The FD is not present in all AFS. When present we can find multiple files with the same names and sharing sames data areas or not. The filename can also contain relative or absolute file paths "../data/file" like found in the game "Kidou Senshi Gundam - Gundam vs. Z Gundam (Japan)".

The AFS is handled by the main executable (boot.dol). So in theory files could be retrieved by 3 different ways that could also be mixed:

  • Get the file by index: the index of the offset/length in the TOC.
  • Get the file by name in the FD.
  • Get the file by a relative offset from the start of the AFS / somewhere in memory / DVD. This method is conceivable since align is the same for multiple file format packed in the DVD: MDT/PZZ and AFS (0x800). The retrieval of the length would be easy using different methods (headers and so on.).

The Virtual World RE afstool.py allow rebuilding the AFS by adding a folder tree and changing every parameters with 4 rebuild strategies: auto, index, offset, mixed.