1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
7<META http-equiv="Content-Style-Type" content="text/css">
8<title>FS_LoadOverlay</title>
9<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
10</head>
11
12<body>
13
14<h1 align="left">FS_LoadOverlay <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1>
15<h2>Syntax</h2>
16
17<dl>
18  <dd>
19<CODE>#include &lt;nitro/fs.h&gt;</CODE><BR> <BR> <CODE>BOOL FS_LoadOverlay(MIProcessor target, <A href="../fs_overlay_id_types.html">FSOverlayID</a> id);</CODE><br> <br>
20  </dd>
21</dl>
22<h2>Arguments</h2>
23<TABLE border="1" width="100%">
24  <TBODY>
25    <TR>
26<TD width="13%"><EM><STRONG>target</STRONG></EM></TD>
27<TD width="87%">Load target (ARM9 processor/ARM7 processor).</TD>
28    </TR>
29    <TR>
30<TD width="13%"><EM><STRONG>id</STRONG></EM></TD>
31<TD width="87%">ID of module to load.</TD>
32    </TR>
33  </TBODY>
34</TABLE>
35
36<h2>Return Values</h2>
37<p>Returns TRUE if the module is loaded properly; FALSE otherwise.</p>
38
39<H2>Description</H2>
40<P>This function loads an overlay module that is associated with a specified processor and a specified number.<br> <font color="#800000">When loading an overlay whose area conflicts with an existing loaded overlay, you must unload the previous overlay using the <code><A href="FS_UnloadOverlay.html">FS_UnloadOverlay</A></code> function.</font><br> This function is equivalent to using the <A href="../fs_overlay_info_type.html"><code>FSOverlayInfo</code></A> function to acquire overlay module information, and calling the <A href="FS_LoadOverlayImage.html"><code>FS_LoadOverlayImage</code></A> and <A href="FS_StartOverlay.html"><code>FS_StartOverlay</code></A> functions. For information about its relationship to other overlay functions that perform equivalent processes, see the following.
41<pre>
42Example:
43<font color="#008000">
44/*********************************************************
45 Overlay load method (all processes are internally equivalent)
46 *********************************************************/</font>
47
48FS_EXTERN_OVERLAY(overlay_x);
49FSOverlayID   overlay_id = FS_OVERLAY_ID(overlay_x);
50MIProcessor   target = MI_PROCESSOR_ARM9;
51
52<font color="#008000">/* Method 1: Runs everything synchronously.*/</font>
53{
54    <A href="FS_LoadOverlay.html">FS_LoadOverlay</A>(target, overlay_id);
55}
56
57<font color="#008000">/* Method 2: Runs manually in sections (synchronous) */</font>
58{
59    FSOverlayInfo  info;
60    <A href="FS_LoadOverlayInfo.html">FS_LoadOverlayInfo</A>(&amp;info, target, overlay_id);
61    <A href="FS_LoadOverlayImage.html">FS_LoadOverlayImage</A>(&amp;info);
62    <A href="FS_StartOverlay.html">FS_StartOverlay</A>(&amp;info);
63}
64
65<font color="#008000">/* Method 3: Runs everything manually (asynchronous) */</font>
66{
67    FSOverlayInfo  info;
68    <A href="FS_LoadOverlayInfo.html">FS_LoadOverlayInfo</A>(&amp;info, target, overlay_id);
69    {
70        FSFile         file;
71        FS_InitFile(&amp;file);
72        <A href="FS_LoadOverlayImageAsync.html">FS_LoadOverlayImageAsync</A>(&amp;info, &amp;file);
73        while(FS_IsBusy(&amp;file))
74        {
75            <font color="#008000">/* Process the framework or message pump */</font>
76        }
77        FS_CloseFile(&amp;file);
78    }
79    <A href="FS_StartOverlay.html">FS_StartOverlay</A>(&amp;info);
80}
81
82<font color="#008000">/* Method 4: Execute all using low-level functions */</font>
83{
84    FSOverlayInfo  info;
85    <A href="FS_LoadOverlayInfo.html">FS_LoadOverlayInfo</A>(&amp;info, target, overlay_id);
86    {
87        FSFile         file;
88        FS_InitFile(&amp;file);
89        <font color="#008000">/* Open the overlay image file directly and initialize the overlay region's memory  */</font>
90        FS_OpenFileFast(&amp;file, <a href="FS_GetOverlayFileID.html">FS_GetOverlayFileID</a>(&amp;info));
91        <a href="FS_ClearOverlayImage.html">FS_ClearOverlayImage</a>(&amp;info);
92        <font color="#008000">/*
93         * If you want to replay stream sounds in parallel,
94         * divide the application into convenient units and load.
95         */</font>
96        {
97            int len, pos;
98            int small_size = 1024 * 32;
99            for (pos = 0; pos &lt; FS_GetFileLength(&amp;file); pos += len)
100            {
101                len = FS_ReadFileAsync(&amp;file, small_size);
102                while(FS_IsBusy(&amp;file))
103                {
104                    <font color="#008000">/* Process the framework or message pump */</font>
105                }
106            }
107        }
108        FS_CloseFile(&amp;file);
109    }
110    <A href="FS_StartOverlay.html">FS_StartOverlay</A>(&amp;info);
111}
112</pre>
113
114<h2>See Also</h2>
115<p><A href="FS_LoadOverlay.html"><CODE>FS_LoadOverlay</CODE></A><BR><A href="FS_LoadOverlayImage.html"><CODE>FS_LoadOverlayImage</CODE></A><BR> <A href="FS_LoadOverlayImageAsync.html"><CODE>FS_LoadOverlayImageAsync</CODE></A><BR><A href="FS_LoadOverlayInfo.html"><CODE>FS_LoadOverlayInfo</CODE></A><BR> <A href="../fs_overlay_id_types.html"><CODE>FS_OVERLAY_ID</CODE></A><BR><A href="../fs_overlay_info_type.html"><CODE>FSOverlayInfo</CODE></A><BR><A href="FS_StartOverlay.html"><CODE>FS_StartOverlay</CODE></A><BR> <A href="FS_UnloadOverlay.html"><CODE>FS_UnloadOverlay</CODE></A></p>
116
117<H2>Revision History</H2>
118<P>
1192008/10/02 Revised the sample code.<br>2007/04/16 Added sample code.<br />2005/06/02 Changed &amp; to &amp;amp;.<br />2004/11/17 Revised sample code due to the elimination of <br>FS_RegisterOverlayToDebugger<code>.</code>2004/11/16 Partially revised sample code and added a precaution concerning <BR>FS_UnloadOverlay<code>.</code>2004/10/19 Revised part of the sample code.</code>2004/09/24 Added text to the example concerning the relationship between the various types of overlay functions.</code>2004/06/11 Made revisions reflecting the addition of overlay functions.</code>2004/04/08 Revised description due to changes in the <br>FSOverlayID<code> type.</code>2004/04/05 Revised description due to addition of <br>FSOverlayID<code>.</code>2004/04/01 Initial version.
120</P>
121<hr><p>CONFIDENTIAL</p></body>
122</html>
123