» WIT: Wiimms ISO Tools » wit: Wiimms ISO Tool » wit skeleton

# wit skeleton

Create very small skeletons of ISO images. A skeleton contains only disc and partition headers for further analysis and is not playable because all files are zeroed.

## 1. Syntax

    wit SKELETON [source]...

## 2. Options

Options
Option | Param | Description
--- | --- | ---
`-t` | `--test` |  | Run in test mode, modify nothing. >>> USE THIS OPTION IF UNSURE! <<<
`-q` | `--quiet` |  | Be quiet and print only error messages.
`-L` | `--logging` |  | This debug option enables the logging of internal memory maps. If set twice second level memory maps are printed too.
`-T` | `--titles` | file | Read file for disc titles. -T/ disables automatic search for title files.
| `--utf-8` |  | Enables UTF-8 support for filenames (default).
| `--no-utf-8` |  | Disables UTF-8 support for filenames.
| `--lang` | lang | Define the language for titles.
`-a` | `--auto` |  | Search WBFS partitions using '/proc/partitions' or searching hard disks in '/dev/' and use all readable as source. This works like »wwt --auto --all«.
`-s` | `--source` | path | Use the entered file or directory as source. If parameter PATH contains at least one wildcard (e.g. '*.wbfs'), then PATH is used as search pattern and all found files are added. In order to use this variant, the calling shell must not interpret the wildcards. Therefore, the parameter must usually be enclosed in single or double quotes. Directories are expanded to all containing files but hidden files (file names begins with a point) are ignored. If a command needs only images then non image files of the directory are ignored without notification. The option --no-expand suppress the directory expansion.
| `--no-expand` |  | Do not expand directories to the containing files or images. This option does not change the behavior of --recurse.
`-r` | `--recurse` | path | If path is not a directory, then it is used as a simple source file like --source. If parameter PATH contains at least one wildcard (e.g. '*.wbfs'), then PATH is used as search pattern and all found files are added. In order to use this variant, the calling shell must not interpret the wildcards. Therefore, the parameter must usually be enclosed in single or double quotes. Directories are scanned for source files recursively. The option --rdepth limits the search depth. Hidden files and hidden sub directories (file names begins with a point) and files with non supported file types (non ISO files for most commands) are ignored without notification.
| `--rdepth` | depth | Set the maximum recurse depth for option --recurse. The default search depth is 10.
`-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.
`-1` | `--one-job` |  | Execute only the first job and exit. This is a shortcut for »--job-limit 1«.
| `--job-limit` | num | Execute only the first 'num' jobs and exit. If done without errors the exit status is OK (zero).
`-i` | `--ignore` |  | Ignore non existing files/discs without warning. If set twice then all non Wii and GameCube ISO images are ignored too.
| `--ignore-fst` |  | Disable composing and ignore FST directories as input. This legacy option is a shortcut for --allow-fst=off.
| `--ignore-setup` |  | While composing ignore the file 'setup.txt', which defines some partition parameters.
| `--links` |  | Detect soft and hard linked source files while composing or extracting discs and try to create hard links instead of independent copies on the destination file system.
| `--allow-fst` | [=mode] | Enable the usage of extracted images.MODE is either OFF, AUTO (default) or ON. Without value, ON is used. If mode is AUTO, extracted images are usually enabled.
| `--allow-nkit` | [=mode] | Enable the detection of NKIT images.MODE is either OFF, AUTO (default) or ON. Without value, ON is used. If mode is AUTO, the NKIT detection is enabled only for a few analytic commands. Anyway, NKIT images are not supported yet, but detected to print warnings.
| `--psel` | list | This option set the scrubbing mode and defines, which disc partitions are handled. It expects a comma separated list of keywords, numbers and names; all together called parameter. All parameters are case insensitive and non ambiguous abbreviations of keywords are allowed. Each parameter becomes a rule and each rule is appended to a rule list. Rules prefixed by a minus sign are DENY rules. Rules prefixed by a plus sign or without a prefix are ALLOW rules. Each partition is compared with each rule until a rule matches the partition. If a match it found, the partition is enabled for a ALLOW rule or disabled for a DENY rule. The allowed keywords are: DATA, UPDATE, CHANNEL, PTAB0 .. PTAB3, ID, ALL, WHOLE and RAW. The following input formats are accepted too: ptype, #index, #<index, #<=index, #>index, #>=index and #tab_index.part_index.
| `--raw` |  | Abbreviation of »--psel RAW«.
`-W` | `--wdf` | [=param] | Set the image output file type to WDF (Wii Disc Format). The output format is either WDFv1 or WDFv2 (default). It depends of the input file format and of the aligning. --wdf=param is a short cut for »--wdf --align-wdf=param«.
| `--wdf1` | [=param] | Set image output file type to WDF and force version 1. --wdf1=param is a short cut for »--wdf1 --align-wdf=param«.
| `--wdf2` | [=param] | Set image output file type to WDF and force version 2. --wdf2=param is a short cut for »--wdf2 --align-wdf=param«.
| `--align-wdf` | [align][,minhole] | Parameter align defines the aligning factor for new WDF images. It must be a power of 2 and smaller or equal than 1 GiB. The default WDF alignment is 1 for WDF v1 and 4 for WDF v2. Usual values are 1, 512, 4K and 32K. The optional parameter minhole defines the minimal hole size, before a new chunk is created. If NULL, an internal value is used to minimize the total file size. minhole can't be smaller than align.
`-I` | `--iso` |  | Set image output file type to PLAIN ISO.
`-C` | `--ciso` |  | Set image output file type to CISO (Compact ISO, same as WBI).
`-B` | `--wbfs` |  | Set image output file type to WBFS (Wii Backup File System, default).
`-d` | `--dest` | path | Define a destination directory for the skeleton files. The default is »--DEST ./.skel/«.
`-D` | `--DEST` | path | Like --dest, but create the directory path automatically.

## 3. Description

With the SKELETON command the user can create a small database of all owned games. Therefor the command copies the disc header and all partitions headers and some bytes of mail.dol and apploader.img and the complete internal directory structure (FST.bin). The next section describes the content in detail.

All copied data is placed at the same location as its origin. Because of this a skeletion looks like a Wii discs, but all files are zeroed. Moreover the skeleton is decrypted and all hash values are removed. The typical size of a skeleton is about 4KB up to 700KB. Because of decryption a skeleton is compressible.

The main idea of skeletons is to have a small size database of all discs for further analysis. The command »wit DUMP --show all« can create a complete info dump of a disc by using the skeleton. The skeletons hold enough data to analyze the disc geometry, to find common files (e.g. WAD files in update partitions) in all discs, to compare all cerificates and more. Skeletons can also be used for include and exclude lists.

Extracting files of a skeleton is also possible, but only some files have real content. The content of most files (and of all real files) is zeroed bytes.

The output is placed in a subdiretory named .skel/ (created automatically). The preceding point makes the directory hidden so it is not scanned if searching real discs. For each source disc a skeleton file is created with the name 'ID6-SHA1.skel'. 'ID6' is the ID6 of the disc and 'SHA1' is the hex notation of the SHA1 sum of the skeleton data. This SHA1 is important to support different variants of the same game (e.g. UPDATE partition scrubbed or not).

The options --dest and --DEST define another skeleton directory. The options --wdf, --iso, --ciso and --wbfs changes the output file format and the file extension. Default is file format WDF (minimal file size for this purpose) and file extension .skel.

Example: wit skel -r.

Scan the current directory recursive for Wii discs and stores the skeleton of the found discs into the directory ./.skel/. The directory .skel itself is not scanned because the point as first character marks the directory as hidden.

## 4. Content of a skeleton

A Wii disc is divided into 2 part: The (extended) disc header (first 160 KiB of the image) and the partition area (all behind the disc header). The following data areas are stored into a skeleton:

1. The complete (extended) disc header (first 160 KiB of the image).
2. The complete CERT, TICKET and TMD of each partition header. The H3 is skipped.
3. The complete boot.bin, bi2.bin and fst.bin (decrypted, hash values ignored) of each partition.
4. The first 32 bytes if apploader.img and the first 256 bytes of main.dol (decrypted, hash values ignored) of each partition. This data is needed to calculate the partition geometry.
5. For easy detection of a skeleton the magic "[SKELETON]" is stored in data block in the last 10 bytes of the already cleared hash area.

Here is a memory dump of a skeleton of "Wii Play". All non named areas contain only bytes with value NULL. The dump is printed if using the option --logging while creating a skeleton (»wit skeleton --logging ...«).

         offset .. offset end     size  comment
    ----------------------------------------------------------
    	  0 ..     50000     50000  Disc header of RHAP01

          50000 ..     502c0       2c0  ticket, id=.UPP
          502c0 ..     504c8       208  tmd, id=.UPP
          504e0 ..     50ee0       a00  cert
          703f6 ..     70400         a  Marker '[SKELETON]'
          70400 ..     70840       440  boot.bin, id=RELSAB
          70840 ..     72840      2000  bi2.bin
          72840 ..     72860        20  apploader/header
          a8b00 ..     a8c00       100  main.dol/header
          a8d00 ..     a8efc       1fc  fst.bin

        f800000 ..   f8002c0       2c0  ticket, id=RHAP
        f8002c0 ..   f8004c8       208  tmd, id=RHAP
        f8004e0 ..   f800ee0       a00  cert
        f8203f6 ..   f820400         a  Marker '[SKELETON]'
        f820400 ..   f820840       440  boot.bin, id=RHAP01
        f820840 ..   f822840      2000  bi2.bin
        f822840 ..   f822860        20  apploader/header
        f858b00 ..   f858c00       100  main.dol/header
        fbf1300 ..   fbf2b40      1840  fst.bin

## 5. Usual error/exit codes:

    0 == OK      : all done without errors.
    SYNTAX ERROR : at least one syntax error in command line found.
    READ ERROR   : error while reading a file.
    WRITE ERROR  : error while writing a file.
    CANT CREATE  : Can't create output file.