Controller Pak/Filesystem

Save data management on the Controller Pak is facilitated through a simple proprietary filesystem. Most games that support this Pak have a menu that can be accessed by holding START while turning on the N64. In all official and unofficial Controller Paks, there are 32,768 bytes of SRAM available, which is split into 256-byte sectors referred to as "pages". This allows for a maximum capacity of 128 pages, 5 of which are reserved for the filesystem data, and the remaining 123 for user software. A software can create one or more save files, up to a total of 16 files, referred to as "notes".

Page 0: ID Sector
The ID sector primarily houses basic identifying and system information for the file system and the specific Controller Pak.

The first 32-bytes of the ID Sector is known as the Label. It was never officially used nor were its specifications ever supplied to developers. It is implied to be a sort of text-based label or tag. In practice, only garbage data is ever written here during a repair operation, or as a side-effect from example code being copy-pasted to produce the numbers 0 to 32.

The 32-byte ID block provides system information such as the serial number, device ID, the capacity of the media, and two protective checksums. In total, four identical copies of the ID block are stored in this sector in case one or more become corrupted.

The serial number uniquely identifies the particular controller pak. It can be filled with random bytes or any other value that is unique across all extant controller paks.

The device ID field identifies the type of device. This is always set to 1 indicating a controller pak.

The bank size describes the capacity of the controller pak. This is always set to 1 to indicate 256 kilobits which is the only size ever produced.

The first checksum is a 16-bit big endian word computed by summing the first fourteen 16-bit words in the structure. That is every word in the block that is not either of the checksums.

The second checksum is also a 16-bit word computed by subtracting the first checksum from the value 0xFFF2.

Page 1+2: Index Table
The Index Table is essentially a miniature representation of all 128 pages of the Controller Pak, defining which pages are allocated by way of Linked Allocation (similar to the FAT filesystem). The 256 bytes of the Index Table are split into 128 I-Nodes of two bytes in size (similar but not identical to the concept in Linux).

The first 5 I-Nodes are essentially ignored apart from a checksum in the first two bytes of the table. The remaining 123 I-Nodes represent the allocation status of user data, and can contain any of the following values: Page 2 is an identical backup to be used in case of data corruption.

Page 3+4: Note Table
The Note Table is simply a list of 16 Note entries. Each entry consists of 32 bytes and identifies the start page, game code and other data.