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><CODE>$REVOLUTION_SDK_ROOT/build/demos/nanddemo</CODE></CODE> 19</p> 20 21<H2>Description</H2> 22<p>Demonstrates the procedures for creating a banner file. 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 available 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 the 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, with TexConv.exe, TGA files to a TPL file that can be used by the program, and extracting the image data from the TPL file using the TPL function.<BR>TexConv is executed through the following command.<BR> 39<BLOCKQUOTE><CODE>TexConv (TCS file) (TPL file)</CODE></BLOCKQUOTE> 40For the TexConv argument, specify the TCS script file instead of specifying the 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> The image data is stored at the path specified by <CODE>path</CODE>. <BR> Each piece of image data to use is specified by <CODE>file</CODE>. The image format to be converted is specified with <CODE>image</CODE>. 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 <CODE>x</CODE> on the right side of <CODE>texture</CODE> indicates the CLUT index. Because a CLUT does not exist for RGB5A3, it is set to <CODE>x</CODE>).<BR><BR> 45<li>Load the save banner and save icon image data.<BR><BR> The image data in the TPL file that was created in step 2 is inserted in the <CODE>NANDBanner</CODE> structure using the functions 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 the save banner image into the <CODE>NANDBanner</CODE> structure.)<BR> 48<BLOCKQUOTE><CODE>TPLGetPalette(&tplIcons, "banner_wii.tpl");<BR> tdpIcons = TPLGet(tplIcons, (u32) 0);<BR> memcpy(s_bnr.bannerTexture, tdpIcons->textureHeader->data, NAND_BANNER_TEXTURE_SIZE);<BR></CODE></BLOCKQUOTE> 49 50<BR>This extracts image data from the TPL file and stores it in the banner image data of the <CODE>NANDBanner</CODE> structure.<BR><BR> (Inserts the save icon image in the <CODE>NANDBanner</CODE> structure.)<BR> 51<BLOCKQUOTE><CODE> 52<pre> 53TPLReleasePalette(&tplIcons);<BR>TPLGetPalette(&tplIcons, "icon_yoshi.tpl");<BR> 54for (i=0; i<ICONS; i++)<BR>{<BR> tdpIcons = TPLGet(tplIcons, (u32)i); 55 memcpy(s_bnr.iconTexture[i], tdpIcons->textureHeader->data, NAND_BANNER_ICON_SIZE); 56 NANDSetIconSpeed(&s_bnr, i, NAND_BANNER_ICON_ANIM_SPEED_SLOW);<BR>}<BR> 57NANDSetIconSpeed(&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 the TPL file, and stored in the <CODE>NANDBanner</CODE> structure's icon image data.<BR>Also, the icon speed is set to <EM>slow</EM> and animation type to <EM>bounce playback</EM> here.<BR><BR> This concludes the instructions for banner file creation using TexConv.exe and TPL function.<BR><BR> Also, use of these tools and functions are not required. <BR>If not using tools and functions, have image data available and store it in the <CODE>NANDBanner</CODE> structure as follows.<BR><BR> (Insert the save banner image in the <CODE>NANDBanner</CODE> structure.) 61<BLOCKQUOTE><CODE>memcpy(s_bnr.bannerTexture, (RGB5A3, 192x64 image data), NAND_BANNER_TEXTURE_SIZE);<BR></CODE></BLOCKQUOTE> 62<BR>(Insert the save icon image into the <CODE>NANDBanner</CODE> 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 about banner file creation can also be found at the "Wii Save Data Guidelines."<BR> 65</ol> 66 67<H2>See Also</H2> 68<p class="reference"> 69<a href="../../tpl/TPLGet.html">TPLGet</a>, 70<a href="../NANDBanner.html">NANDBanner</a>, 71<a href="../NANDInitBanner.html">NANDInitBanner</a>, 72<a href="../NANDGetIconSpeed.html">NANDGetIconSpeed</a>, 73<a href="../NANDSetIconSpeed.html">NANDSetIconSpeed</a> 74</p> 75 76<H2>Revision History</H2> 77<p> 782006/10/25 Initial version. <br> 79</p> 80 81<hr><p>CONFIDENTIAL</p></body> 82</HTML> 83