# FS_LoadArchive

## Syntax

  `#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 retrieved 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 with read access to the archive-specific address space. This function is called from within FS functions that use the archive command internally.
`write_func` | Callback function with write access to the archive-specific address space. This function is called from within FS functions that use 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 TwlROM 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 TwlROM 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, unless it was explicitly suspended by the `FS_SuspendArchive` function before running the `FS_LoadArchive` function.

## See Also

`FSArchive
FS_ARCHIVE_NAME_LEN_MAX
FS_ReleaseArchiveName
FS_UnloadArchive`

## Revision History

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

CONFIDENTIAL