The archiver (ARC/DARCH) API creates archive files and provides access to archive files.
The ARC API allows access to archive files created by the darch utility tool or the archive creation (DARCH) API.
The DARCH API collects a number of files when the application runs, putting them together in a single archive file and creating an archive file image.
Two methods of accessing archive files are described below.
1. Read the entire archive file once.
Read the entire archive file once using DVDRead(Async). To access files in the archive, open them using ARCOpen and get their address and size by calling ARCGetStartAddrInMem and ARCGetLength. Although this method is simple, it requires enough memory space to load the entire archive.
2. Load some of the files and then load each part of the archive as necessary.
You can load some of the files first, and then load each part of the archive as necessary. It is therefore necessary to pay attention to the format of the archive file. This method is described later. When loading the required parts of the file, each file inside the archive can be opened using ARCOpen just as with the first method, and then the offset and size of the file can be obtained by calling ARCGetStartOffset and ARCGetLength.
The archive file consists of three parts: the header, the FST (File Symbol Table), and the file.
The header part is 32 bytes, and includes the FST start offset, the FST size, and the file's start offset.
The size of the FST part is variable. This format is the same as used by the disk drive file system (for details, see the disk drive programming manual).
The file part includes concatenated files. Each file is padded with zeros so that each starts at a 32-byte aligned offset.
To open the archive, the header and FST must be located in memory. Thus, to load the header and FST (not the entire archive) into memory, you need the total size of the header and FST. In other words, the start offset for the file part, in one way or another. There are two methods of doing this.
1. Get the information statically
The start offset of the file part can be found by executing darch -lv arcname. Be careful because the offset changes with any changes to the archive.
2. Get the information dynamically
The start offset of the file part can be found dynamically by first reading the archive header (32 bytes). The format of the header is defined in arc.h.
typedef struct
{
unsigned int magic;
int fstStart;
int fstSize;
int fileStart;
int reserve[4];
} ARCHeader;
The fileStart member represents the offset to the file part. After this is done, first fileStart bytes can be read from the start of the archive. (Note that the header part is read twice.)
Directory access functions (ARCChangeDir, ARCGetCurrentDir, ARCOpenDir, ARCReadDir) are provided in a manner similar to DVD functions.
If the number of characters of the absolute path of the file to be archived is larger than the file size, an error is returned because sufficient buffer memory could not be allocated.
After the archive file image is created, the buffer memory area will be overwritten by the archive file image.
2009/01/15 Changed darchD to darch.
2008/05/12 Added mention of the DARCH API.
2006/05/15 Initial version.
CONFIDENTIAL