USF format specification v0.0 INITIAL PRE-SPEC WHICH IS IN NO WAY FINAL: See PSF spec, version code 0x21. Code area: Contains sparse version of N64 ROM. ROM is 32-bit swapped. Sparse format is: 4 byte identifier: "SR64" each chunk: 4 byte little endian length (if 0 this ends the sparse file) 4 byte little endian offset n bytes data Any unspecified data is assumed to be previously loaded (for USFlib/miniUSF purposes, if never specified it is assumed zero). Reserved area contains sparse version of Project 64 1.4 save state. Save state format: (DWORD is 4-byte little endian, _int64 is 8-byte little endian) 0x000: DWORD: 0x23D8A6C8, identifier 0x004: DWORD: RDRAM size in bytes 0x008: ROM header, little endian first 0x40 bytes of ROM 0x048: DWORD: VI timer (PJ64 internal) 0x04c: DWORD: PC 0x050: 32 _int64: CPU General Purposes Registers 0x150: 32 _int64: Floating Point Registers 0x250: 32 DWORD: COP0 Registers 0x2d0: 32 DWORD: Floating Point Control Registers 0x350: _int64: HI 0x358: _int64: LO 0x360: 10 DWORD: RDRAM Registers 0x388: 10 DWORD: SP Registers 0x3b0: 10 DWORD: DP Registers 0x3d8: 4 DWORD: MI Registers 0x3e8: 14 DWORD: VI Registers 0x420: 6 DWORD: AI Registers 0x438: 13 DWORD: PI Registers 0x46c: 8 DWORD: RI Registers 0x48c: 4 DWORD: SI Registers 0x49c: 32 TLB entries (20 bytes each), see PJ64 source for format 0x71c: PIF RAM, 0x40 bytes 32-bit swapped 0x75c: RDRAM, 32-bit swapped, whatever size specified by 0x004. 0x75c+RDRAM size: 0x1000 bytes RSP DMEM, 32-bit swapped 0x175c+RDRAM size: 0x1000 bytes RSP IMEM, 32-bit swapped The _lib tag is used to open up another file which is loaded, both ROM and save state, before the current file. This behaves recursively. Either ROM or save state size can be zero and the USF will still be valid (most often the only contents of a miniUSF is a song specifier in the save state). I use only the sparse storage format and not and sort of compression because the main point of compression is to remove zero/unused bytes, which sparse accomplishes. This also allows for more efficient external compression of the files.