» WIT: Wiimms ISO Tools » Guides » Composing Wii ISO Images

# Composing Wii ISO Images

## 1. Introduction

Both main tools, wit and wwt, may compose ISO images from (extracted) file systems. Such file systems are directories which contain system and real files and follow some rules.

A valid FST is a partition directory or a disc directory with one or more partitions. Most commands of wit and wwt (like »wit COPY« or »wwt ADD«) accept a valid FST as input like any other ISO format (see »file formats«). If opening such a FST directory the internal file layer will scan the source directory and will build a memory map of partitions and files. This is fast.

When reading this virtual ISO then the source files are read and encrypted as needed. After reading the complete disc and before closing the output files, the H3 and H4 hashes are updated and TICKET and TMD are trucha signed. The modified parts are then written again to the destination file.

## 2. Definition of a FST partition

A FST partition is a directory that contains the following files and sub directories:

Files and Directories of FST
path | mode | description
--- | --- | ---
./ | required | Base directory which contains the extracted partition header and all other directories.
./setup.txt | optional | This text file allows the user to define composing options. Eeach line contains one option. The general syntax is: name = value. Lines beginning with '#' or '!' and empty lines are ignored. The following 4 parameters are supported: disc-type = type The disc type of the image. Wii and GameCube are valid paramaters. part-id = id6 The ID6 of the partition. If set, the IDs of the source files (DISC-HEADER, BOOT.BIN, TICKET, TMD) are overwritten. The --id options take precedence over this setting. The ID of the DATA partition is used for the disk header. part-part-name = text. The partiton name (or title). If set, the names of the source files (DISC-HEADER and BOOT.BIN) are overwritten. The --name option takes precedence over this setting. The name of the DATA partition is used for the disk header. part-offset = value It is a hint for wit for the placement of the partition and overwrite the default value. Prefix hexadecimal numbers with '0x'. wit will never overlap partitions.
./ticket.bin | optional | The TICKET of the partition. If not exists the TICKET will be created from scratch. The ID4 of the TICKET will be patched by the option --id. The TICKET will be trucha signed.
./tmd.bin | optional | The TMD of the partition. If not exists the TMD will be created from scratch. The ID4, the disc title and the system version of the TMD will be patched by the options --id, --name and --ios. The TMD will be trucha signed.
./cert.bin | optional | The certificate of the partition. If not exists a standard cert chain will be used.
./h3.bin | ignored | When extracting a file system this file will be extracted too. It contains all H3 hash values. It is not needed for composing because it will be generated automatically.
./disc/ | optional | Directory of disc files. Only the disc files of the DATA partition are used.
./disc/header.bin | optional | This are the first 128 bytes of the Wii disc. If this file is missed then ID and disc titles are copied from ./sys/boot.bin after patching boot.bin. The ID6 and the disc title of the header will be patched by the options --id and --name. Only the header.bin file of the DATA partition is used.
./disc/region.bin | optional | If »--region AUTO« fails and this file exists, than 32 bytes are read to setup the region info at disc offset 0x4e000. »--region FILE« forces reading of this file. Only the region.bin file of the DATA partition is used.
./sys/ | required | Directory of system files.
./sys/boot.bin | required | A file with 1088 (0x440) bytes is expected. The ID6 and the disc title of the header will be patched by the options --id and --name. The command »wit DUMP« can dump the data structure of boot.bin files.
./sys/bi2.bin | optional | A file with 8192 (0x2000) bytes is expected. If missing, a generic version is created. Before v3.05a, this file was required.
./sys/apploader.img | required | The application loader is expected.
./sys/main.dol | required | The main executable is expected. Hint: The command »wit DUMP« can dump the data structure of *.dol files.
./sys/fst.bin | ignored | When extracting a file system this file will be extracted too. It contains the file table of the real files of the Wii disc. It is not needed for composing because it will be generated automatically. Hint: The command »wit DUMP« can dump the content of fst.bin files in human readable format.
./files/ | required | Directory of real files. All sub directories (recursivley) and files not beginning with a point ('.') are included in the file list. If directories or files beginning with a '.' should be included, than insert the path of them into ./include.fst. If directories or files not beginning with a '.' should be excluded, than insert the path of them into ./exclude.fst.
./exclude.fst | optional | This is an optional file. Each line contains one filename beginning with 'files/'. These files are ignored and not included into the image regardless of include.fst. If the filename represents a directory, the complete directory including all sub directories is ignored.
./include.fst | optional | This is an optional file. Each line contains one filename beginning with 'files/'. Files beginning with a point ('.') are hidden files and generally ignored. But if the filename is found in include.fst, it is included.

If all required files and sub directories exist then the base directory is a valid FST partition.

