1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META http-equiv="Content-Style-Type" content="text/css">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
7<BASE target="main">
8<TITLE>File System</TITLE>
9<LINK rel="stylesheet" href="../css/nitro.css" type="text/css">
10<style type="text/css">
11td.supported   {border:solid 1px black;background-color:#FFFFF8}
12td.unsupported {border:solid 1px black;background-color:#C0C0C0}
13</style>
14</HEAD>
15<BODY>
16
17<H1>File System (FS) Overview</H1>
18
19<ul>
20<li><a href="#introduction">Introduction</a></li>
21<li><a href="#file">Accessing Files and Directories</a></li>
22<li><a href="#archive">Archives</a></li>
23  <ul>
24<li><a href="overview/about_Archive.html" target="_self">Standard Archives</a></li>
25      <ul>
26<li><a href="overview/about_Archive.html#ROM" target="_self">ROM Archives</a></li>
27<li><a href="overview/about_Archive.html#MEM" target="_self">Memory File Archives</a></li>
28<li><a href="overview/about_Archive.html#NAND" target="_self">NAND Archives</a></li>
29<li><a href="overview/about_Archive.html#SDMC" target="_self">SD Card Archives</a></li>
30<li><a href="overview/about_Archive.html#format" target="_self">Internal Format</a></li>
31      </ul>
32      <ul>
33<li><a href="overview/about_Archive.html#NitroROM" target="_self">NitroROM Format</a></li>
34<li><a href="overview/about_Archive.html#FAT" target="_self">FAT Format</a></li>
35      </ul>
36  </ul>
37<li><a href="#overlay" target="_self">Overlay</a></li>
38</ul>
39
40
41<h2><a name="introduction">Introduction</a></h2>
42<p>The FS library provides various functions for using file systems and overlay modules.</p>
43<p><font color="Red"><code><a href="file/FS_Init.html">FS_Init</a></code> must be called before any FS library functions are used.</font>Note that it is not called automatically within <code><a href="../os/init/OS_Init.html">OS_Init</a></code>, because the application must explicitly specify which DMA channel the FS library can use internally.</p>
44<pre style="border:1px solid black"><code>
45(Example of initialization)
46void NitroMain(void)
47{
48<font color="#008000">// Initialize OS immediately after startup.</font>
49<a href="../os/init/OS_Init.html">OS_Init()</a>;
50<font color="#008000">// Explicitly specify the DMA number and initialize the FS library.</font>
51<a href="file/FS_Init.html">FS_Init(3)</a>;
52<font color="#008000">// The FS library can be used from this point onward.</font>
53}
54</code></pre>
55
56
57<h2><a name="file">Accessing Files and Directories</a></h2>
58<p>The various file systems provided by TWL-SDK are implemented based on a common interface established by the FS library. This makes it unnecessary for game developers and library designers to write their own code to support various file systems with different specifications, thereby reducing the burden during development.</p>
59<p>
60When an application accesses a file system, in most cases file or directory handles must be opened. Prepare <code><a href="fs_file_type.html">FSFile structures</a></code> on the application side to store the opened handles, and note that they must be initialized using the <code><a href="file/FS_InitFile.html">FS_InitFile</a></code> function before use.</p>
61<p><a href="list_fs.html#file">File Access Function List</a><br /> <a href="list_fs.html#directory">Directory Access Function List</a></p>
62
63
64<h2><a name="archive">Archives</a></h2>
65<p>Individual file systems that are mounted by the FS library are referred to as &quot;archives.&quot; Conceptually, an archive is the same as a &quot;drive&quot; on a personal computer.</p>
66<p>A single directory tree structure is always stored within the ROM region for programs that are booted from DS Game Cards. With the FS library, the archive that is used to access this directory tree is mounted by the system using the name &quot;<CODE>rom:</CODE>&quot;. This archive is called the &quot;<a href="overview/about_Archive.html#ROM">ROM Archive</a>,&quot; and is the most standard type of archive with regard to programs. Depending on the type of program, the FS library may also prepare several more archives. For details, see the description in <a href="overview/about_Archive.html">Standard Archives (Overview)</a>.</p>
67<p>Beyond the standard types of archives provided by the SDK, various functions are also provided for mounting new types of archives that may be freely implemented by developers as necessary.</p>
68<p><a href="list_fs.html#archive">Archive Function List</a></p>
69
70
71<h2><a name="overlay">Overlay</a></h2>
72<p>Even for huge programs that cannot be completely resident during the boot, it is possible to load only the required parts at runtime by splitting up the individual modules as overlays. The FS library provides functions for the standard features required to load these overlay modules (getting overlay information, loading executable code, and starting constructors/destructors). Within the file system the overlay modules will be treated as a single nameless file, so if necessary, it is also possible to customize the load process with the same tweaks that can be applied when loading files normally.</p>
73<p>See <a href="../demos/fs/fsdemos.html">FS Library Sample Demos</a> and the description of the <a href="../tools/makelcf.html"><CODE>makelcf</CODE> tool</a> for information about the procedure for using overlays.</p>
74<p><a href="list_fs.html#overlay">Overlay Function List</a></p>
75
76
77<h2>See Also</h2>
78<p><a href="list_fs.html">FS Function List</a></p>
79
80<h2>Revision History</h2>
81<p>
822008/09/26 Fixed incorrectly formatted anchor tag.<br />2008/09/12 Initial version.<br />
83</p>
84
85<table border="0" height="100%"><tr><td style="background-color : white;"></td></tr></table>
86
87<hr><p>CONFIDENTIAL</p></body>
88</HTML>
89