ARC API

Introduction

ARC API provides access to archive files that were made by the darchD utility tool.

Two Ways to Access an Archive File

There are two ways to access an archive file.

* Read the entire archive file at once.

You can read the entire archive file at once using DVDRead(Async). To access each file in the archive, you then need to open the file with ARCOpen(), and then get the address and length of the file by calling ARCGetStartAddrInMem() and ARCGetLength(). This is the easier way, but you need enough memory space to read the entire archive.

* Read part of the file first, and then read each portion of the archive as needed.

You can first read only part of the file, and then read each portion of the archive as needed. To do this, you need to be aware of the format of the archive file. We describe how to do this in a later section. Once you read the necessary portion of the file, you can open each file in the archive by ARCOpen(), as in the previous method, and then can get the offset and the length of the file by calling ARCGetStartOffset() and ARCGetLength().

Format of the Archive File

An archive file consists of three parts: header, FST (file symbol table), and file.

The header part is 32 bytes, and contains the FST start offset, FST size, and file start offset.

The FST part has a variable size. Its format is the same as the one used in our Optical Disc Drive file system (see the Revolution Programmer's Guide for more detail).

The file part contains concatenated files. Each file is 0-padded so that each starts from 32-byte aligned offset.

To open an archive, you must have the header and FST in memory. To load only the header and FST in memory, you need to know either the total size of the header and FST, or the start offset of the file part. There are two ways:

* Allocate statically

You can tell the start offset of the file part by executing darchD -lv arcname. However, note that if you change the archive, the offset changes as well.

* Allocate dynamically

You can dynamically tell the start offset of the file part by first reading the header (32 bytes) of the archive. 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 member fileStart is the offset of the file part. You can then read the first fileStart bytes from the beginning of the archive file (note that the header part will be read twice).

Directory functions

As with Optical Disc Drive functions, directory access functions are provided (ARCChangeDir(), ARCGetCurrentDir(), ARCOpenDir(), ARCReadDir(), etc.).

Revision History

2006/05/15 Initial version.


CONFIDENTIAL