If composing from a FST partition it becomes a DATA partition (partition type #0). The beginning of this DATA partition is placed at usual disc offset 0xf800000. File ./setup.txt may change this default.

If you are unsure about the files, extract an image and compare the extracted files with this documentation.

## 3. Definition of a FST disc

Composing works also from FST discs. A FST disc is a directory, that contains sub directories with a required DATA partition and with an optional UPDATE partition and/or an optional CHANNEL partition. All partitions must be valid FST partitions.

- UPDATE partition (type #1):
  The optional UPDATE partition resides in a directory called UPDATE or P1 (case ignored). This UPDATE partition is placed at usual disc offset 0x50000.
- DATA partition (type #0):
  The required DATA partition resides in a directory called DATA or P0 (case ignored). This DATA partition is placed at usual disc offset 0xf800000, but never before the end of the UPDATE partition.
- CHANNEL partition (type #2):
  The optional CHANNEL partition resides in a directory called CHANNEL or P2 (case ignored). This CHANNEL partition is placed directly behind the DATA partition.

If using the command »wit MIX« it is possible to create special discs with many different partitions from different sources (ISO, WDF, FST, ...). »wit MIX« allows a free assignment of partition table and type.

## 4. Composing Options

The following table shows the composing relevant options. Follow the link (option name) for an extended documentation of the specific option:

Options
Option | Param | Description
--- | --- | ---
| `--ignore-fst` |  | Disable composing and ignore FST directories as input. This legacy option is a shortcut for --allow-fst=off.
| `--modify` | list | This patching option defines the impact of the options --name and --id. It expects a comma separated list of the following keywords (case ignored) as parameter: NONE, DISC, BOOT, TICKET, TMD, WBFS, TT, ALL and AUTO (default). All keywords can be prefixed by '+' to enable that option, by a '-' to disable it or by a '=' to enable that option and disable all others.
| `--name` | name | This patching option changes the name (disc title) of the disc to the given parameter. Up to 63 characters are expected. The disc header and boot.bin are objects to modify. The option --modify selects the objects.
| `--id` | id | This patching option changes the ID of the disc to the given parameter. 1 to 6 characters are expected. Only defined characters not equal '.' are modified. The plus sign '+' is a wildcard for multiple '.' to fill the complete entered ID to 6 characters. The disc header, boot.bin, ticket.bin and tmd.bin are objects to modify. The option --modify selects the objects.
| `--disc-id` | id | This patching option changes the ID of the disc header to the given parameter. 1 to 6 characters are expected. Only defined characters not equal '.' are modified. The plus sign '+' is a wildcard for multiple '.' to fill the complete entered ID to 6 characters. Option --disc-id overrides the definition of option --id.
| `--boot-id` | id | This patching option changes the ID of boot.bin to the given parameter. 1 to 6 characters are expected. Only defined characters not equal '.' are modified. The plus sign '+' is a wildcard for multiple '.' to fill the complete entered ID to 6 characters. Option --boot-id overrides the definition of option --id.
| `--ticket-id` | id | This patching option changes the ID of ticket.bin to the given parameter. 1 to 4 characters are expected. Only defined characters not equal '.' are modified. The plus sign '+' is a wildcard for multiple '.' to fill the complete entered ID to 4 characters. Option --ticket-id overrides the definition of option --id.
| `--tmd-id` | id | This patching option changes the ID of tmd.bin to the given parameter. 1 to 4 characters are expected. Only defined characters not equal '.' are modified. The plus sign '+' is a wildcard for multiple '.' to fill the complete entered ID to 4 characters. Option --tmd-id overrides the definition of option --id.
| `--wbfs-id` | id | This patching option changes the ID of the WBFS header to the given parameter if adding a file to a WBFS or if creating a WBFS file. 1 to 6 characters are expected. The already patched disc ID of the source is used as base and only defined characters not equal '.' are modified. The plus sign '+' is a wildcard for multiple '.' to fill the complete entered ID to 6 characters. Option --wbfs-id overrides the definition of option --id.
| `--region` | region | This patching option defines the region of the disc. The region is one of JAPAN, USA, EUROPE, KOREA, FILE or AUTO (default). The case of the keywords is ignored. Unsigned numbers are also accepted.
| `--ios` | ios | This patching option defines the system version (IOS to load) within TMD. The format is 'HIGH:LOW' or 'HIGH-LOW' or 'LOW'. If only LOW is set than HIGH is assumed as 1 (standard IOS).
| `--enc` | encoding | Define the encoding mode. The mode is one of NONE, HASHONLY, DECRYPT, ENCRYPT, SIGN or AUTO. The case of the keywords is ignored. The default mode is 'AUTO'.
`-L` | `--logging` |  | This debug option enables the logging of internal memory maps. If set twice second level memory maps are printed too.

## 5. Debugging

With the option --logging the memory layout of the virtial ISO image will be printed to standard output (stdout).

The command »wit DUMP« dumps the data structure of any ISO image including FST to standard output. This is good for fast control the design of the virtual disc. Use the option --long multiple times to get more details. Remember: Because only parts of the virtual image are read the caluclation of hash and the signing are incomplete.

»wit DUMP« can also dump information about boot.bin, fst.bin and *.dol files.

Use »wit FILES« to list the files of the virtual ISO image. Combine it with the option --files to filter files. Use »wit EXTRACT« in combination with option --files to extract and confirm the patched system files.

## 6. A composing template

This ZIP file (76 KB) contains a template for composing with free main.dol and apploader.img. It is made by bushing and taken from hackmii.com.