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 http-equiv="Content-Style-Type" content="text/css">
7<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
9<title>NAND Sample Demo banner</title>
10</head>
11
12<body>
13
14<H1>banner</H1>
15
16<H2>Location</H2>
17<p>
18<CODE>$REVOLUTION_SDK_ROOT/build/demos/nanddemo</CODE>
19</p>
20
21<H2>Description</H2>
22<p>Demonstrates the procedures for creating a banner file.<BR>In this sample, the banner file is created by the following steps:
23</p>
24
25<ul>
26<li>Check for existing save banner file
27<li>Check for free space in the Wii console NAND memory
28<li>Create save banner file
29<li>Move save banner file
30</ul>
31
32<p>
33Also, in this sample TexConv.exe and TPL function are used for the creation of save banner image and save icon image.<BR>Its usage and the steps to display will be described below.<BR><BR> [Procedures]<BR>
34</p>
35
36<ol>
37<li>Create image file: RGB5A3 format TGA file will be created.<BR>The image size must be 48x48 for icons and 192x64 for banners.<BR> <BR>
38<li>Convert the created image file (TGA file) to an image data file of banner image or icon image, and integrate the resulting file into the program.<BR>This is done by converting TGA files to program usable TPL file through TexConv.exe, and extracting the image data from the TPL file using TPL function.<BR>TexConv is executed through the following command.<BR>
39<BLOCKQUOTE><CODE>TexConv (TCS file) (TPL file)</CODE></BLOCKQUOTE>
40For TexConv argument, specify TCS script file instead of specifying TGA file directly.<BR>TCS will be written as follows:<BR><BR> (TCS creating the save banner)<BR>
41<BLOCKQUOTE><CODE>path = ./<BR> <BR> file 0 = banner.tga<BR> image    0 =  0, 0, RGB5A3<BR> texture 0  =  0, x<BR></CODE></BLOCKQUOTE>
42<BR> (TCS creating the save icon)<BR>
43<BLOCKQUOTE><CODE>path = ./<BR> <BR> file 0 = icon01.tga<BR> file 1 = icon02.tga<BR> file 2 = icon03.tga<BR> file 3 = icon04.tga<BR> <BR> image    0 =  0, 0, RGB5A3<BR> image    1 =  1, 1, RGB5A3<BR> image    2 =  2, 2, RGB5A3<BR> image    3 =  3, 3, RGB5A3<BR> <BR> texture 0  =  0, x<BR> texture 1  =  1, x<BR> texture 2  =  2, x<BR> texture 3  =  3, x<BR></CODE></BLOCKQUOTE>
44<BR> Here, four images are used for the save icons.<BR> A path with an image data is specified at &quot;path.&quot;<BR> Each used image data is specified at &quot;file.&quot; <BR> Image format to be converted is specified at &quot;image.&quot; Always specify RGB5A3 here.<BR>In TexConv.exe, the index number may be specified at the right side of each, but cannot be specified when creating save banners and save icons, so always match it with the left side.<BR>(The x on the right side of texture indicates the CLUT index. Because a CLUT does not exist for RGB5A3, it will be set as x)<BR> <BR>
45<li>Read save banner and save icon image data<BR> <BR> The image data in TPL file that was created in step 2 is inserted in the NANDBanner structure using the function below.<BR>A code example is given below using the following functions:<BR>
46<BLOCKQUOTE><CODE>static NANDBanner s_bnr ATTRIBUTE_ALIGN(32); <BR> static TPLPalettePtr  tplIcons;<BR> static TPLDescriptorPtr tdpIcons;<BR></CODE></BLOCKQUOTE>
47<BR> (Insert save banner image to a NANDBanner structure)<BR>
48<BLOCKQUOTE><CODE>TPLGetPalette(&amp;tplIcons, &quot;banner_wii.tpl&quot;);<BR> tdpIcons = TPLGet(tplIcons, (u32) 0);<BR> memcpy(s_bnr.bannerTexture, tdpIcons-&gt;textureHeader-&gt;data, NAND_BANNER_TEXTURE_SIZE);<BR></CODE></BLOCKQUOTE>
49
50<BR> Image data is extracted from a tpl file, and stored to a NANDBanner structure banner image data.<BR> <BR> (Insert save icon image to a NANDBanner structure)<BR>
51<BLOCKQUOTE><CODE>
52<pre>
53TPLReleasePalette(&amp;tplIcons);<BR>TPLGetPalette(&amp;tplIcons,   &quot;icon_yoshi.tpl&quot;);<BR>
54for (i=0; i&lt;ICONS; i++)<BR>{<BR>    tdpIcons = TPLGet(tplIcons, (u32)i);
55    memcpy(s_bnr.iconTexture[i], tdpIcons-&gt;textureHeader-&gt;data, NAND_BANNER_ICON_SIZE);
56    NANDSetIconSpeed(&amp;s_bnr, i, NAND_BANNER_ICON_ANIM_SPEED_SLOW);<BR>}<BR>
57NANDSetIconSpeed(&amp;s_bnr, ICONS, NAND_BANNER_ICON_ANIM_SPEED_END);
58s_bnr.flag |= NAND_BANNER_FLAG_ANIM_BOUNCE;</pre>
59</CODE></BLOCKQUOTE>
60<BR> Image data is extracted from a TPL file, and stored to a NANDBanner structure icon image data.<BR> Also, the icon speed is set to &quot;slow&quot; and animation type to &quot;bounce playback&quot; here.<BR> <BR> This concludes the instruction for banner file creation using TexConv.exe and TPL function.<BR> Also, use of these tools and functions are not required.<BR> If not using the tools and functions, have image data available and store it in the NANDBanner structure as follows:<BR> <BR>(Insert save banner image to a NANDBanner structure)
61<BLOCKQUOTE><CODE>memcpy(s_bnr.bannerTexture, (RGB5A3, 192x64 image data), NAND_BANNER_TEXTURE_SIZE);<BR></CODE></BLOCKQUOTE>
62<BR> (Insert save icon image to a NANDBanner structure)<BR>
63<BLOCKQUOTE><CODE>memcpy(s_bnr.iconTexture[i], (RGB5A3, 48x48 image data), NAND_BANNER_ICON_SIZE);<BR></CODE></BLOCKQUOTE>
64<BR> Detailed information regarding banner file creation can also be found at the &quot;Wii Save Data Guidelines.&quot;<BR>
65</ol>
66
67<H2>See Also</H2>
68<p>
69<a href="../../tpl/TPLGet.html">TPLGet</a>, <a href="../NANDBanner.html">NANDBanner</a>, <a href="../NANDInitBanner.html">NANDInitBanner</a>, <a href="../NANDGetIconSpeed.html">NANDGetIconSpeed</a>, <a href="../NANDSetIconSpeed.html">NANDSetIconSpeed</a>
70</p>
71
72<H2>Revision History</H2>
73<p>
742006/10/25 Initial version. <BR>
75</p>
76
77<hr><p>CONFIDENTIAL</p></body>
78</HTML>
79