# TWL Nmenu

## Overview

`TwlNmenu` is a TWL application that manages NAND applications in the TWL system. It can install NAND applications from TAD files on SD Cards or DS cards in the TWL system. It can start or delete NAND applications stored in the TWL system.

## Execution

###

It can be run in the following ways:

- Use the IS-TWL-DEBUGGER software to run `TwlNmenu.srl`.
- Use the IS-TWL-DEBUGGER software to import and then run `TwlNmenu.tad`.
- Write `TwlNmenu.srl` to a DS Game Card and then run it.
- Use TWL Nmenu to import and then run `TwlNmenu.tad`.

If running the TWL Nmenu using the IS-TWL-DEBUGGER software, a "Please wait a moment" dialog box will be displayed, and you'll no longer be able to perform operations within the IS-TWL-DEBUGGER software. To exit, click Force Quit in the dialog box.

## Storing TAD Files on a DS Card

NAND applications can be imported from a TAD file stored on a DS card when in Card mode. This is a description of how to prepare the DS card to be used at this time.

There are two methods.

##### Using the `-n` Option with `maketad`

Although the `maketad` tool creates TAD files, using the `-n` option creates an SRL file that contains a TAD file instead of creating just a TAD file. Access the TAD file contained in the SRL file in Card mode by writing the SRL created with this option to a DS card.

##### Creating an Original SRL File

Access a TAD file included in the ROM-FS of an SRL file in Card mode by creating an SRL file that meets the following conditions and then writing it to a DS card.

- It must be NITRO ROM.
- The company code must be "YZ".

## Using the Tool

Once you are in TWL Nmenu, the upper screen will display some basic instructions and information about the currently selected file. The lower screen is used for displaying and selecting items in the list. Although display is usually in English, if the system language is Japanese (that is, if the market is Japan), some messages may appear in Japanese.
The TWL Nmenu is divided into three modes: NAND, SD, and Card. However, the Card mode is not available when Twl Nmenu is started as a card application. You can switch to the inactive mode either by touching the gray area at the top of the lower screen, or by pressing ← or → on the +Control Pad.

#### NAND Mode

In NAND mode, a list of NAND applications that are installed on the TWL system is displayed. In this mode, you can start or delete the selected NAND application.

Each item in the list displayed on the lower screen shows information about a NAND application in the following format:

    03. 01 4BNA (3031 34424e41) Ver.1.0
        -- ----  ---- --------      ---
        1  2     3    4             5

1. Company Code (ASCII)
2. Game Code (ASCII)
3. Company Code (Hexadecimal)
4. Game Code (Hexadecimal)
5. NAND application version number

Light blue items in the list, for which "deleted" appears to the right, indicate NAND applications that have been deleted. Red items in the list, for which "error" appears to the right, indicate NAND applications that are invalid. You should delete and then reimport these items.

The controls for this mode are shown in the table below.

Button | Operations
--- | ---
←→ | Mode Switching
↑↓ | Selects NAND applications.
START | Starts the selected NAND application.
Y | Clears the private save data of the selected NAND application.
X | Deletes the selected NAND application.
R + X | Deletes all NAND applications of the same type as the selected one.
L | Moves to the next page on the upper screen.
SELECT | Toggles between showing and hiding the description of the controls.

The following information is shown on the upper screen:

Page １

Item | Description
--- | ---
Hardware | Displays information related to the TWL system.
| BoxCount | • `used` indicates the number of installed NAND applications. • `free` indicates the remaining number of NAND applications that can be installed.
Media | Displays information related to the system memory.
| Free | Displays the available space in blocks and KB.
Total | Displays the total space in blocks and KB.

Page ２

Item | Description
--- | ---
Title | Displays information related to the selected NAND application.
| CompanyCode | Displays the Company Code in ASCII and hexadecimal.
InitialCode | Displays the Game Code in ASCII and hexadecimal.
GameVersion | Displays the game version.
TitleSize | Displays the space occupied by the NAND application in units of blocks and kilobytes.
AppSize | Displays the size of the SRL in blocks and KB.
PublicSave | Displays the size of the public save data in blocks and KB.
PrivateSave | Displays the size of the private save data in blocks and KB.
SubBanner | Displays the size of the sub-banner in blocks and in KB. When a sub-banner is configured, a fixed size of 16 KB is displayed. Otherwise, 0 KB is displayed.

The size occupied by the NAND application, `TitleSize`, is calculated using the following formula. This is not the sum of the displayed block counts, but rather the sum of the byte counts which is then converted into a block count.

    Size (in KB) occupied by a NAND application = SRL size (in KB) rounded up to 16 KB +
                               the public save data size (in KB) +
                               the private save data size (in KB) +
                               the sub-banner size (in KB) +
                               16 KB
    Size (in blocks) occupied by a NAND application = Size (in KB) occupied by the NAND application rounded up to 128 KB

