Narc Archive
Last updated
Was this helpful?
Last updated
Was this helpful?
The .narc
archive is the default archive format for the Phantasy Star Zero game files. In most cases the whole file is compressed with the psz
format. So see the PSZ Compression page in order to get information on that. This documentation was written for the decompressed format of this archive.
The Archive is split into three general sections identified by a magic number with a header for each section. The magic numbers are listed as follows:
NARC
BTAF
BTNF
A short summary of each one of the files. The NARC
section describes the number of files, and the length of the whole archive. The BATF
section provides the start and end offsets for the child files in the archive. The BTNF
section can have optional filenames followed by the binary data of the child files. Because this archive is often compressed in its entirety, there is no internal compression of the child files.
The NARC
section of the archive comprises of the first 0x10 bytes of the file. The section contains a magic number, followed by two 16 bit values which are of unknown importance. Following that is 4 bytes which gives the sive of the entire archive file, following by the offset to the BTAF
section, and another 16 bit value.
Generally there is not much information that needs to be parsed from the header. Most of the value comes from the magic number indicating the file type as a NARC
archive. The BTAF
section will always follow at offset 0x10
.
#define NARC_MAGIC 0x4352414e
typedef struct {
uint32_t magic;
uint16_t a;
uint16_t b;
uint32_t archiveLength;
uint16_t headerLength;
uint16_t c;
} narcHeader_t;
0x0000
4
uint32_t
"NARC" Magic Number
0x0004
2
uint16_t
0xFFFF
0x0006
2
uint16_t
0x0100
0x0008
4
uint32_t
Archive Length
0x000c
2
uint16_t
Header Length (0x10)
0x000e
2
uint16_t
0x03
Contains a list of start and end offset for each of the child files in the archive. The section has a magic number, followed by the size of the section including the header, and the number of files. Following the header is a list of start and end offsets for each of the children files in the archive.
#define BTAF_MAGIC 0x46415442
typedef struct {
uint32_t magic;
uint32_t length;
uint32_t count;
} batfHeader_t;
typedef struct {
uint32_t startOffset;
uint32_t endOffset;
} batfFile_t;
0x0000
4
uint32_t
"BTAF" Magic Number
0x0004
4
uint32_t
BTAF Length
0x0008
4
uint32_t
File Count
The BTNF section is the final section of the archive that includes the data for each of the files. The section start soof with a small header that only includes the magic number and length. From there the section can optionally contain a list of files and directory names, with an implied root directory.
#define BTNF_MAGIC 0x464e5442;
0x0000
4
uint32_t
"BTNF" Magic Number
0x0004
4
uint32_t
BTNF Length