# NandFiler

## Overview

NandFiler is a tool for manipulating data in the system memory (NAND). It can be used to delete, browse, and edit photo data as well as the Save Data of the NAND application stored in Wii system memory. By using an SD Card, this tool can also be used to import and export Save Data.

## Execution

It can be run in the following ways:

- Using the IS-TWL-DEBUGGER software to run `NandFiler.srl`
- Using the IS-TWL-DEBUGGER software to import and then run `NandFiler.tad`
- Writing `NandFiler.srl` to a DS Game Card and then running it
- Using TWL Nmenu to import and then run `NandFiler.tad`

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

## Mode

There are three modes in NandFiler:

- Filer mode: Lets you traverse directories and check file sizes, timestamps, and attributes
- View mode: Lets you browse file contents
- Edit mode: Lets you edit file contents

## Filer Mode

The NandFiler application is started in Filer mode by default.
In `Filer` mode, after you select either photo data, NAND application Save Data that has been already imported in the system, or SD Card data, you can browse and operate on that directory tree.
The following table shows what operations you can perform.

Button | Operation
--- | ---
SELECT | Displays a list of operations
&larr; &rarr; | Switches pages for the displayed items.
&uarr; &darr; | Selects files and so on.
A | Confirms an item.
B | Cancels the selected archive or file. Moves to the parent directory.
X | Opens a submenu when a file or archive is selected.

### Title Selection

This is the state immediately after startup. The left side of the screen displays links to the game code of the installed NAND application (blue), and to photo data and the SD card (purple).
Selecting a Game Code will switch to archive selection in the center of the screen. Selecting a link to photo data or an SD card will switch to file selection on the right side of the screen. The following operations can be selected on the submenu displayed by pressing the X Button.

- Export ... Export data

#### Export

Copies files from the application's Save Data region or the PHOTO directory to the SD card.
A directory is created on the SD card (named either [`4-digit game code_4-digit version`] or [`PHOTO`]) and then the data are copied there.

### Archive Selection

Selecting a Game Code under Title Selection moves here. For Archive Selection, you can choose either `Public` or `Private`.
These are links to the public save data and private save data of the NAND application selected under Title Selection.
The following operations can be selected on the submenu displayed by pressing the X Button.

- Backup: Backs up save data
- Break: Destroys the save data region

#### Backup

Backs up save data on the SD card. The data backed up here can be imported using the `Restore` operation, described below.
`Backup` differs from the `Export` operation described above in that the entire file system of the Save Data region is copied to the SD card, whereas with Export, data are copied in file units.

#### Break

Destroys the FAT system region of the save data. Use this for debugging an assumed problem with the save data region causing `FS_RESULT_BAD_FORMAT` to occur.
The destroyed save data region can be restored with this tool using any of the methods described below.

- Execute Backup before using Break and then use Restore after Break
- Reimport the application in question on the TWL Nmenu

To restore while the application is running, use `NA_FormatTitleArchive`.

### File Selection

If PHOTO or SD have been selected under Title Selection, selecting any save data under Archive Selection will move to here.
A list of directories (yellow) and files (white) are displayed under File Selection.
Press the A Button when a directory is selected to browse the contents of that directory. Press the A Button when a file is selected to switch to View mode.
Following is the meaning of the information that is displayed at the top of the screen in File Selection.

Size | File size.
CTime | The time the file was created.
MTime | The time the file was last modified.
ATime | The time the file was last accessed.

Attr

File attributes
REA: Read only files
HID: Hidden files
SYS: System files
VOL: Volume level
PRO: Protected files
ARC: Archives

Very bottom of screen | Full path to the selected file.

The following operations can be selected on the submenu displayed by pressing the X Button.

- Import ... Imports Save Data
- Delete: Deletes files and directories
- Restore: Restores save data

#### Import

This operation is valid for directories created with the `Export` operation. Note, however, that exported PHOTO directories cannot be imported.
This operation copies data to the Save Data region of system memory. Provided the data does not exceed the size of the Save Data region of system memory, the data copied over by `Export` can be imported even if they have been altered.

#### Delete

Deletes a file or directory. If a directory is selected, files and directories inside the directory are deleted recursively.

#### Restore

This operation is only valid for save data backup files created using the Backup feature. The backup file on the SD card is imported to system NAND memory.
Note that importing backup files will fail in the cases given below.

- When the backup file has been modified
- When the backup file name has been changed
- When the corresponding application has been deleted
- When the save data save size of the application in question has changed

## View Mode

In View mode, you can view file contents. The displayed filename and addresses are shown on the upper screen.
The content of the file (binary values and corresponding characters) is shown on the lower screen.

The following specifications apply to the display of characters.

- 0x00 can be replaced by 0x20 (by a space)
- 0x20 to 0x7A conform to ASCII code
- Other regions display hiragana and katakana (font incorporated as sample)

The following table shows what operations you can perform.

Button | Operation
--- | ---
&larr; &rarr; | Scrolls one page at a time.
&uarr; &darr; | Scrolls (one line at a time).
A | Switches to Edit mode.
B | Switches to `Filer` mode. If file has been edited in Edit mode, it will be saved.

## Edit Mode

Edit mode lets you edit files.
Take note of the following restrictions.

#### Editing restrictions

- There is no support for changes in file size.
- When the file being edited is larger than 14M, if regions near the start and the end of the file are edited at the same time, earlier changes will not be reflected.

### Non-Editing State

This state occurs when entering Edit mode.

Button | Operation
--- | ---
&larr; &rarr; &uarr; &darr; | Moves the cursor
A | Switches to the editing state
B | Switches to View mode

### Editing State

Button | Operation
--- | ---
&larr; &rarr; &uarr; &darr; | Moves the cursor
B | Switches to the non-editing state
L, R | Increase, Decrease value

Pressing the L or R Buttons in the editing state will change the value at the current cursor position.
Locations where any edits have been made will appear in green. The cursor can be moved freely even in the editing state, but the horizontal range of movement is reduced compared to the non-editing state.
To save edits, select Yes from the choices displayed when you press the B Button in View mode.

## Location

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

## See Also

## Revision History

2009/02/18 Added text about the `Break` feature and `FS_RESULT_BAD_FORMAT`.
2008/01/13 Added text about the `Import` and `Export` features.
2008/12/08 Added mention of restrictions when editing.
2008/11/26 Complied with addition of screenshots and changes to operations.
2008/10/21 Added text about the `Backup` and `Restore` features.
2008/09/16 Added text about the `Break` feature.
2008/07/18 In Location, changed "Release" to "Rom."
2008/07/14 Changed terminology.
2008/07/07 Initial version.

CONFIDENTIAL