» WIT: Wiimms ISO Tools » Guides » Discs IDs and wildcards

# Discs IDs and wildcards

## 1. What is a disc ID?

Each GameCube and Wii disc starts with the disc header. The first 6 bytes of the disc header are:

      char disc_id;
      char game_code[2];
      char region_code;
      char marker_code[2];

These four members together are called ID6 and identify a disc. Until now this ID6 is unique for all official discs. Most tools, and that is true for the WIT tools too, use this ID6 to select a single disc e.g. from a WBFS partition.

IDs contain only the upper case letters A..Z and the digits 0..9. The WIT tools will automatically convert entered IDs to upper case and will accept additionally the undercore that is some times used by homebrew.

Wii discs contain one one more partitions, at least the DATA partition. Within a partition you can find an ID in the system files boot.bin, ticket.bin and tmd.bin. Ticket and TMD only uses four characters (ID4) as ID and the ID4 of ticket.bin and tmd.bin are generally identical.

For the DATA partition the ID6 of the disc header and boot.bin are generally identical and the ID4 of ticket.bin and tmd.bin uses the first four bytes of the ID6. For other partition the IDs differ.

Here is an example for Wii Play created with »wit dump --show intro,part wii-play.wdf« (only relevant lines filtered):

    Dump of file wii-play.wdf

      ID & file type:    RHAP01, WDF/WII

      Partition table #0, partition #0, type 1 [UPDATE]:
        boot.bin, ID:    RELSAB
        Ticket:
          Title ID:          00010000 00555050 = '.....UPP'
        TMD:
          Title ID:          00010000 00555050 = '.....UPP'

      Partition table #0, partition #1, type 0 [DATA]:
        boot.bin, ID:    RHAP01
        Ticket:
          Title ID:          00010000 52484150 = '....RHAP'
        TMD:
          Title ID:          00010000 52484150 = '....RHAP'

## 2. Selection and wildcards

The WIT Tools accept ID6 values to select discs. Some examples are:

- Some wwt commands need IDs to select the discs for the operation.
- The options --include and --exclude expect lists of IDs.
- A pathname of a WBFS may be extended with an WBFS selector. This selector can be a index or a ID6.

If an ID selector is entered it is converted to upper case. Then it is compared to the ID6 of the disc header to decide if the disc should be used for the operation.

Most (but not all yet) commands and options accept wildcards:

- The point ('.') matches exact one arbitrary character.
- The plus sign ('+') matches any number characters. It can be used only once per ID.
- The ID is filled up to contain exactly 6 character. If a plus sign is present it is expanded to the needed number of points. If no plus sign is present then points are added to the end of the ID.

The option »--id id6« accepts also both types of wildcards and the parameter is expanded in the same way. Only non wildscard charcters are modified while creating the new ID.

Example:
To select only PAL games you can use either '...P' or '+P..'. Both will expand to '...P..' and matches all IDs with a 'P' as forth character. If you use one of this this pattern together with then option --id only the fourth character of the ID will be changed.

## 3. ID Options

Options
Option | Param | Description
--- | --- | ---
`-x` | `--exclude` | id | A comma separated list with ID4 and ID6 values is expected. '.' is a wildcard for exact 1 character and '+' is a wildcard for any number characters. If the parameter begins with a '@' the given file is read and each line is scanned for one ID. Images with the given ID are excluded from operation. Each use of this option expands the exclude list. See --include-first for precedence issues.
`-X` | `--exclude-path` | file_or_dir | Scan the ID of the source and add it to the exclude list. If the source is a directory then scan all images of the directory. Images with the given ID are excluded from operation. Each use of this option expands the exclude list. See --include-first for precedence issues.
`-n` | `--include` | id | A comma separated list with ID values is expected. '.' is a wildcard for exact 1 character and '+' is a wildcard for any number characters. If the parameter begins with a '@' the given file is read and each line is scanned for one ID. Only images with the given ID are included into the operation. Each use of this option expands the include list. See --include-first for precedence issues.
`-N` | `--include-path` | file_or_dir | Scan the ID of the source and add it to the include list. If the source is a directory then scan all images of the directory. Only images with the given ID are included into the operation. Each use of this option expands the include list. See --include-first for precedence issues.
| `--include-first` |  | The options --include, --include-path, --exclude and --exclude-path decide which discs are included into the operation. If neither include nor exclude options are used, than all disc are included into the operation. If only include options are used, than only the specified discs are operated. If only exclude options are used, than all all discs but not the excluded are operated. If include and exclude options are used together and --include-first is not set, than all discs are operated that are specified by any include option and not by any exclude option. If --include-first is set, than all discs are ignored that are specified by any exclude option and not by any include option.
| `--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.