# FS_LoadArchive

## C Specification

  `#include <nitro/fs.h>`
  `BOOL FS_LoadArchive(FSArchive *p_arc,
  u32 base, u32 fat, u32 fat_size, u32 fnt, u32 fnt_size,
  FS_ARCHIVE_READ_FUNC read_func,
  FS_ARCHIVE_WRITE_FUNC write_func);`

## Arguments

`p_arc` | Address of the `FSArchive` structure.
`base` | The base offset value to the archive-inherent address space. This value is obtained by the `FS_GetArchiveBase` function to make archive implementation easier.
`fat` | FAT starting-position offset to the archive-inherent address space.
`fat_size` | The archive's FAT size in bytes.
`fnt` | FNT starting-position offset to the archive-inherent address space.
`fnt_size` | The archive's FNT size in bytes.
`read_func` | Callback function for read-accessing the archive specific address space. This callback is called from within the FS function, which uses the archive command internally.
`write_func` | Callback function for write-accessing the archive specific address space. This callback is called from within the FS function, which uses the archive command internally.

## Return Values

`TRUE` if the archive is correctly loaded in the file system. `FALSE` otherwise.

## Description

Loads the archive to the file system based on the specified implementation. The archive name must have already been registered by the `FS_RegisterArchiveName` function.
Based on the given combination of arguments, the file system assumes the archive will behave as follows:
The archive has a unique data structure with linear memory that can only be accessed by `read_func` and `write_func`. The archive has a region of `fat_size` bytes starting from the position of `fat` where FAT information conforming to the NitroROM format is stored, and the data in this region can be accessed by `read_func`. The archive has a region of `fnt_size` bytes starting from the position of `fnt` where FNT information conforming to the NitroROM format is stored, and the data in this region can be accessed by `read_func`. The archive has file data in the entire region domain specified by the FAT information, and this can be accessed by `read_func`. Once this function ends successfully, a callback in the file system accesses the archive. A loaded archive can be unloaded with the `FS_UnloadArchive` function. The archive takes the valid state in the file system when this function ends successfully as long as it has not explicitly suspended by `FS_SuspendArchive` before `FS_LoadArchive` runs.

## See Also

`FSArchive, FS_ARCHIVE_NAME_LEN_MAX, FS_ReleaseArchiveName, FS_UnloadArchive`

## Revision History

06/01/2005 Added statement about callback being called from within the FS function.
11/02/2004 Corrected links.
06/30/2004 Initial version.

CONFIDENTIAL