##### Starting NAND Applications

Press START to run the selected NAND application. Once the NAND application is started, TWL Nmenu will give up all control. To return to TWL Nmenu, you must run TWL Nmenu again.

##### Deleting NAND Applications

Press the X Button to uninstall the selected NAND application from NAND. Even if a NAND application is deleted, information about the fact that it used to be installed remains within the TWL system. For applications in this state, only the Game Code will be displayed in light blue within the list on the lower screen. Furthermore, performing a delete operation on applications in this state will remove all traces of them.

##### Clearing the Private Save Data of NAND Applications

All private save data of the selected NAND application is deleted. The TWL system provides a feature that allows the user to back up NAND applications to SD Cards. However, the private save data region will not be backed up by this feature. Because the private save data is not backed up, it will be cleared when the system memory is restored from a backup. For this reason, NAND applications must consider the case in which only the private save data is cleared. This situation can be recreated by using TWL Nmenu to clear the private save data.

##### Deleting NAND Applications of the Same Type

When deleting NAND applications of the same type, delete all NAND applications that are the same as the selected NAND application from the perspective of whether the NAND applications have been deleted. For example, if an undeleted NAND application has been selected, all undeleted NAND applications will be deleted.

#### SD Mode
Card Mode

In SD mode and Card mode, the files on the SD Card or DS Card will be displayed on the lower screen.
In this mode, you can import TAD files. File and directory names are not displayed if they use characters that cannot be converted to Shift_JIS.

Card mode can be used only when Twl Nmenu has been started as a NAND application. Furthermore, a DS card must be inserted into the card slot before Twl Nmenu is started. A DS card inserted after starting Twl Nmenu will not be recognized.

Each item in the list displayed on the lower screen shows information about a NAND application in the following format:

    05. 866,240  backupSample.tad
        -------  ----------------
        1        2

1. File size or TAD file size in the directory
2. File name or directory name

The controls for this mode are shown in the table below.

Button | Operation
--- | ---
←→ | Switches modes.
↑↓ | Selects a file or directory.
A | Imports a TAD file when a TAD file is selected. Moves to the given directory when a directory is selected.
B | Moves up one directory.
X | Moves to the root directory.
R + A | Imports all .tad files within the directory.
L | Moves to the next page on the upper screen.
SELECT | Toggles between showing and hiding the description of the controls.

The following information is shown on the upper screen:

Page １

Item | Description
--- | ---
Hardware | Displays information related to the TWL system.
| BoxCount | • `used` indicates the number of installed NAND applications. • `free` indicates the remaining number of NAND applications that can be installed.
Media | Displays media-related information. This is always 0 in Card mode.
| Free | Displays the available space in blocks and KB.
Total | Displays the total space in blocks and KB.

Page ２

File | Displays information related to the selected file.
| CompanyCode | Displays the Company Code in ASCII and hexadecimal.
InitialCode | Displays the Game Code in ASCII and hexadecimal.
GameVersion | Displays the game version and the version that has been imported in the system memory.
FileName | Displays the file name.
LastUpdate | Displays the date last modified on the SD Card. This is always 0 in Card mode.

##### Importing TAD Files

Install a TAD file created with `maketad` in the TWL system. If a NAND application having the same game code is already installed, it will be overwritten.
Save data is initialized if any of the following are changed: the size of the public save data region, the size of the private save data region, or the presence of a sub-banner.

##### Importing TwlNmenu and NandFiler

When `TwlNmenu.tad` or `NandFiler.tad` is imported from the `$TwlSDK/bin/ARM9-TS/Rom` directory, the following error may be displayed.

    Failed to import ****.tad.
    The data may be corrupt. (-1022)

In this case, you can normally install it by re-importing it.

## Location

`$TwlSDK/bin/ARM9-TS/Rom/TwlNmenu.srl`
`$TwlSDK/bin/ARM9-TS/Rom/TwlNmenu.tad`

## See Also

## Revision History

2009/08/20 Added a note regarding initialization of save data.
2009/05/27 Added a note about importing `TwlNmenu.tad` and `NandFiler.tad` files.
2009/05/22 Added SubBanner in NAND mode. Explained how `TitleSize` is calculated.
2009/04/30 Added a cautionary note about file and directory names in SD mode.
2008/10/16 Added information related to Card mode and displaying Japanese.
2008/07/11 Added support for a `TwlNmenu` update.
2008/04/25 Deleted ROM mode, Backup, and Restore.
2008/03/19 Made descriptions compliant with the terminology. Adjusted phrasing.
2007/12/20 Initial version.

CONFIDENTIAL