banner

Location

$REVOLUTION_SDK_ROOT/build/demos/nanddemo

Description

Demonstrates the procedures for creating a banner file. In this sample, the banner file is created by the following steps:

Also, in this sample TexConv.exe and the TPL function are used for the creation of save banner image and save icon image.
Its usage and the steps to display will be described below.

[Procedures]

  1. Create image file: RGB5A3 format TGA file will be created.
    The image size must be 48x48 for icons and 192x64 for banners.

  2. 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.
    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.
    TexConv is executed through the following command.
    TexConv (TCS file) (TPL file)
    For the TexConv argument, specify the TCS script file instead of specifying the TGA file directly.
    TCS will be written as follows:

    (TCS creating the save banner)
    path = ./

    file 0 = banner.tga
    image 0 = 0, 0, RGB5A3
    texture 0 = 0, x

    (TCS creating the save icon)
    path = ./

    file 0 = icon01.tga
    file 1 = icon02.tga
    file 2 = icon03.tga
    file 3 = icon04.tga

    image 0 = 0, 0, RGB5A3
    image 1 = 1, 1, RGB5A3
    image 2 = 2, 2, RGB5A3
    image 3 = 3, 3, RGB5A3

    texture 0 = 0, x
    texture 1 = 1, x
    texture 2 = 2, x
    texture 3 = 3, x

    Here, four images are used for the save icons.
    The image data is stored at the path specified by path.
    Each piece of image data to use is specified by file. The image format to be converted is specified with image. Always specify RGB5A3 here.
    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.
    (The x on the right side of texture indicates the CLUT index. Because a CLUT does not exist for RGB5A3, it is set to x).

  3. Load the save banner and save icon image data.

    The image data in the TPL file that was created in step 2 is inserted in the NANDBanner structure using the functions below.
    A code example is given below using the following functions:
    static NANDBanner s_bnr ATTRIBUTE_ALIGN(32);
    static TPLPalettePtr tplIcons;
    static TPLDescriptorPtr tdpIcons;

    (Insert the save banner image into the NANDBanner structure.)
    TPLGetPalette(&tplIcons, "banner_wii.tpl");
    tdpIcons = TPLGet(tplIcons, (u32) 0);
    memcpy(s_bnr.bannerTexture, tdpIcons->textureHeader->data, NAND_BANNER_TEXTURE_SIZE);

    This extracts image data from the TPL file and stores it in the banner image data of the NANDBanner structure.

    (Inserts the save icon image in the NANDBanner structure.)
    TPLReleasePalette(&tplIcons);
    TPLGetPalette(&tplIcons, "icon_yoshi.tpl");
    for (i=0; i<ICONS; i++)
    {
    tdpIcons = TPLGet(tplIcons, (u32)i); memcpy(s_bnr.iconTexture[i], tdpIcons->textureHeader->data, NAND_BANNER_ICON_SIZE); NANDSetIconSpeed(&s_bnr, i, NAND_BANNER_ICON_ANIM_SPEED_SLOW);
    }
    NANDSetIconSpeed(&s_bnr, ICONS, NAND_BANNER_ICON_ANIM_SPEED_END); s_bnr.flag |= NAND_BANNER_FLAG_ANIM_BOUNCE;

    Image data is extracted from the TPL file, and stored in the NANDBanner structure's icon image data.
    Also, the icon speed is set to slow and animation type to bounce playback here.

    This concludes the instructions for banner file creation using TexConv.exe and TPL function.

    Also, use of these tools and functions are not required.
    If not using tools and functions, have image data available and store it in the NANDBanner structure as follows.

    (Insert the save banner image in the NANDBanner structure.)
    memcpy(s_bnr.bannerTexture, (RGB5A3, 192x64 image data), NAND_BANNER_TEXTURE_SIZE);

    (Insert the save icon image into the NANDBanner structure.)
    memcpy(s_bnr.iconTexture[i], (RGB5A3, 48x48 image data), NAND_BANNER_ICON_SIZE);

    Detailed information about banner file creation can also be found at the "Wii Save Data Guidelines."

See Also

TPLGet, NANDBanner, NANDInitBanner, NANDGetIconSpeed, NANDSetIconSpeed

Revision History

2006/10/25 Initial version.


CONFIDENTIAL