
*******************************************************************************
*******              Wiimms ISO Toolset v3.02a - 2020-05-29             *******
*******************************************************************************

Wiimms ISO Toolset (WIT) is a command line tool set for linux and for other
unix like operating systems including cygwin. The tools manage WBFS partitions
and ISO Images. WWT cotains the following tools:

The both main tools are:
  wit      : Wiimms ISO Tool manage ISO files.
  wwt      : Wiimms WBFS Tool manage WBFS partitions.

And these are special WDF and CISO tools:
  wdf-cat  : a 'cat' like programm with special handling of WDF files.
  wdf-dump : dump the data structure of a WDF file.

The software is developed under the GPL 2.0 license. See file gpl-2.0.txt
or URI http://www.gnu.org/licenses/gpl-2.0.txt for details.

The most current source is available under:
  https://wit.wiimm.de/r/viewvc/
The source of this revision (0) is available under:
  https://wit.wiimm.de/r/viewvc/?pathrev=0
You can also checkout the SVN repository:
  http://opensvn.wiimm.de/wii/trunk/wiimms-iso-tools//

See https://wit.wiimm.de/ for announcements and discussions.

This files describes the main tool 'wit'.


*******************************************************************************
*******                     Content of all documents                  *********
*******************************************************************************

The documentation is divided into several files:

  DOCUMENTATION.txt : General overview.
  FAQ.txt           : FAQ of all tools.
  HISTORY.txt       : Complete development history.

  wit.txt           : Documentation about the tool 'wit'.
  wwt.txt           : Documentation about the tool 'wwt'.

  WDF.txt           : Definition of a WDF file.
  WBFS.txt          : Interesting things about WBFS



*******************************************************************************
*******                    Overview about this document               *********
*******************************************************************************

Contents:

    Output of 'wit --help'
    @file
    Commands in detail
    Processing --source and --recurse
    Processing ISO files
    Processing ID6 parameters
    Processing exclude options
    Processing title db
    Processing split options
    Processing size options
    Selecting files with --files=rules
    Some options in detail
    Hidden options (for testing)
    Some options in detail
    Environment variables
    Signals


*******************************************************************************
*******                      Output of 'wit --help'                   *********
*******************************************************************************
wit: Wiimms ISO Tool v3.02a r0 linux - Dirk Clemens - 2020-05-29

wit : Wiimms ISO Tool : It can list, analyze, verify, convert, split, join,
      patch, mix, extract, compose, rename and compare Wii and GameCube images.
      It also can create and dump different other Wii file formats.

Syntax: wit [option]... command [option|parameter|file]...


Commands:

  VERSION           : Print program name and version and exit.
  HELP      | H     : Print help and exit. If the first non option is a valid
                      command name, then a help for the given command is
                      printed.
  INFO              : Print some internal information about the keywords. If
                      the keyword ALL is set or no keyword is entered, then all
                      informations are printed. Possible keywords are:
                      IMAGE-FORMAT and ALL.
  TEST              : Test options: All options are allowed, some are printed.
  ERROR     | ERR   : Translate an exit code to a message name. If no exit code
                      is entered, print a table with all error messages.
  COMPR             : Scan compression modes and print the normalized names.
                      See option --compression for syntax details. If no mode
                      is given than print a table with all available
                      compression modes and alternative mode names.
  FEATURES          : Check, if the requested features are available. All
                      keywords are possible. If no keyword is used, all
                      supported features are printed. The exit status is 0 for
                      'all features supported', 1 for 'some features supported'
                      and 2 for 'no feature supported'.
  ANAID             : Analyze the entered IDs and print one line for each ID
                      with 3 columns: HEX_ID, ASCII_ID, Game title.
  EXCLUDE           : Dump the internal exclude database to standard output
                      (stdout).
  TITLES            : Dump the internal title database to standard output
                      (stdout).
  GETTITLES         : Call the script 'load-titles.sh' in the share folder to
                      update the title database.
  CERT              : Collect certificates and eliminate multiple entires of
                      the same certificate. Dump all collected certificates to
                      standard output (stdout) and/or write the certificate to
                      a new binary cert file. The optional parameters are
                      handled like parameters of option --cert.
  CREATE            : Create a system file (TICKET or TMD).
  DOLPATCH          : Patch a dol file. A sub-command is either (upper case are
                      keywords) 'XML=filname' or 'NEW=type,addr,size' or
                      'NEW=type,AUTO ' or 'LOAD=addr,filename' or
                      'addr=patch[#cond]', and 'type' is either 'TEXT' or
                      'DATA'. Read https://wit.wiimm.de/cmd/wit/dolpatch for
                      more details.

  FILELIST  | FLIST : List all source files in a table.
  FILETYPE  | FTYPE : Print a status line for each source file.
  ISOSIZE   | SIZE  : Print a status line with size infos for each source file.

  DUMP      | D     : Dump the data structure and content of Wii and GameCube
                      ISO files, cert.bin, ticket.bin, tmd.bin, header.bin,
                      boot.bin, fst.bin and of DOL-files. The file type is
                      detected automatically by analyzing the content.
  ID6       | ID    : Print ID6 of all found ISO files as simple list.
  ID8               : Print ID6 + 2 next bytes as disc and version number of
                      all found ISO files as simple list.
  FRAGMENTS         : Print the image fragments and, if possible, their file
                      system mapping and fragments. If option --brief is set,
                      only the fragment counts are printed. The Mac version can
                      only detect the file system mapping for WBFS partitions.
  LIST      | LS    : List all found ISO files.
  LIST-L    | LL    : List all found ISO files with size and region. 'LIST-L'
                      is a shortcut for 'LIST --long'.
  LIST-LL   | LLL   : List all found ISO files with date, size and region.
                      'LIST-LL' is a shortcut for 'LIST --long --long'.
  LIST-LLL  | LLLL  : List all found ISO files with date, size and region and
                      add a second status line with more info. 'LIST-LLL' is a
                      shortcut for 'LIST --long --long --long'.

  FILES     | F     : List all files of all discs.
  FILES-L   | FL    : List all files of all discs. 'FILES-L' is a shortcut for
                      'FILES --long'.
  FILES-LL  | FLL   : List all files of all discs. 'FILES-LL' is a shortcut for
                      'FILES --long --long'.

  DIFF      | CMP   : DIFF compares ISO images in scrubbed or raw mode or on
                      file level. Images, WBFS partitions and directories are
                      accepted as source. DIFF works like COPY but comparing
                      source and destination.
  FDIFF     | FCMP  : FDIFF compares ISO images on file level. Images, WBFS
                      partitions and directories are accepted as source.
                      'FDIFF' is a shortcut for 'DIFF --files +'.
  EXTRACT   | X     : Extract all files of each source to new directory
                      structures. Images, WBFS partitions and directories are
                      accepted as source.
  COPY      | CP    : Copy, scrub, convert, join, split, compose, extract,
                      patch, encrypt and decrypt Wii and GameCube disc images.
                      Images, WBFS partitions and directories are accepted as
                      source.
  CONVERT   | CV    : Convert, scrub, join, split, compose, extract, patch,
                      encrypt and decrypt Wii and GameCube disc images and
                      replace the source with the result. Images, WBFS
                      partitions and directories are accepted as source. The
                      former command name was SCRUB.
                        'wit CONVERT' is like 'wit COPY' but removes the source
                      and replace it with the new file if copying is
                      successful. It have been implemented as replacement of
                      the SCRUB command of other tools. 'wit CONVERT' does more
                      than only scrubbing and therefor it was renamed from
                      'SCRUB' to 'CONVERT', but the old command name is still
                      allowed.
  EDIT      | ED    : Edit an existing Wii and GameCube ISO image and patch
                      some values. Images, WBFS partitions and directories are
                      accepted as source.
  IMGFILES  | IF    : Print a list of all image files including their
                      associated split files. Each file is printed on a
                      separate line for further batch processing.
  REMOVE    | RM    : Remove images including their associated split files.
  MOVE      | MV    : Move and rename Wii and GameCube ISO images. Images, WBFS
                      partitions and directories are accepted as source.
  RENAME    | REN   : Rename the ID6 of discs. Disc title can also be set.
  SETTITLE  | ST    : Set the disc title of discs.

  VERIFY    | V     : Verify ISO images (calculate and compare SHA1 checksums)
                      to find bad dumps.
  SKELETON  | SKEL  : 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. Read https://wit.wiimm.de/cmd/wit/skel for more
                      details.
  MIX               : Mix the partitions from different sources into one new
                      Wii or GameCube disc.

Type 'wit HELP command' to get command specific help.

Global options:

  -V --version      Stop parsing the command line, print a version info and
                    exit.
  -h --help         Stop parsing the command line, print a help message and
                    exit.
     --xhelp        Stop parsing the command line and print a help message with
                    all commands included. Exit after printing.
     --width width  Define the width (number of columns) for help and some
                    other messages and disable the automatic detection of the
                    terminal width.
  -q --quiet        Be quiet and print only error messages.
  -v --verbose      Be verbose and print more progress information. Multiple
                    usage is possible: Progress counter is enabled if set at
                    least two times. Extended logging is enabled if set at
                    least four times. The impact of the other verbose levels
                    are command dependent.
  -P --progress     Print progress counter. If --verbose is set at least twice,
                    printing is enabled too. If progress is enabled, the
                    default of --dsync is changed.
     --scan-progress 
                    Print a message for each found image while scanning the
                    file system.
  -L --logging      This debug option enables the logging of internal memory
                    maps. If set twice second level memory maps are printed
                    too.
  -E --esc char     Define an alternative escape character for destination
                    files. The default is '%'. For Windows (CYGWIN) it is a
                    good choice to set '-E$' to avoid conflicts with command
                    shell variables.
     --color=[=modus] 
                    Define the modus for colored text output. Allowed keywords
                    are: OFF or NO-COLORS to disable colors, AUTO (default) for
                    automatic detection, ON for automatic detection but never
                    OFF, 8-COLORS and 256-COLORS for 8 and 256 color support.
                    Without parameter, ON is used.
                      AUTO will enable colorized output only for terminals.
                    AUTO and ON use environment variable TERM to find the
                    correct color modus.
                      If a command is prefixed by 'C-', then --color=ON is used
                    implicitly as default.
     --256-colors   Short cut for --color=256-colors: Force colorized text with
                    256 color support.
     --no-colors    Short cut for --color=off: Deactivate colorized text. This
                    is the default, if an output file is not a terminal.
     --io flags     Setup the IO mode for experiments. The standard file IO is
                    based on open() function. The value '1' defines that WBFS
                    IO is based on fopen() function. The value '2' defines the
                    same for ISO files and value '4' for WIA files. You can
                    combine the values by adding them.
  -f --force        Force operation.
     --dsync=[=mode] 
                    This option enables the usage of flag O_DSYNC when opening
                    a partition at a hard drive for writing. With activated
                    flag, writing an image is some percent slower, but the
                    progress counters are exact again.
                      Parameter MODE is optional. If set, it is one of OFF
                    (disable), ON (enable) or AUTO (default). With AUTO, DSYNC
                    is enabled if the progress counters are active.
                      This option has only impact, if compiler and operation
                    system support the flag O_DSYNC. Linux does.

  -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.
     --cert file    Scan a file for certificates and add them to the internal
                    certificate database. Valid sources are CERT, TICKET, TMD
                    and ISO files. All partitions of ISO images are scanned for
                    certificates. Files without certificates are ignored
                    without notification.

  -t --test         Run in test mode, modify nothing.
                    >>> USE THIS OPTION IF UNSURE! <<<

     --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.
     --gcz-zip      If creating a GCZ image, a blockwise z-compression is
                    tried. If the compressed data is larger than 98.5%, the
                    uncompressed data is stored. Encrypted blocks are stored
                    directly as uncompressed data, because the 98.5% test fails
                    all the time.
                      Option --gcz-zip disables this optimization for encrypted
                    data and makes the creation process slower.
     --gcz-block size 
                    The value defines the block size, if creating a GCZ image.
                    The default is 16K (also Dolphins default). Smaller values
                    enlarge the managment data and reduce the compression
                    ratio. Use the option with caution!

More help is available at https://wit.wiimm.de/wit



*******************************************************************************
*******                             @file                               *******
*******************************************************************************

If a parameter beginns with '@' the text behind that '@' is a filename.
Each line of the file is taken as a parameter (not option, not command).
Each line may terminate with LF or CR+LF. Handling of '@' is *not* recurse.

The special filename '-' means: read from standard input (stdin).


*******************************************************************************
*******                        Commands in detail                       *******
*******************************************************************************

The tool 'wit' processes the --source and the --recurse options to built an
internal ISO database (any ISO formats like WDF and FST included). Most of the
follwing commands works with the files of this ISO database (like 'wwt' do it
with a WBFS). The options --source and --recurse atre described in the section
"Processing --source and --recurse" in detail.

Command abbreviations are allowed as long as they are unique. The commands
are listed in alphabetic order:


-------------------------------------------------------------------------------

wit CONVERT|CV : Convert, scrub, join, split, compose, extract, patch, encrypt
                 and decrypt Wii and GameCube disc images and replace the
                 source with the result. Images, WBFS partitions and
                 directories are accepted as source. The former command name
                 was SCRUB.
                   'wit CONVERT' is like 'wit COPY' but removes the source and
                 replace it with the new file if copying is successful. It have
                 been implemented as replacement of the SCRUB command of other
                 tools. 'wit CONVERT' does more than only scrubbing and
                 therefor it was renamed from 'SCRUB' to 'CONVERT', but the old
                 command name is still allowed.

Syntax: wit CONVERT source
        wit CONVERT [[--source|--recurse] source]...

Options:

  -t --test          Run in test mode, modify nothing.
                     >>> USE THIS OPTION IF UNSURE! <<<

  -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.

  -s --source path   Use the entered file or directory as source.
                       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.
                       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.
     --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.

     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.

  -q --quiet         Be quiet and print only error messages.
  -v --verbose       Be verbose and print more progress information. Multiple
                     usage is possible: Progress counter is enabled if set at
                     least two times. Extended logging is enabled if set at
                     least four times. The impact of the other verbose levels
                     are command dependent.
  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.
  -P --progress      Print progress counter. If --verbose is set at least
                     twice, printing is enabled too. If progress is enabled,
                     the default of --dsync is changed.
     --scan-progress Print a message for each found image while scanning the
                     file system.
     --sections      Print in machine readable sections and parameter lines.
                     Read https://wit.wiimm.de/opt/sections for more details.

     --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'.
     --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.
                     See https://wit.wiimm.de/opt/id for more details.
     --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.
                     See https://wit.wiimm.de/opt/disc-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/boot-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/ticket-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/tmd-id for more details.
     --tt-id id      This is a short cut for '--ticket id --tmd id'. If TICKET
                     and TMD differ, the game will freeze after loading. So it
                     makes only sense to change TICKET and TMD IDs together.
     --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.
                     See https://wit.wiimm.de/opt/wbfs-id for more details.
     --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.
     --common-key index 
                     This patching option defines the common key index as part
                     of the TICKET. Keywords 0, STANDARD, 1 and KOREAN are
                     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).
     --http          This patching option replaces 'https' request to 'http' in
                     the files 'main.dol' and 'rel/StaticR.rel', if the files
                     exist. It also replaces the sub-domain 'naswii' to 'nas'.
     --domain domain This patching option replaces the domain
                     'nintendowifi.net' by the new domain. The length of the
                     new domain must not be larger than the old length (16
                     characters).
                       If the new domain length is not larger than 11, then
                     'gamespy.com' of 'sake.gamespy.com' is replaced too.  This
                     is a special support for 'Super Smash Bros. Brawl'.
     --wiimmfi       Patch the images for Wiimmfi, the new custom server. It is
                     a short cut for '--http --domain wiimmfi.de'.
     --rm-files ruleset 
                     This patching option defines filter rules to remove real
                     files and directories from the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --zero-files ruleset 
                     This patching option defines filter rules to zero (set
                     size to zero) real files of the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --ignore-files ruleset 
                     This option defines filter rules to ignore real files of
                     the FST of the DATA partition. Fake signing is not
                     necessary, but the partition becomes invalid, because the
                     content of some files is not copied. If such file is
                     accessed the Wii will halt immediately, because the
                     verification of the checksum calculation fails. The
                     processing order of file options is: '--rm-files
                     --zero-files --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --align-part size 
                     If creating or moving partitions the beginning of each
                     partition is set to an offset that is a multiple of the
                     align size. Size must be a power of 2 and at least 32 KiB
                     (=default).
     --align-files   If creating a partition the file 'align-files.txt' is
                     read. Files listed with values >=0x8000 (Wii sector size)
                     are automatically aligned to 0x8000.

     --auto-split    Enable auto split modus: Split only if necessary and
                     determine the split size automatically.
                       THIS OPTION IS EXPERIMENTAL. In future versions it
                     becomes the default.
     --no-split      Disable output file splitting. This is the default, but in
                     future versions, the new option --auto-split becomes the
                     default.
  -z --split         Enable output file splitting. The default split size is 4
                     GB.
  -Z --split-size sz Enable output file splitting and define a split size. The
                     parameter 'sz' is a floating point number followed by an
                     optional unit factor (one of 'cb' [=1] or 'kmgtpe'
                     [base=1000] or 'KMGTPE' [base=1024]). The default unit is
                     'G' (GiB).
     --disc-size size 
                     Define a minimal (virtual) ISO disc size.
     --prealloc=[=mode] 
                     This option enables or disables the disc space
                     preallocation. If enabled the tools try to allocate disc
                     space for the new files before writing the data. This
                     reduces the fragmentation but also disables the sparse
                     effect for preallocated areas.
                       The optional parameter decides the preallocation mode:
                     OFF (or 0), SMART (or 1), ALL (or 2). If no parameter is
                     set, ALL is used.
                       Mode 'OFF' disables the preallocation. Mode 'SMART'
                     looks into the source disc to find out the writing areas.
                     SMART is only available for ISO, CISO and WBFS file types.
                     For other file types ALL is used instead. Mode 'ALL' (the
                     default) preallocate the whole destination file. Because
                     of the large holes in plain ISO images, the SMART mode is
                     used for ISOs instead.
     --trunc         Truncate PLAIN ISO and WBFS images after creating or
                     copying to the minimal needed size with respect to the
                     block size.
     --chunk-mode mode 
                     Defines an operation mode for --chunk-size and
                     --max-chunks. Allowed keywords are 'ANY' to allow any
                     values, '32K' to force chunk sizes with a multiple of 32
                     KiB, 'POW2' to force chunk sizes >=32K and with a power of
                     2 or 'ISO' for ISO images (more restrictive as 'POW2',
                     best for USB loaders). The case of the keyword is ignored.
                     The default key is 'ISO'.
                       --chm is a shortcut for --chunk-mode.
     --chunk-size sz Define the minimal chunk size if creating a CISO or WIA
                     file (for WIA details see option --compression}). The
                     default is to calculate the chunk size from the input file
                     size and find a good value by using a minimal value of 1
                     MiB for '--chunk-mode ISO' and 32 KiB for modes 32K and
                     POW2. For the modes ISO and POW2 the value is rounded up
                     to the next power of 2. This calculation also depends from
                     option --max-chunks.
                       The parameter 'sz' is a floating point number followed
                     by an optional unit factor (one of 'cb' [=1] or 'kmgtpe'
                     [base=1000] or 'KMGTPE' [base=1024]). The default unit is
                     'M' (MiB). If the number is prefixed with a '=' then
                     options --chunk-mode and --max-chunks are ignored and the
                     given value is used without any rounding or changing.
                       If the input file size is not known (e.g. reading from
                     pipe), its size is assumed as 12 GiB.
                       --chs is a shortcut for --chunk-size.
     --max-chunks n  Define the maximal number of chunks if creating a CISO
                     file. The default value is 8192 for '--chunk-mode ISO' and
                     32760 (maximal value) for all other modes. If this value
                     is set than the automatic calculation of --chunk-size will
                     be modified too.
                       --mch is a shortcut for --max-chunks.
     --compression mode 
                     Select one compression method, level and chunk size for
                     new WIA files. The syntax for mode is: [method] [.level]
                     [@factor]
                       'method' is the name of the method. Possible
                     compressions method are NONE, PURGE, BZIP2, LZMA and
                     LZMA2. There are additional keywords: DEFAULT
                     (=LZMA.5@20), FAST (=BZIP2.3@10), GOOD (=LZMA.5@20) BEST
                     (=LZMA.7@50), and MEM (use best mode in respect to memory
                     limit set by --mem). Additionally the single digit modes 0
                     (=NONE), 1 (=fast LZMA) .. 9 (=BEST)are defined. These
                     additional keywords may change their meanings if a new
                     compression method is implemented.
                       '.level' is a point followed by one digit. It defines
                     the compression level. The special value .0 means: Use
                     default compression level (=.5).
                       '@factor' is a factor for the chunk size. The base size
                     is 2 MiB. The value @0 is replaced by the default factor
                     @20 (40 MiB). If the factor is not set but option
                     --chunk-size is set, the factor will be calculated by
                     using a rounded value of that option.
                       All three parts are optional. All default values may be
                     changed in the future. --compr is a shortcut for
                     --compression and --wia=mode a shortcut for '--wia
                     --compression mode'. The command 'wit COMPR' prints an
                     overview about all compression modes.
     --mem size      This option defines a memory usage limit for compressing
                     files (in MiB if no other unit is entered). When
                     compressing a file with method MEM (see --compression) the
                     the compression method, level and chunk size are selected
                     with respect to this limit.
                       If this option is not set or the value is 0, then the
                     environment WIT_MEM is tried to read instead. If this
                     fails, the tool tries to find out the total memory by
                     reading /proc/meminfo. The limit is set to 80% of the
                     total memory minus 50 MiB.
  -p --preserve      Preserve file times (atime+mtime) while copying an image.
                     This option is enabled by default if an unmodified disc
                     image is copied.
  -W --wdf=[=param]  Set the image output file type to WDF (Wii Disc Format).
                     The output format is either WDFv1 or WDFv2. 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).
     --wia=[=compr]  Set image output file type to WIA (Wii ISO Archive). The
                     optional parameter is a compression mode and --wia=mode is
                     a shortcut for '--wia --compression mode'.
  -G --gcz           Set image output file type to GCZ (Dolphins GameCube Zip).
     --gcz-zip       If creating a GCZ image, a blockwise z-compression is
                     tried. If the compressed data is larger than 98.5%, the
                     uncompressed data is stored. Encrypted blocks are stored
                     directly as uncompressed data, because the 98.5% test
                     fails all the time.
                       Option --gcz-zip disables this optimization for
                     encrypted data and makes the creation process slower.
     --gcz-block size 
                     The value defines the block size, if creating a GCZ image.
                     The default is 16K (also Dolphins default). Smaller values
                     enlarge the managment data and reduce the compression
                     ratio. Use the option with caution!

More help is available at https://wit.wiimm.de/cmd/wit/convert



-------------------------------------------------------------------------------

wit COPY|CP : Copy, scrub, convert, join, split, compose, extract, patch,
              encrypt and decrypt Wii and GameCube disc images. Images, WBFS
              partitions and directories are accepted as source.

Syntax: wit COPY source dest
        wit COPY [[--source|--recurse] source]... [-d|-D] dest

Options:

  -t --test          Run in test mode, modify nothing.
                     >>> USE THIS OPTION IF UNSURE! <<<

  -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.
                       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.
                       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.
     --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.

     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.
     --pmode p-mode  This options set the prefix mode for listed or extracted
                     files. One of the following values is allowed: AUTO, NONE,
                     POINT, ID, NAME, INDEX, COMBI. The default value is
                     'AUTO'. See https://wit.wiimm.de/opt/pmode for more
                     details.
     --flat          While extracting a disc image strip all path names of the
                     source file and store all files in the same directory.
                     This option sets the default for --pmode to NONE.
  -F --files ruleset Append file select rules. This option can be used multiple
                     times to extend the rule list. Rules beginning with a '+'
                     or a '-' are allow or deny rules rules. Rules beginning
                     with a ':' are macros for predefined rule sets.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --copy-gc       If extracting a GameCube disc image, don't extract the
                     real files to '/files/...'. Instead create a copy of the
                     source image and store it as 'game.iso'. If the source
                     image is already in this format, try to create a hard link
                     and copy only if it fails.
     --no-link       Don't try to create a hard link if copying the image
                     forced by the option --copy-gc.
     --neek          Abbreviation of '--psel data --pmode none --files :neek
                     --copy-gc'. The old name --sneek is accepted too.
     --prealloc=[=mode] 
                     This option enables or disables the disc space
                     preallocation. If enabled the tools try to allocate disc
                     space for the new files before writing the data. This
                     reduces the fragmentation but also disables the sparse
                     effect for preallocated areas.
                       The optional parameter decides the preallocation mode:
                     OFF (or 0), SMART (or 1), ALL (or 2). If no parameter is
                     set, ALL is used.
                       Mode 'OFF' disables the preallocation. Mode 'SMART'
                     looks into the source disc to find out the writing areas.
                     SMART is only available for ISO, CISO and WBFS file types.
                     For other file types ALL is used instead. Mode 'ALL' (the
                     default) preallocate the whole destination file. Because
                     of the large holes in plain ISO images, the SMART mode is
                     used for ISOs instead.
  -S --sort list     Define the extracting order. The parameter is a comma
                     separated list of the following keywords: NONE, NAME,
                     SIZE, OFFSET, ASCENDING, DESCENDING = REVERSE.

  -q --quiet         Be quiet and print only error messages.
  -v --verbose       Be verbose and print more progress information. Multiple
                     usage is possible: Progress counter is enabled if set at
                     least two times. Extended logging is enabled if set at
                     least four times. The impact of the other verbose levels
                     are command dependent.
  -l --long          Print a summary line while extracting files. If set at
                     least twice, print a status line for each extracted files.
  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.
  -P --progress      Print progress counter. If --verbose is set at least
                     twice, printing is enabled too. If progress is enabled,
                     the default of --dsync is changed.
     --scan-progress Print a message for each found image while scanning the
                     file system.
     --sections      Print in machine readable sections and parameter lines.
                     Read https://wit.wiimm.de/opt/sections for more details.

     --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'.
     --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.
                     See https://wit.wiimm.de/opt/id for more details.
     --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.
                     See https://wit.wiimm.de/opt/disc-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/boot-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/ticket-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/tmd-id for more details.
     --tt-id id      This is a short cut for '--ticket id --tmd id'. If TICKET
                     and TMD differ, the game will freeze after loading. So it
                     makes only sense to change TICKET and TMD IDs together.
     --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.
                     See https://wit.wiimm.de/opt/wbfs-id for more details.
     --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.
     --common-key index 
                     This patching option defines the common key index as part
                     of the TICKET. Keywords 0, STANDARD, 1 and KOREAN are
                     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).
     --http          This patching option replaces 'https' request to 'http' in
                     the files 'main.dol' and 'rel/StaticR.rel', if the files
                     exist. It also replaces the sub-domain 'naswii' to 'nas'.
     --domain domain This patching option replaces the domain
                     'nintendowifi.net' by the new domain. The length of the
                     new domain must not be larger than the old length (16
                     characters).
                       If the new domain length is not larger than 11, then
                     'gamespy.com' of 'sake.gamespy.com' is replaced too.  This
                     is a special support for 'Super Smash Bros. Brawl'.
     --wiimmfi       Patch the images for Wiimmfi, the new custom server. It is
                     a short cut for '--http --domain wiimmfi.de'.
     --rm-files ruleset 
                     This patching option defines filter rules to remove real
                     files and directories from the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --zero-files ruleset 
                     This patching option defines filter rules to zero (set
                     size to zero) real files of the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --ignore-files ruleset 
                     This option defines filter rules to ignore real files of
                     the FST of the DATA partition. Fake signing is not
                     necessary, but the partition becomes invalid, because the
                     content of some files is not copied. If such file is
                     accessed the Wii will halt immediately, because the
                     verification of the checksum calculation fails. The
                     processing order of file options is: '--rm-files
                     --zero-files --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --align-part size 
                     If creating or moving partitions the beginning of each
                     partition is set to an offset that is a multiple of the
                     align size. Size must be a power of 2 and at least 32 KiB
                     (=default).
     --align-files   If creating a partition the file 'align-files.txt' is
                     read. Files listed with values >=0x8000 (Wii sector size)
                     are automatically aligned to 0x8000.

  -d --dest path     Define a destination path (directory or file). The
                     destination path is scanned for escape sequences (see
                     option --esc) to allow generic paths.
  -D --DEST path     Like --dest, but create the directory path automatically.
  -E --esc char      Define an alternative escape character for destination
                     files. The default is '%'. For Windows (CYGWIN) it is a
                     good choice to set '-E$' to avoid conflicts with command
                     shell variables.
  -p --preserve      Preserve file times (atime+mtime) while copying an image.
                     This option is enabled by default if an unmodified disc
                     image is copied.
  -o --overwrite     Overwrite already existing files without warning.
  -u --update        Copy only files that do not exist. Already existing files
                     are ignored without warning.
     --diff          Diff source and destination after copying.
  -R --remove        Remove source files/discs if operation is successful. If
                     the source is an extracted file systems (FST) it isn't
                     removed.
     --auto-split    Enable auto split modus: Split only if necessary and
                     determine the split size automatically.
                       THIS OPTION IS EXPERIMENTAL. In future versions it
                     becomes the default.
     --no-split      Disable output file splitting. This is the default, but in
                     future versions, the new option --auto-split becomes the
                     default.
  -z --split         Enable output file splitting. The default split size is 4
                     GB.
  -Z --split-size sz Enable output file splitting and define a split size. The
                     parameter 'sz' is a floating point number followed by an
                     optional unit factor (one of 'cb' [=1] or 'kmgtpe'
                     [base=1000] or 'KMGTPE' [base=1024]). The default unit is
                     'G' (GiB).
     --disc-size size 
                     Define a minimal (virtual) ISO disc size.
     --trunc         Truncate PLAIN ISO and WBFS images after creating or
                     copying to the minimal needed size with respect to the
                     block size.
     --chunk-mode mode 
                     Defines an operation mode for --chunk-size and
                     --max-chunks. Allowed keywords are 'ANY' to allow any
                     values, '32K' to force chunk sizes with a multiple of 32
                     KiB, 'POW2' to force chunk sizes >=32K and with a power of
                     2 or 'ISO' for ISO images (more restrictive as 'POW2',
                     best for USB loaders). The case of the keyword is ignored.
                     The default key is 'ISO'.
                       --chm is a shortcut for --chunk-mode.
     --chunk-size sz Define the minimal chunk size if creating a CISO or WIA
                     file (for WIA details see option --compression}). The
                     default is to calculate the chunk size from the input file
                     size and find a good value by using a minimal value of 1
                     MiB for '--chunk-mode ISO' and 32 KiB for modes 32K and
                     POW2. For the modes ISO and POW2 the value is rounded up
                     to the next power of 2. This calculation also depends from
                     option --max-chunks.
                       The parameter 'sz' is a floating point number followed
                     by an optional unit factor (one of 'cb' [=1] or 'kmgtpe'
                     [base=1000] or 'KMGTPE' [base=1024]). The default unit is
                     'M' (MiB). If the number is prefixed with a '=' then
                     options --chunk-mode and --max-chunks are ignored and the
                     given value is used without any rounding or changing.
                       If the input file size is not known (e.g. reading from
                     pipe), its size is assumed as 12 GiB.
                       --chs is a shortcut for --chunk-size.
     --max-chunks n  Define the maximal number of chunks if creating a CISO
                     file. The default value is 8192 for '--chunk-mode ISO' and
                     32760 (maximal value) for all other modes. If this value
                     is set than the automatic calculation of --chunk-size will
                     be modified too.
                       --mch is a shortcut for --max-chunks.
     --compression mode 
                     Select one compression method, level and chunk size for
                     new WIA files. The syntax for mode is: [method] [.level]
                     [@factor]
                       'method' is the name of the method. Possible
                     compressions method are NONE, PURGE, BZIP2, LZMA and
                     LZMA2. There are additional keywords: DEFAULT
                     (=LZMA.5@20), FAST (=BZIP2.3@10), GOOD (=LZMA.5@20) BEST
                     (=LZMA.7@50), and MEM (use best mode in respect to memory
                     limit set by --mem). Additionally the single digit modes 0
                     (=NONE), 1 (=fast LZMA) .. 9 (=BEST)are defined. These
                     additional keywords may change their meanings if a new
                     compression method is implemented.
                       '.level' is a point followed by one digit. It defines
                     the compression level. The special value .0 means: Use
                     default compression level (=.5).
                       '@factor' is a factor for the chunk size. The base size
                     is 2 MiB. The value @0 is replaced by the default factor
                     @20 (40 MiB). If the factor is not set but option
                     --chunk-size is set, the factor will be calculated by
                     using a rounded value of that option.
                       All three parts are optional. All default values may be
                     changed in the future. --compr is a shortcut for
                     --compression and --wia=mode a shortcut for '--wia
                     --compression mode'. The command 'wit COMPR' prints an
                     overview about all compression modes.
     --mem size      This option defines a memory usage limit for compressing
                     files (in MiB if no other unit is entered). When
                     compressing a file with method MEM (see --compression) the
                     the compression method, level and chunk size are selected
                     with respect to this limit.
                       If this option is not set or the value is 0, then the
                     environment WIT_MEM is tried to read instead. If this
                     fails, the tool tries to find out the total memory by
                     reading /proc/meminfo. The limit is set to 80% of the
                     total memory minus 50 MiB.

  -W --wdf=[=param]  Set the image output file type to WDF (Wii Disc Format).
                     The output format is either WDFv1 or WDFv2. 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).
     --wia=[=compr]  Set image output file type to WIA (Wii ISO Archive). The
                     optional parameter is a compression mode and --wia=mode is
                     a shortcut for '--wia --compression mode'.
  -G --gcz           Set image output file type to GCZ (Dolphins GameCube Zip).
     --gcz-zip       If creating a GCZ image, a blockwise z-compression is
                     tried. If the compressed data is larger than 98.5%, the
                     uncompressed data is stored. Encrypted blocks are stored
                     directly as uncompressed data, because the 98.5% test
                     fails all the time.
                       Option --gcz-zip disables this optimization for
                     encrypted data and makes the creation process slower.
     --gcz-block size 
                     The value defines the block size, if creating a GCZ image.
                     The default is 16K (also Dolphins default). Smaller values
                     enlarge the managment data and reduce the compression
                     ratio. Use the option with caution!
     --fst           Set image output mode to 'file system' (extracted ISO).

More help is available at https://wit.wiimm.de/cmd/wit/copy



-------------------------------------------------------------------------------

wit CREATE : Create a system file (TICKET or TMD).

Syntax: wit CREATE TICKET outfile [--id id] [title_id] [decrypted_key]
        wit CREATE TMD outfile [--id id] [--ios ios] [hash_val]

Options:

  -t --test       Run in test mode, modify nothing.
                  >>> USE THIS OPTION IF UNSURE! <<<
  -d --dest path  Define a destination path (directory/file). This path is
                  concatenated with the outfile.
  -D --DEST path  Like --dest, but create the directory path automatically.
  -o --overwrite  Overwrite already existing files without warning.

     --id id      Define an ID for the TICKET or TMD.
     --ios ios    Define an IOS/SYS-VERSION for the TMD.

More help is available at https://wit.wiimm.de/cmd/wit/create



-------------------------------------------------------------------------------

wit DIFF|CMP : DIFF compares ISO images in scrubbed or raw mode or on file
               level. Images, WBFS partitions and directories are accepted as
               source. DIFF works like COPY but comparing source and
               destination.

Syntax: wit DIFF source dest
        wit DIFF [[--source|--recurse] source]... [-d|-D] dest

Options:

  -t --test          Run in test mode, modify nothing.
                     >>> USE THIS OPTION IF UNSURE! <<<
  -F --files ruleset Enter file mode (compare file by file) and append file
                     select rules. This option can be used multiple times to
                     extend the rule list. Rules beginning with a '+' or a '-'
                     are allow or deny rules rules. Rules beginning with a ':'
                     are macros for predefined rule sets.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.

  -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.
                       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.
                       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.
     --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.

     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.
     --pmode p-mode  This options set the prefix mode for listed or extracted
                     files. One of the following values is allowed: AUTO, NONE,
                     POINT, ID, NAME, INDEX, COMBI. The default value is
                     'AUTO'. See https://wit.wiimm.de/opt/pmode for more
                     details.
     --flat          While extracting a disc image strip all path names of the
                     source file and store all files in the same directory.
                     This option sets the default for --pmode to NONE.
     --copy-gc       If extracting a GameCube disc image, don't extract the
                     real files to '/files/...'. Instead create a copy of the
                     source image and store it as 'game.iso'. If the source
                     image is already in this format, try to create a hard link
                     and copy only if it fails.
     --no-link       Don't try to create a hard link if copying the image
                     forced by the option --copy-gc.
     --neek          Abbreviation of '--psel data --pmode none --files :neek
                     --copy-gc'. The old name --sneek is accepted too.

  -q --quiet         Be quiet and print only error messages and failure
                     messages on mismatch. The comparison is aborted at the
                     first mismatch for each source image. If set twice print
                     nothing and report the diff result only as exit status and
                     the complete comparison is aborted at the first mismatch
                     at all.
  -v --verbose       The default is to print only differ messages. If set
                     success messages and summaries are printed too. If set at
                     least twice, a progress counter is printed too.
  -P --progress      Print progress counter. If --verbose is set at least
                     twice, printing is enabled too. If progress is enabled,
                     the default of --dsync is changed.
     --scan-progress Print a message for each found image while scanning the
                     file system.
     --file-limit size 
                     This option is only used if comparing discs on file level.
                     If not set or set to null, then all files will be
                     compared. If set to a value greater than comparison is
                     aborted for the current source image if the entered number
                     of files differ. This option is ignored in quiet mode.
     --limit num     If not set, the comparison of the current file is aborted
                     if a mismatch is found. If set, the comparison is aborted
                     after 'limit' mismatches. To compare the whole file use
                     the special value 0. This option is ignored in quiet mode.
  -l --long          If set, a status line with the offset is printed for each
                     found mismatch. If set twice, an additional hex dump of
                     the first bytes is printed. If set 3 or 4 times, the limit
                     is set to 10 or unlimited if option --limit is not already
                     set. This option is ignored in quiet mode.
     --block-size size 
                     If a mismatch is found in raw or disc mode then the
                     comparison is continued with the next block. This option
                     sets the block size. The default value is 32K (Wii sector
                     size). This option is ignored in quiet mode.
     --sections      Print in machine readable sections and parameter lines.
                     Read https://wit.wiimm.de/opt/sections for more details.
  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.

  -d --dest path     Define a destination path (directory or file). The
                     destination path is scanned for escape sequences (see
                     option --esc) to allow generic paths.
  -D --DEST path     Like --dest, but create the directory path automatically.
  -E --esc char      Define an alternative escape character for destination
                     files. The default is '%'. For Windows (CYGWIN) it is a
                     good choice to set '-E$' to avoid conflicts with command
                     shell variables.
  -W --wdf=[=param]  Set the image output file type to WDF (Wii Disc Format).
                     The output format is either WDFv1 or WDFv2. 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).
     --wia=[=compr]  Set image output file type to WIA (Wii ISO Archive). The
                     optional parameter is a compression mode and --wia=mode is
                     a shortcut for '--wia --compression mode'.
  -G --gcz           Set image output file type to GCZ (Dolphins GameCube Zip).
     --gcz-zip       If creating a GCZ image, a blockwise z-compression is
                     tried. If the compressed data is larger than 98.5%, the
                     uncompressed data is stored. Encrypted blocks are stored
                     directly as uncompressed data, because the 98.5% test
                     fails all the time.
                       Option --gcz-zip disables this optimization for
                     encrypted data and makes the creation process slower.
     --gcz-block size 
                     The value defines the block size, if creating a GCZ image.
                     The default is 16K (also Dolphins default). Smaller values
                     enlarge the managment data and reduce the compression
                     ratio. Use the option with caution!
     --fst           Set image output mode to 'file system' (extracted ISO).

More help is available at https://wit.wiimm.de/cmd/wit/diff


 The command DIFF compares all given sources agains a destination (directory).
 If the option --dest is not set the last parameter is used as destination.
 If exact one source file is given the destination can be a file name. If two
 or more source files given the destination must be a directory. Option --DEST
 is like --dest, but the directory path is created automaticaly.

 Each source is candidate for comparing. Non ISO files are ignored with a warning.
 The option --ignore suppresses this warning.

 If option --long is set, the first failed position is printed. If option --long
 is set two or more times all falied positions are printed, but only the first
 position of each ISO block. The size of an ISO block is 0x8000 = 32768 bytes.

 In file mode (--files=) the rules are changed. The ISO images are compared on
 file level. System areas like disc and aprtiton headers are also served as
 files. Only files that matches the defined filters will be compared. In --quiet
 mode the comparing is done silently. Otherwise all non equal or missing files
 are reported.


 DESTINATION FILENAME

    The destination filenames are scanned for escape sequences beginning with
    the escape character '%'. The accepted format is:

        '%cX'  or  '%mcX'  or  '%n-mcX'

    'n' is the number of skipped characters of the field.

    'm' is the zero based index of the last copied character.

    'c' is an optional character. If c is 'u' then the source will be
    converted into upper case and if c is 'l' into lower case.

    'X' selects the source and is one of (ignoring case):
        'I' : ID6
        'N' : Disc name
        'T' : Title of title db. If no title found the disc name is used.
        'E' : The default extension ('wdf', 'iso', 'ciso' or 'wbfs')
        'P' : The path (all upto the last '/') of the source file
        'F' : The filename (start behind the last '/') of the source file
        'X' : Extended filename: A shortcut for '%T [%I].%E'
        'Y' : Extended filename: A shortcut for '%T [%I]' (no file extension)
        '+' : The default filename: WBFS='%I.%E', all other='%X'

    To use the '%' sign itself just type '%%'.

    Examples:
        '%4I.%E'    : Store the disc with ID4 as name.
        '%1uT/%X'   : Store the disc into a subdirectory named with the
                      first character (upper case) of the title.
        '%3-4lI/%X' : Store the disc into aa subdirectory named with the
                      language code of the ID using the lower case letter.
        '%P/%X'     : Store the disc into the directory of the source
                      with the extended filename.

    Instead of '%' an alternative escape character can be used. It is defined
    by the option --esc= (-E). This makes live easier if using the cygwin
    version together with the windows shell 'cmd'. Define the environment
    variables 'WIT_OPT' and/or 'WWT_OPT' for a new default definition.
     Example for Unix bash: export WIT_OPT="--esc=$"
     Example for Windows:   set WIT_OPT=--esc=$


 Usual ERROR/EXIT CODES:

    0 == OK             : all done without errors.
    DIFFER              : At least one file pair differ.
    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 OPEN           : Can't open file.


-------------------------------------------------------------------------------

wit DUMP|D : Dump the data structure and content of Wii and GameCube ISO files,
             cert.bin, ticket.bin, tmd.bin, header.bin, boot.bin, fst.bin and
             of DOL-files. The file type is detected automatically by analyzing
             the content.

Syntax: wit DUMP [source]...

Options:

  -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.
                       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.
                       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).

     --ignore-fst    Disable composing and ignore FST directories as input.
     --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.
     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.
     --pmode p-mode  This options set the prefix mode for listed or extracted
                     files. One of the following values is allowed: AUTO, NONE,
                     POINT, ID, NAME, INDEX, COMBI. The default value is
                     'AUTO'. See https://wit.wiimm.de/opt/pmode for more
                     details.
     --flat          While extracting a disc image strip all path names of the
                     source file and store all files in the same directory.
                     This option sets the default for --pmode to NONE.
  -F --files ruleset Append file select rules. This option can be used multiple
                     times to extend the rule list. Rules beginning with a '+'
                     or a '-' are allow or deny rules rules. Rules beginning
                     with a ':' are macros for predefined rule sets.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --copy-gc       If extracting a GameCube disc image, don't extract the
                     real files to '/files/...'. Instead create a copy of the
                     source image and store it as 'game.iso'. If the source
                     image is already in this format, try to create a hard link
                     and copy only if it fails.
     --no-link       Don't try to create a hard link if copying the image
                     forced by the option --copy-gc.
     --neek          Abbreviation of '--psel data --pmode none --files :neek
                     --copy-gc'. The old name --sneek is accepted too.

  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.
  -l --long          Images: If set at least once a memory map for each
                     partition is printed. If set twice or more a memory map
                     for whole ISO image is printed.
                      DOL files: If set, a third table with delta values
                     between the virtual address and the file offset is
                     printed.
  -+ --show list     This option allows fine control over the things that are
                     to be printed. The parameter is a comma separated list of
                     the following keywords, case is ignored: NONE, INTRO,
                     HEADER, SLOTS, GEOMETRY, D-ID, P-ID, P-TAB, P-INFO, P-MAP,
                     D-MAP, W-MAP, TICKET, TMD, USAGE, PATCH, RELOCATE, FILES,
                     UNUSED, OFFSET, SIZE, PATH and ALL. There are some
                     combined keys: ID := D-ID,P-ID, PART :=
                     P-INFO,P-ID,P-MAP,TICKET,TMD, DISC := FILES,D-ID,D-MAP,
                     MAP := P-MAP,D-MAP,W-MAP.
                       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.
                       The additional keywords DEC and HEX can be used to set a
                     prefered number format. -HEADER suppresses the output of
                     header lines.
                       The commands recognize only some of these keywords and
                     ignore the others. If --show is set, option --long is
                     ignored for selecting output elements.

     --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'.
     --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.
                     See https://wit.wiimm.de/opt/id for more details.
     --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.
                     See https://wit.wiimm.de/opt/disc-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/boot-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/ticket-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/tmd-id for more details.
     --tt-id id      This is a short cut for '--ticket id --tmd id'. If TICKET
                     and TMD differ, the game will freeze after loading. So it
                     makes only sense to change TICKET and TMD IDs together.
     --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.
                     See https://wit.wiimm.de/opt/wbfs-id for more details.
     --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.
     --common-key index 
                     This patching option defines the common key index as part
                     of the TICKET. Keywords 0, STANDARD, 1 and KOREAN are
                     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).
     --http          This patching option replaces 'https' request to 'http' in
                     the files 'main.dol' and 'rel/StaticR.rel', if the files
                     exist. It also replaces the sub-domain 'naswii' to 'nas'.
     --domain domain This patching option replaces the domain
                     'nintendowifi.net' by the new domain. The length of the
                     new domain must not be larger than the old length (16
                     characters).
                       If the new domain length is not larger than 11, then
                     'gamespy.com' of 'sake.gamespy.com' is replaced too.  This
                     is a special support for 'Super Smash Bros. Brawl'.
     --wiimmfi       Patch the images for Wiimmfi, the new custom server. It is
                     a short cut for '--http --domain wiimmfi.de'.
     --rm-files ruleset 
                     This patching option defines filter rules to remove real
                     files and directories from the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --zero-files ruleset 
                     This patching option defines filter rules to zero (set
                     size to zero) real files of the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --ignore-files ruleset 
                     This option defines filter rules to ignore real files of
                     the FST of the DATA partition. Fake signing is not
                     necessary, but the partition becomes invalid, because the
                     content of some files is not copied. If such file is
                     accessed the Wii will halt immediately, because the
                     verification of the checksum calculation fails. The
                     processing order of file options is: '--rm-files
                     --zero-files --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --align-part size 
                     If creating or moving partitions the beginning of each
                     partition is set to an offset that is a multiple of the
                     align size. Size must be a power of 2 and at least 32 KiB
                     (=default).
     --align-files   If creating a partition the file 'align-files.txt' is
                     read. Files listed with values >=0x8000 (Wii sector size)
                     are automatically aligned to 0x8000.
     --disc-size size 
                     Define a minimal (virtual) ISO disc size.

More help is available at https://wit.wiimm.de/cmd/wit/dump


 DUMP will dumps the data structure of all ISO files. If the option --long is
 set an additional memory map for each partition is printed. If the option
 --long is set twice or more an additional memory map for the whole ISO file
 is printed at the end. Failures (overlapped areas) are marked with '!'. If
 the option --long is set three times or more a total memory is appended at
 the end of the dump.

 If the option --files= is set than a file list is included into the dump.
 The rules define which files are listet. To list all files use "--files=+".
 The section "Selecting files with --files=rules" dicuss more details.
 The options --psel= and --raw are only used to make a pre selection of
 the partitions for the file list.


 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 read a file given by option --part.


-------------------------------------------------------------------------------

wit EDIT|ED : Edit an existing Wii and GameCube ISO image and patch some
              values. Images, WBFS partitions and directories are accepted as
              source.

Syntax: wit EDIT source
        wit EDIT [[--source|--recurse] source]...

Options:

  -t --test          Run in test mode, modify nothing.
                     >>> USE THIS OPTION IF UNSURE! <<<

  -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.

  -s --source path   Use the entered file or directory as source.
                       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.
                       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.

  -q --quiet         Be quiet and print only error messages.
  -v --verbose       Be verbose and print more progress information. Multiple
                     usage is possible: Progress counter is enabled if set at
                     least two times. Extended logging is enabled if set at
                     least four times. The impact of the other verbose levels
                     are command dependent.
     --sections      Print in machine readable sections and parameter lines.
                     Read https://wit.wiimm.de/opt/sections for more details.
  -p --preserve      Preserve file times (atime+mtime) while copying an image.
                     This option is enabled by default if an unmodified disc
                     image is copied.

     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.
     --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'.
     --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.
                     See https://wit.wiimm.de/opt/id for more details.
     --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.
                     See https://wit.wiimm.de/opt/disc-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/boot-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/ticket-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/tmd-id for more details.
     --tt-id id      This is a short cut for '--ticket id --tmd id'. If TICKET
                     and TMD differ, the game will freeze after loading. So it
                     makes only sense to change TICKET and TMD IDs together.
     --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.
                     See https://wit.wiimm.de/opt/wbfs-id for more details.
     --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.
     --common-key index 
                     This patching option defines the common key index as part
                     of the TICKET. Keywords 0, STANDARD, 1 and KOREAN are
                     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).
     --http          This patching option replaces 'https' request to 'http' in
                     the files 'main.dol' and 'rel/StaticR.rel', if the files
                     exist. It also replaces the sub-domain 'naswii' to 'nas'.
     --domain domain This patching option replaces the domain
                     'nintendowifi.net' by the new domain. The length of the
                     new domain must not be larger than the old length (16
                     characters).
                       If the new domain length is not larger than 11, then
                     'gamespy.com' of 'sake.gamespy.com' is replaced too.  This
                     is a special support for 'Super Smash Bros. Brawl'.
     --wiimmfi       Patch the images for Wiimmfi, the new custom server. It is
                     a short cut for '--http --domain wiimmfi.de'.
     --rm-files ruleset 
                     This patching option defines filter rules to remove real
                     files and directories from the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --zero-files ruleset 
                     This patching option defines filter rules to zero (set
                     size to zero) real files of the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --wdf1 [=param] If the image format is WDF, then force WDF version 1. The
                     optional aligning factor is ignored.
     --wdf2 [=param] If the image format is WDF, then force WDF version 2. The
                     optional aligning factor is ignored.

More help is available at https://wit.wiimm.de/cmd/wit/edit



-------------------------------------------------------------------------------

wit ERROR|ERR : Translate an exit code to a message name. If no exit code is
                entered, print a table with all error messages.

Syntax: wit ERROR [error_code]

Options:

     --sections   Print in machine readable sections and parameter lines. Read
                  https://wit.wiimm.de/opt/sections for more details.
  -H --no-header  Suppress printing of header and footer.
  -l --long       Print a message text instead of a message name.

More help is available at https://wit.wiimm.de/cmd/wit/error


 The command ERROR translate an exit code to a text message. Without parameters
 print all error names and error messages. With a given 'error_code' the error
 message that belongs the number is printed to stdout and the program exits
 with exit status is 0 (success). If the error_code is unknown or invalid the
 error message is '?' and the program exits with exit status is 1 (failure).

 Without 'error_code' a list of all error codes is printed. The output
 contains three columns separated with colons. The format is:

    error code ':' error name ':' error messages

 If the option --sections is set, then the layout is completly changed to a
 sections base output. This output is machine readable. The output looks like:

	[error-CODE]
	code=ERROR_NUMBER
	name=ERROR_NAME
	text=ERROR_TEXT


 Usual ERROR/EXIT CODES:

    0 == OK        : all done.
    SYNTAX ERROR   : at least one syntax error in command line found.
    SEMANTIC ERROR : unkown error_code given.


-------------------------------------------------------------------------------

wit EXCLUDE : Dump the internal exclude database to standard output (stdout).

Syntax: wit EXCLUDE [additional_excludes]...

Options:

  -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.

More help is available at https://wit.wiimm.de/cmd/wit/exclude


 The command 'EXCLUDE' builts the exclude data base and prints the result to
 stdout. The handling of the additional files works like the --exclude option.
 The section "Processing exclude options" explains the options in detail.


 Usual ERROR/EXIT CODES:

    0 == OK        : all done.
    SYNTAX ERROR   : at least one syntax error in command line found.


-------------------------------------------------------------------------------

wit EXTRACT|X : Extract all files of each source to new directory structures.
                Images, WBFS partitions and directories are accepted as source.

Syntax: wit EXTRACT source dest
        wit EXTRACT [[--source|--recurse] source]... [-d|-D] dest

Options:

  -t --test          Run in test mode, modify nothing.
                     >>> USE THIS OPTION IF UNSURE! <<<

  -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.
                       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.
                       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.
     --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.

     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.
     --pmode p-mode  This options set the prefix mode for listed or extracted
                     files. One of the following values is allowed: AUTO, NONE,
                     POINT, ID, NAME, INDEX, COMBI. The default value is
                     'AUTO'. See https://wit.wiimm.de/opt/pmode for more
                     details.
     --flat          While extracting a disc image strip all path names of the
                     source file and store all files in the same directory.
                     This option sets the default for --pmode to NONE.
  -F --files ruleset Append file select rules. This option can be used multiple
                     times to extend the rule list. Rules beginning with a '+'
                     or a '-' are allow or deny rules rules. Rules beginning
                     with a ':' are macros for predefined rule sets.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --copy-gc       If extracting a GameCube disc image, don't extract the
                     real files to '/files/...'. Instead create a copy of the
                     source image and store it as 'game.iso'. If the source
                     image is already in this format, try to create a hard link
                     and copy only if it fails.
     --no-link       Don't try to create a hard link if copying the image
                     forced by the option --copy-gc.
     --neek          Abbreviation of '--psel data --pmode none --files :neek
                     --copy-gc'. The old name --sneek is accepted too.
     --prealloc=[=mode] 
                     This option enables or disables the disc space
                     preallocation. If enabled the tools try to allocate disc
                     space for the new files before writing the data. This
                     reduces the fragmentation but also disables the sparse
                     effect for preallocated areas.
                       The optional parameter decides the preallocation mode:
                     OFF (or 0), SMART (or 1), ALL (or 2). If no parameter is
                     set, ALL is used.
                       Mode 'OFF' disables the preallocation. Mode 'SMART'
                     looks into the source disc to find out the writing areas.
                     SMART is only available for ISO, CISO and WBFS file types.
                     For other file types ALL is used instead. Mode 'ALL' (the
                     default) preallocate the whole destination file. Because
                     of the large holes in plain ISO images, the SMART mode is
                     used for ISOs instead.
  -S --sort list     Define the extracting order. The parameter is a comma
                     separated list of the following keywords: NONE, NAME,
                     SIZE, OFFSET, ASCENDING, DESCENDING = REVERSE.

  -q --quiet         Be quiet and print only error messages.
  -v --verbose       Be verbose and print more progress information. Multiple
                     usage is possible: Progress counter is enabled if set at
                     least two times. Extended logging is enabled if set at
                     least four times. The impact of the other verbose levels
                     are command dependent.
  -l --long          Print a summary line while extracting files. If set at
                     least twice, print a status line for each extracted files.
  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.
  -P --progress      Print progress counter. If --verbose is set at least
                     twice, printing is enabled too. If progress is enabled,
                     the default of --dsync is changed.
     --scan-progress Print a message for each found image while scanning the
                     file system.
     --sections      Print in machine readable sections and parameter lines.
                     Read https://wit.wiimm.de/opt/sections for more details.

     --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'.
     --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.
                     See https://wit.wiimm.de/opt/id for more details.
     --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.
                     See https://wit.wiimm.de/opt/disc-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/boot-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/ticket-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/tmd-id for more details.
     --tt-id id      This is a short cut for '--ticket id --tmd id'. If TICKET
                     and TMD differ, the game will freeze after loading. So it
                     makes only sense to change TICKET and TMD IDs together.
     --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.
                     See https://wit.wiimm.de/opt/wbfs-id for more details.
     --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.
     --common-key index 
                     This patching option defines the common key index as part
                     of the TICKET. Keywords 0, STANDARD, 1 and KOREAN are
                     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).
     --http          This patching option replaces 'https' request to 'http' in
                     the files 'main.dol' and 'rel/StaticR.rel', if the files
                     exist. It also replaces the sub-domain 'naswii' to 'nas'.
     --domain domain This patching option replaces the domain
                     'nintendowifi.net' by the new domain. The length of the
                     new domain must not be larger than the old length (16
                     characters).
                       If the new domain length is not larger than 11, then
                     'gamespy.com' of 'sake.gamespy.com' is replaced too.  This
                     is a special support for 'Super Smash Bros. Brawl'.
     --wiimmfi       Patch the images for Wiimmfi, the new custom server. It is
                     a short cut for '--http --domain wiimmfi.de'.
     --rm-files ruleset 
                     This patching option defines filter rules to remove real
                     files and directories from the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --zero-files ruleset 
                     This patching option defines filter rules to zero (set
                     size to zero) real files of the FST of the DATA partition.
                     Fake signing of the TMD is necessary. The processing order
                     of file options is: '--rm-files --zero-files
                     --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --ignore-files ruleset 
                     This option defines filter rules to ignore real files of
                     the FST of the DATA partition. Fake signing is not
                     necessary, but the partition becomes invalid, because the
                     content of some files is not copied. If such file is
                     accessed the Wii will halt immediately, because the
                     verification of the checksum calculation fails. The
                     processing order of file options is: '--rm-files
                     --zero-files --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --align-part size 
                     If creating or moving partitions the beginning of each
                     partition is set to an offset that is a multiple of the
                     align size. Size must be a power of 2 and at least 32 KiB
                     (=default).
     --align-files   If creating a partition the file 'align-files.txt' is
                     read. Files listed with values >=0x8000 (Wii sector size)
                     are automatically aligned to 0x8000.

  -d --dest path     Define a destination path (directory or file). The
                     destination path is scanned for escape sequences (see
                     option --esc) to allow generic paths.
  -D --DEST path     Like --dest, but create the directory path automatically.
  -E --esc char      Define an alternative escape character for destination
                     files. The default is '%'. For Windows (CYGWIN) it is a
                     good choice to set '-E$' to avoid conflicts with command
                     shell variables.
  -p --preserve      Preserve file times (atime+mtime) while copying an image.
                     This option is enabled by default if an unmodified disc
                     image is copied.
  -o --overwrite     Overwrite already existing files without warning.

More help is available at https://wit.wiimm.de/cmd/wit/extract


 ** no documentation yet **


 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.


-------------------------------------------------------------------------------

COMMAND:
    FDIFF | FCMP ...

 'FDIFF' is a synonym for 'DIFF --files +'.
 See command 'DIFF' for options and details.


-------------------------------------------------------------------------------

wit FILELIST|FLIST : List all source files in a table.

Syntax: wit FILELIST [source]...

Options:

  -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.
                       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.
                       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.
     --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.

  -l --long          Print the real path instead of given path.

More help is available at https://wit.wiimm.de/cmd/wit/filelist


 The filename of each file in the internal file list is printed as one line.
 If no source is given, the current working directory is used as source.


 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.


-------------------------------------------------------------------------------

wit FILES|F : List all files of all discs.

Syntax: wit FILES [source]...

Options:

  -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.
                       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.
                       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.
     --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.

     --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.
                       See https://wit.wiimm.de/opt/psel for more details.
     --raw           Abbreviation of '--psel RAW'.
     --pmode p-mode  This options set the prefix mode for listed or extracted
                     files. One of the following values is allowed: AUTO, NONE,
                     POINT, ID, NAME, INDEX, COMBI. The default value is
                     'AUTO'. See https://wit.wiimm.de/opt/pmode for more
                     details.
     --flat          While extracting a disc image strip all path names of the
                     source file and store all files in the same directory.
                     This option sets the default for --pmode to NONE.
  -F --files ruleset Append file select rules. This option can be used multiple
                     times to extend the rule list. Rules beginning with a '+'
                     or a '-' are allow or deny rules rules. Rules beginning
                     with a ':' are macros for predefined rule sets.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --copy-gc       If extracting a GameCube disc image, don't extract the
                     real files to '/files/...'. Instead create a copy of the
                     source image and store it as 'game.iso'. If the source
                     image is already in this format, try to create a hard link
                     and copy only if it fails.
     --no-link       Don't try to create a hard link if copying the image
                     forced by the option --copy-gc.
     --neek          Abbreviation of '--psel data --pmode none --files :neek
                     --copy-gc'. The old name --sneek is accepted too.
     --ignore-files ruleset 
                     This option defines filter rules to ignore real files of
                     the FST of the DATA partition. Fake signing is not
                     necessary, but the partition becomes invalid, because the
                     content of some files is not copied. If such file is
                     accessed the Wii will halt immediately, because the
                     verification of the checksum calculation fails. The
                     processing order of file options is: '--rm-files
                     --zero-files --ignore-files'.
                       See https://wit.wiimm.de/info/file-filter.html for more
                     details about file filters.
     --align-part size 
                     If creating or moving partitions the beginning of each
                     partition is set to an offset that is a multiple of the
                     align size. Size must be a power of 2 and at least 32 KiB
                     (=default).
     --align-files   If creating a partition the file 'align-files.txt' is
                     read. Files listed with values >=0x8000 (Wii sector size)
                     are automatically aligned to 0x8000.

  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.
  -l --long          Print in long format. Multiple usage possible.
  -H --no-header     Suppress printing of header and footer.
  -+ --show list     This option allows fine control over the things that are
                     to be printed. The parameter is a comma separated list of
                     the following keywords, case is ignored: NONE, INTRO,
                     HEADER, SLOTS, GEOMETRY, D-ID, P-ID, P-TAB, P-INFO, P-MAP,
                     D-MAP, W-MAP, TICKET, TMD, USAGE, PATCH, RELOCATE, FILES,
                     UNUSED, OFFSET, SIZE, PATH and ALL. There are some
                     combined keys: ID := D-ID,P-ID, PART :=
                     P-INFO,P-ID,P-MAP,TICKET,TMD, DISC := FILES,D-ID,D-MAP,
                     MAP := P-MAP,D-MAP,W-MAP.
                       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.
                       The additional keywords DEC and HEX can be used to set a
                     prefered number format. -HEADER suppresses the output of
                     header lines.
                       The commands recognize only some of these keywords and
                     ignore the others. If --show is set, option --long is
                     ignored for selecting output elements.
  -S --sort list     Define the sort mode for the file listing. The parameter
                     is a comma separated list of the following keywords: NONE,
                     NAME, SIZE, OFFSET, ASCENDING, DESCENDING = REVERSE.

More help is available at https://wit.wiimm.de/cmd/wit/files


 ** no documentation yet **


 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.


-------------------------------------------------------------------------------

COMMANDS:
    FILES-L   | FL    [source]...
    FILES-LL  | FLL   [source]...

 'FILES-L'   is a synonym for 'FILES --long'.
 'FILES-LL'  is a synonym for 'FILES --long --long'.
 See command 'FILES' for options and details.


-------------------------------------------------------------------------------

wit FILETYPE|FTYPE : Print a status line for each source file.

Syntax: wit FILETYPE [source]...

Options:

  -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.
                       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.
                       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.
     --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.

  -H --no-header     Suppress printing of header and footer.
  -l --long          If set at least once or twice additional columns with ID6
                     (1x) or the region (2x) are enabled. If set three or more
                     times the real path instead of given path is printed.

More help is available at https://wit.wiimm.de/cmd/wit/filetype


 The command 'FILETYPE' prints for each file in the internal file database
 (build by the options --source and --recurse) one status line like:
    FILETYPE ID6 SIZE_MIB REGION filename
 Column 'ID6' is only printed if option --long is set. For non ISO images
 the ID6 is '-'. Columns 'SIZE_MIB' and 'REGION' are only printed if option
 --long is set at least two times.

 If neither --source nor --recurse is used and no other source is defined then
 the default directory is searched for ISO files.

 'SIZE_MIB' is the calculatet size of a scrubbed ISO image. For this all used
 sectors of a ISO image are counted. The usage depends of the options --psel
 and --raw.

 Filetypes are:
    NO-FILE  : No file found
    DIR      : Not a file but a directory
    WBFS     : A WBFS
    WBFS/    : A WBFS used like directory with id6 or index or pos
    WDF+WBFS : A WBFS shrinked with WDF (this make no sense expect transporting)
    ISO      : A ISO image.
    WDF+ISO  : A ISO image shrinked with WDF.
    WDF      : Any other WDF file (not WBFS or ISO)
    WIA      : A ISO image packed with WIA.
    GCZ      : Dolphins GameCup-Zip images.
    OTHER    : Any other file


 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.


-------------------------------------------------------------------------------

wit HELP|H : Print help and exit. If the first non option is a valid command
             name, then a help for the given command is printed.

Syntax: wit HELP [command] [ignored]...

Options:

     --width width  Define the width (number of columns) for help and some
                    other messages and disable the automatic detection of the
                    terminal width.

More help is available at https://wit.wiimm.de/cmd/wit/help


 Usual ERROR/EXIT CODES:

    0 == OK             : all done without errors.


-------------------------------------------------------------------------------

wit ID6|ID : Print ID6 of all found ISO files as simple list.

Syntax: wit ID6 [source]...

Options:

  -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.
                       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.
                       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).

     --ignore-fst    Disable composing and ignore FST directories as input.
     --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.
  -L --logging       This debug option enables the logging of internal memory
                     maps. If set twice second level memory maps are printed
                     too.
  -l --long          If set, a table with 5 IDs (DISC, BOOT, TICKET, TMD and
                     WBFS) is printed. BOOT, TICKET and TMD IDs are taken from
                     the main partition. If set twice, all IDs of all
                     partitions are printed.

     --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.
     --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.
                     See https://wit.wiimm.de/opt/id for more details.
     --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.
                     See https://wit.wiimm.de/opt/disc-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/boot-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/ticket-id for more details.
     --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.
                     See https://wit.wiimm.de/opt/tmd-id for more details.
     --tt-id id      This is a short cut for '--ticket id --tmd id'. If TICKET
                     and TMD differ, the game will freeze after loading. So it
                     makes only sense to change TICKET and TMD IDs together.
     --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.
                     See https://wit.wiimm.de/opt/wbfs-id for more details.

More help is available at https://wit.wiimm.de/cmd/wit/id6


 The command 'ID' lists the ID6 of all discs in the internal ISO database, one
 ID per row. The internal ISO database is build under control of the options
 --source, --recurse, --include, --include-path, --exclude and --exclude-path.
 See section "Processing --source and --recurse" for details.

 If neither --source nor --recurse is used and no other source is defined then
 the default directory is searched for ISO files.

 If --uniqe is set each game disc with same ID6, name, size and region is only
 printed once. To determine doube entries the list is sorted by ID.

 The output sort order can be set by the --sort option. Sort=none means, that
 the ID will be shown in order of the WBFS partition. The default sort order
 is 'ID'.


 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.


-------------------------------------------------------------------------------

 The command 'ISOSIZE' prints for each file in the internal file database
 (build by the options --source and --recurse) one status line like:

    ISO_BLOCKS  SIZE_IN_MIB  WBFS_FILESIZE  SIZE_IN_500G_WBFS  filename

 The size is calculated for a scrubbed ISO image. For this all used sectors
 of a ISO image are counted. The usage depends of the options --psel and --raw.

 ISO_BLOCKS
    The number of used ISO blocks. Each ISO block has a size of 32K.

 SIZE_IN_MIB
    The number of used ISO blocks in MiB. It's a rounded value ISO_BLOCKS.
    Column SIZE_IN_MIB is only shown if the option --long is set.

 WBFS_FILESIZE
    The total size of a wbfs file that contains only 1 disc. The calculation
    is made under the assumption that the WBFS blocks size is 2 MiB. Column
    WBFS_FILESIZE is only shown if the option --long is set at least twice.

 SIZE_IN_500G_WBFS
    The size of a ISO image as part of a WBFS with about 500g total space.
    The calculation is made under the assumption that the WBFS blocks size
    is 8 MiB. Column SIZE_IN_500G_WBFS is only shown if the option --long
    is set at least twice.

 If neither --source nor --recurse is used and no other source is defined then
 the default directory is searched for ISO files.

 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.


-------------------------------------------------------------------------------

 The command 'LIST' lists infos of all discs in the internal ISO database.
 The internal ISO database is build under control of the options --source,
 --recurse, --include, --include-path, --exclude and --exclude-path.
 See section "Processing --source and --recurse" for details.

 Without --long the ID and the name are printed. With option --long the ID,
 size, region and the name are printed.  The option --no-header suppress the
 output of header and footer.

 Printing of timestamps is enabled by the options --time, --itime, --mtime
 --ctime, --atime or when --long is set at least twice. --time=off disables
 time printing. All time options (not --long) supersede the previous options.
 The option --time take a comma separated list of the following keywords:

    OFF    : Disable time printing. All other option enable time printing.
    ON     : Enable time printing.

    SINGLE : Print only a single column (last time specified.
    MULTI  : Print columns for all specified times. (default)

    I      : Use itime (insertion time) for processing.
    M      : Use mtime (last modicifaction time) for processing. (default)
    C      : Use ctime (last staus change time) for processing.
    A      : Use atime (last access time) for processing.

    NONE   : Disable all 4 times above
    ALL    : Enable all 4 times above
    
    DATE   : Print time in format 'YYYY-MM-DD'. (default)
    TIME   : Print time in format 'YYYY-MM-DD HH:MM'.
    MIN    : Alternative keyword for 'TIME'.
    SEC    : Print time in format 'YYYY-MM-DD HH:MM:SS'.

    *DATE  : Short cut for '*,DATE'. '*' is one of 'I', 'M', 'C' or 'A'.
    *TIME  : Short cut for '*,TIME'. '*' is one of 'I', 'M', 'C' or 'A'.
    *MIN   : Alternative keywords for '*TIME'.
    *SEC   : Short cut for '*,SEC'.  '*' is one of 'I', 'M', 'C' or 'A'.

 If the option --long is given three or more times a second line with the
 number of partitions, the file type ('ISO', 'WDF', ...) and the file path is
 printed. If the option --long is given three times the real path is printed.

 If the option --sections is set, then the layout is completly changed to a
 sections base output. This output is machine readable. The output looks like:

	[section_name-index]
	parameter=value
	parameter=value
	...

 If available the name of the title database is used. use the option -T0 to
 disable database titles.

 If --unique is set each game disc identified by ID6 is only printet once.
 The sort order can be set by the --sort option. Sort=none means, that the ID
 will be shown in order of scanning. The default sort order is 'TITLE'.

 If neither --source nor --recurse is used and no other source is defined then
 the default directory is searched for ISO files.

 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.


-------------------------------------------------------------------------------

COMMANDS:
    LIST-L   | LL    [source]...
    LIST-LL  | LLL   [source]...
    LIST-LLL | LLLL  [source]...

 'LIST-L'   is a synonym for 'LIST --long'.
 'LIST-LL'  is a synonym for 'LIST --long --long'.
 'LIST-LLL' is a synonym for 'LIST --long --long --long'.
 See command 'LIST' for options and details.


-------------------------------------------------------------------------------


-------------------------------------------------------------------------------


-------------------------------------------------------------------------------

 This command 'RENAME' may change the ID6 and/or the title of discs. The
 alternative command 'SETTITLE' modifies only titles. The advantage of
 'SETTITLE' is, that it can modify all titles with 1 sub command.

 The syntax of a sub command is: id6=[new_id6][,new_title]
    'id6' is the ID of the disc to change.
    The optional 'new_id6' is the new ID of the disc.
    The optional 'new_title' is the new title of the disc.

 Processing the new title:

    The title string is parsed for escape sequences beginning with the escape
    character '%'. The accepted format is:

        '%cX'  or  '%mcX'  or  '%n-mcX'

    'n' is the number of skipped characters of the field.

    'm' is the zero based index of the last copied character.

    'c' is an optional character. If c is 'u' then the source will be
        converted to uppercase and if c is 'l' to lower case.

    'X' selects the source and is one of:

        'i' : the (new) ID6
        'I' : the (new) ID6
        'j' : The previous ID stored in the WBFS inode.
        'J' : The previous ID stored in the ISO header.

        'n' : The previous disc title stored in the WBFS inode.
        'N' : The previous disc title stored in the ISO ehader.

        't' : The title from the title database based on the new ID or, if not
              changed, on the ID of the WBFS inode. If no title found the disc
              name stored in the WBFS inode is used.
        'T' : Same as 't'
        'p' : The title from the title database based on the previous ID stored
              in the WBFS inode. If no title found the disc name stored in the
              WBFS inode is used.
        'P' : The title from the title database based on the previous ID stored
              in the ISO header. If no title found the disc name stored in the
              ISO header is used.

        If the object to change is not a WBFS then the ISO data is used instead
        of the WBFS inode data ('j', 'n', and 'p' conversions).

    To use the '%' sign itself just type '%%'.

    Instead of '%' an alternative escape character can be used. It is defined
    by the option --esc. This makes live easier if using the cygwin version
    together with the windows shell 'cmd'. Define the environment variables
    'WIT_OPT' and/or 'WWT_OPT' for a new default definition.

 Usual ERROR/EXIT CODES:

    0 == OK        : all done.
    SYNTAX ERROR   : at least one syntax error in command line found.


-------------------------------------------------------------------------------

 This command 'SETTITLE' may change the title of discs. The alternative
 command 'RENAME' can also change the ID of discs.

 The syntax of a sub command is: id6=new_title
    'id6' is the ID of the disc to change. If using '+' all discs are changed.
    The 'new_title' is the new title of the disc.

 Processing the new title:

    The title string is parsed for escape sequences beginning with the escape
    character '%'. The accepted format is:

        '%cX'  or  '%mcX'  or  '%n-mcX'

    'n' is the number of skipped characters of the field.

    'm' is the zero based index of the last copied character.

    'c' is an optional character. If c is 'u' then the source will be
        converted to uppercase and if c is 'l' to lower case.

    'X' selects the source and is one of:

        'i' : the (new) ID6
        'I' : the (new) ID6
        'j' : The previous ID stored in the WBFS inode.
        'J' : The previous ID stored in the ISO header.

        'n' : The previous disc title stored in the WBFS inode.
        'N' : The previous disc title stored in the ISO ehader.

        't' : The title from the title database based on the new ID or, if not
              changed, on the ID of the WBFS inode. If no title found the disc
              name stored in the WBFS inode is used.
        'T' : Same as 't'
        'p' : The title from the title database based on the previous ID stored
              in the WBFS inode. If no title found the disc name stored in the
              WBFS inode is used.
        'P' : The title from the title database based on the previous ID stored
              in the ISO header. If no title found the disc name stored in the
              ISO header is used.

        If the object to change is not a WBFS then the ISO data is used instead
        of the WBFS inode data ('j', 'n', and 'p' conversions).

    To use the '%' sign itself just type '%%'.

    Instead of '%' an alternative escape character can be used. It is defined
    by the option --esc. This makes live easier if using the cygwin version
    together with the windows shell 'cmd'. Define the environment variables
    'WIT_OPT' and/or 'WWT_OPT' for a new default definition.


 Usual ERROR/EXIT CODES:

    0 == OK        : all done.
    SYNTAX ERROR   : at least one syntax error in command line found.


-------------------------------------------------------------------------------

 The command 'TITLES' builts the title data base and prints the result to
 stdout. The handling of the additional files works like the --title option.
 The section "Processing title db" explains the options in detail.


 Usual ERROR/EXIT CODES:

    0 == OK        : all done.
    SYNTAX ERROR   : at least one syntax error in command line found.


-------------------------------------------------------------------------------


-------------------------------------------------------------------------------

wit VERSION : Print program name and version and exit.

Syntax: wit VERSION [ignored]...

Options:

  -b --brief     Print only the version number, revision and system. If set
                 twice, print only the version number.
     --sections  Print in machine readable sections and parameter lines. Read
                 https://wit.wiimm.de/opt/sections for more details.
  -l --long      Print in long format. Ignored if option --sections is set.

More help is available at https://wit.wiimm.de/cmd/wit/version


 The command VERSION prints out the program version to standard out (stdout)
 and exit with status 0 (OK).

 The ouput line looks like:
    wit: Wiimms ISO Tool v3.02a r0 linux - Dirk Clemens - 2020-05-29

 With option --sections the output is printed in a machine readable format:
    [version]
    prog=wit
    name=Wiimms ISO Tool
    version=3.02a
    beta=0
    revision=0
    system=linux
    endian=1234 little
    author=Dirk Clemens
    date=2020-05-29
    url=https://wit.wiimm.de/wit
    


 Usual ERROR/EXIT CODES:

    0 == OK : all done without errors.


*******************************************************************************
*******               Processing --source and --recurse                 *******
*******************************************************************************

The tool 'wit' processes the --source and the --recurse options to built an
internal ISO database (ISO, WDF, WIA, FST and more ISO files included). All
operations are then done with the files of this ISO database (like 'wwt' do it
with a WBFS).

 Options:
    -s --source  path
    -r --recurse path
       --rdepth  depth

Both options work similar and both option can be used multiple times. If 'path'
is a non existing file an error message is printed. If 'path' is an plain file,
it is opened and analyzed. If that files is an ISO file in any supported format
than it is added to the internal ISO database.

The options --source and --recurse differ only if 'path' is an directory.
Option --source searches that directory but not subdirectories for ISO files.
Option --recurse searches that directory and all subdirectories (recurse, max
depth is set by --rlevel, default=10) for ISO files. Subdirectories beginning
with a dot ('.') are ignored.

The implementation is optimized so that a directory is only searched once.
The option --recurse is processed before option --source.


///////////////////////////////////////////////////////////////////////////////
///////////////                Processing ISO files             ///////////////
///////////////////////////////////////////////////////////////////////////////

Commands like "wwt ADD" or "wit COPY" uses ISO files as input. They accept
plain ISO files and ISO files in WDF, CISO and WBFS containers and FST
directories. In detail:

 /path/to/PLAIN_ISO:
    A PLAIN ISO file is a 1:1 copy of a Wii disc, may be scrubbed. It is not
    compressed and not part of any container. The standard extension is ".iso".

 /path/to/WDF_ISO:
    This is an ISO packed in a WDF container. WDF container may be used for
    any files and not only for ISO images. The standard extension is ".wdf".

 /path/to/CISO:
    This is an ISO packed in a CISO container. CISO container may be used for
    any files and not only for ISO images. The standard extensions are
    ".ciso" (default) and ".wbi".

 /path/to/WBFS_FILE
    An WBFS file/device is also accepted like a list of ISO files. The standard
    extension for WBFS files is ".wbfs".

 /path/to/WBFS_FILE/SELECTOR
    This is a special construct. The ISO image of the WBFS_FILE selected
    by SELECTOR is used as source. The selector may be one of:

     - 'ABCDEF' : ID6 of a disc (exact 6 characters)

     - index    : The zero based index of the disc. The range goes from zero
                  up to the number of discs in the WBFS minus 1.
                  (decimal number, but not 6 digits)

     - '#' slot : The decimal slot number within the WBFS. The range goes from
                  zero up to the maximal number of possible discs in the WBFS
                  minus 1.

    Examples:
      .../a.wbfs/rmcp01 : use "Mario Kart" from 'a.wbfs' as source.
      .../a.wbfs/5      : use the image with index #5 from 'a.wbfs' as source.
      .../a.wbfs/#5     : use the image at slot #5 from 'a.wbfs' as source.

 /path/do/FST_directory
    If the path is a directory and the directory contains a valid FST (File
    SysTem) structure then the directory structure is used to build an internal
    virtual ISO image. Most commands can use this virtual ISO image like a
    real image.


When writing ISO files the option --wdf, --iso, --ciso, --wbfs and --fst
control the output format. If writing a WBFS file this WBFS is truncated and
contains exactly one ISO image. The default file name of this WBFS is
'<ID6>.wbfs'. If none of --wdf, --iso, --ciso, --wbfs or --fst is set, the
destination filename will be analyzed. If the extension (ignoring case) is
".wdf", ".iso", ".ciso", ".wbi" (an alternative for ".ciso") or ".wbfs",
the specific output format is used. The default is WDF if all other fails.



*******************************************************************************
*******                    Processing ID6 parameters                    *******
*******************************************************************************

Discs in a WBFS partition are addressed by its ID6. Therfor commands like
EXTRACT and REMOVE needs as parameters an ID6 tag. And EXTRACT needs also
the name of the destination file. This section describes the processing
of ID6 parameters.

First all control characters (ASCII <32) will be replaced by a space. Spaces
at the beginning and a the end are removed. Multiples spaces will be replaced
by a single space.

In the second step each parameter will be processed by the following rules.
If one rule matches the processing terminates. ID6 are words that contains
exactly 6 characters in the range a-z, A-Z and 0-9. All other characters are
word separators. ID6 is converted into upper case.

The rules as overview:
    '*' | '+'
    ID4
    ID6
    ID6 = name
    name [ID6]
    ID6 anything


1.) '*' | '+'

    Both characters has the same meaning: Use all ID6 will be found on the
    given WFS partitions. The parameter will be replaced by the complete ID6
    list. A destination filename is not defined.

	Only the first occurrence will be processed. All other are ignord.

    Note: '*' is the natural 'all' placeholder but must be escaped in most
          shells. Therefor the additional '+' is possible.

2.) ID4

    If the parameter contains exactly one ID4 and nothing else the ID4 is
    used. Only for some commands/options a pure ID4 is allowd.

3.) ID6

    If the parameter contains exactly one ID6 and nothing else the ID6 is
    used. A destination filename is not defined.

4.) ID6 = name

    Use this format to set an ID6 and an destination filename. Blanks before
    and behind '=' are ignored. The name is used as the destination filename.

5.) name [ID6]

    The line is searched for an ID6 which is directly included in square
    bracktes. If more than 1 '[ID6]' is found the last one will be used.
    The whole parameter is used as the destination filename.

6.) ID6 anything

    This is the table support. The ID6 is taken and the remaining is ignored.
    A destination filename is not defined.

If the option --unique is supported and set then repeated parameters with the
same ID6 are eliminated. The last non empty destination filename is used.

If a destination filename is needed but none is set than the a name from the
title database or an internal name of the game will be used. Before creating
an ISO image the destination filename is post processed to eliminate unusal
characters. Only single spaces, A-Z, a-z, 0-9 and _+-='"$%&,.!()[]{}<> are
allowed.


*******************************************************************************
*******             Processing include and exclude options              *******
*******************************************************************************

The user may define ID inclusion and exclusion lists. Each element represents
an ID4 or an ID6. Discs with an ID in the exclusion list are ignored (not
added, extracted, removed or listed). If --include or --include-path is used,
only discs in the include list are processed.

The include list is controlled by the to options --include and --include-path
and the exclude list by the options --exclude and --exclude-path. All four
options can be used multiple times. The exclude list ha a higher priority
as the include list.

 -n --include id     Include oly discs with given ID4 or ID6 from operation.
 -n --include @file  Read include list from file.

 -N --include-path file_or_dir
                     ISO file or base of directory tree -> scan their ID6

 -x --exclude id     Exclude discs with given ID4 or ID6 from operation.
 -x --exclude @file  Read exclude list from file.

 -X --exclude-path file_or_dir
                     ISO file or base of directory tree -> scan their ID6

The parameters of --include and --exclude are scanned for ID6. Th section
"Processing ID6 parameters" describes this scanning in detail.

The parameter of --include-path and --exclude-path is a filename or a
directory name. The given file or each file of the directory tree (recurse,
max depth=15) are scanned. Subdirectories beginning with a dot ('.') are
ignored. If a file exists and is an ISO file the ID6 is extracted and inserted
into the include or exclude data base.

Example:

 You want to make a backup from all new discs of 2 USB drives. The new
 backups should be stored info the sub directory 'new-backup'. The existing
 backups are stored in 'old-backup'. The file names of the old backups does
 not matter:

 # wwt extract -aA --dest new-backup --exclude-path old-backup

The command 'EXCLUDE' use the options --exclude and --exclude-path to builtd
the exclude data base and prints the result to stdout.


*******************************************************************************
*******                      Processing title db                        *******
*******************************************************************************

Title files without path specification are search in up to 4 directories:
  1.) In the program path.
  2.) If the program end with "/bin/" in "<PROGRAM_PATH>/../share/wit/".
  3.) In the directory "/usr/local/share/wit/"
  4.) In the current working directory "./"
If you want to search only in the current working directory prefix the file
name with './'. If setting option --verbose at least 4 times (e.g. -vvvv)
the search paths will be logged.

The titles are loaded first time they needed. At first the following three
files are searched in the search path:
  - titles.txt (comes with the distribution)
  - titles-<LANG>.txt (see below)
  - titles.local.txt (for local specificatons)
After that all files specified by the --titles options are scanned.

The idea: The file "titles.txt" is the main title database. It is a copy from
http://wiitdb.com/titles.txt. The file "titles-<LANG>.txt" may contain
language specific definitions. "<LANG>" are the first lower case letters of
the environment variable "LC_CTYPE". The file "titles.local.txt" may contain
local definitions for the user.

The option -T / --titles in detail:

  --titles=0 .. --titles=9
     Set the title mode to a value between 0 and 9.
      0: disable title lookup.
      1: Use titles instead of real disc names. (deault)
      2..9: reserved.

  --titles=/
     Remove all previous --title definitions an do not load the default
     title files.

  --titles=@file
     Use the given file as a list of filenames. Each non empty line is
     interpreted as a filename.

  --titles=@-
     Read standard input (stdin). Each non empty line is interpreted as
     a filename.

  --titles=-
     Read standard input (stdin) and scan it for titles.

  --titles=file
     This is a filename without '/': Read the given file and scan it for
     titles. The file is searched in the search path described above.

  --titles=path/file
     Read the given file and scan it for titles.

If setting option --verbose at least 3 times (e.g. -vvv) all successfull
loaded titles files will be logged. If setting --verbose at least 4 times
the search paths and all searched title files will be logged.

Each line of each title file is scanned for title definitions:
    ID4 = name
    ID6 = name

The title database is build with both ID-types. A later file overides the
settings of all previous files: If an ID4 is found, all ID4 and ID6
definitions of all previous files are removed. If an ID6 is found, only
the previous ID6 definition is removed.

For each database lookup first an ID6 entry is searched. Only if this fails
an ID4 entry is searched.

The titles are expected in UTF-8 coding. Non UTF-8 characters are converted
into UTF-8. If the options --no-utf-8 is set than the title database is
converted into ANSI and all output will also be printed in ANSI.

The command 'TITLES' builts the title data base and prints the result to
stdout.


*******************************************************************************
*******                    Processing split options                     *******
*******************************************************************************

Output files may be splittet into multiple files. The options --split and
--split-size controls the output splitting:

  -z --split            Enable output file splitting, default size = 4 gb.
                        4 gb means 4.000.000.000 bytes (4 billion bytes).
                        The default size for a WBFS is different. It is
                        4GiB-32KiB = 0xffff8000 = 4.294.934.528 bytes.

  -Z --split-size size  Enable output file splitting and set split size.
                        See section "Processing size options" for detailed
                        infos about the 'size' argument.

A new file is created every time when the previous one reached the split size.
Input split files are automatically detected. Only the last file of the input
split file may grow if opened in modify mode.

The split size always rounded down to a multiply of 512 (0x200), the hd sector
size. For a WBFS it is rounde down to a multiply of 32 KiB (32768, 0x8000),
the WII ISO sector size.

There are two naming schemas for the splitted files:

WBFS files are named like (defined by oggzee):
    - name.wbfs
    - name.wbf1
    - name.wbf2
      ...
    - name.wbf9
    - name.wbf10
      ...

All other files are named like:
    - name.ext
    - name.ext.1
    - name.ext.2
      ...
    - name.ext.9
    - name.ext.10
      ...

The WIT tools supports splitted WDF files *not* following the rules for
splitted WDF files. All files are splitted hard by breaking the files into
peaces. This is done by the file layer so that other layer including the WDF
layer don't see the split.

These are the rules for automatic detection of split files. The automatic
detection works only for plain files but not for other files types like
block devices or pipes:

 WBFS file:
    The last character of the filename is replaced by '1'. If a file with
    this new filename is available, the split file support is enabled.

 WDF file:
    The WDF header is read. If the current WDF files is to short and a file
    with same filename plus '.1' exists, the split file support is enabled.

 ISO file:
    If the file is smaller than 4 GiB and a file with same filename plus '.1'
    exists then then split file support is enabled.


*******************************************************************************
*******                    Processing size options                      *******
*******************************************************************************

The different programs using different options to setup size values. These
options are --size, --split-size, --hss and --wss. The processing of the
arguments are identical for all size options.

The argument syntax is: term [ sign term ]... [sign]
with term := float [factor]

 'float' is any C like floating point number like '12', '1.2' or '1e5'.
 'sign' is either the character '+' or the character '-'.

 'factor' is one of the following characters:

    'c' : char, numeric factor = 1
    'b' : byte, numeric factor = 1

    'k' : kilo, numeric factor = 1 kB = 1000
    'm' : mega, numeric factor = 1 MB = 1000*1000
    'g' : giga, numeric factor = 1 GB = 1000*1000*1000
    't' : tera, numeric factor = 1 TB = 1000*1000*1000*1000
    'p' : peta, numeric factor = 1 PB = 1000*1000*1000*1000*1000
    'e' : exa,  numeric factor = 1 EB = 1000*1000*1000*1000*1000*1000

    'K' : kilo, numeric factor = 1 KiB = 1024
    'M' : mega, numeric factor = 1 MiB = 1024*1024
    'G' : giga, numeric factor = 1 GiB = 1024*1024*1024
    'T' : tera, numeric factor = 1 TiB = 1024*1024*1024*1024
    'P' : peta, numeric factor = 1 PiB = 1024*1024*1024*1024*1024
    'E' : exa,  numeric factor = 1 EiB = 1024*1024*1024*1024*1024*1024

    'u' | 'U' : size of a GameCube disc        = 1 459 978 240
    'w' | 'W' : size of a singe layer Wii disc = 4 699 979 776

  Without 'factor' a default factor is used. This default factor is different
  for the first term and for the other terms. The default factors depends on
  the used option.

The terms are added together. If there is at the very end of the term 1 sign
it wil be interpreted as '-1' or '+1' (using the default factor for other terms).

Option --size
    Default factor for first term:     1G
    Default factors for other terms:   1
    Minimal value:                    10m

Option --split-size
    Default factor for first term:     1G
    Default factors for other terms: 512
    Value must be multiples of:      512
    Minimal value:                   100m

Option --hss
    Default factor for all terms:      1
    Value must be power of:            2
    Minimal value:                   512

Option --wss
    Default factor for all terms:      1
    Value must be power of:            2
    Minimal value:                  1024

Examples:
    --split-size 2g     -> split at 2.000.000.000 bytes.
    --split-size 1g     -> split at 1.000.000.000 bytes.
    --split-size 1G     -> split at 1.073.741.824 bytes = 1 GiB.
    --split-size 0.5g   -> split at   500.000.000 bytes.
    --split-size 2G-1K  -> split at 2 GiB - 1 KiB.
    --split-size 2G-1   -> split at 2 GiB - 512
    --split-size 2-1    -> split at 2 GiB - 512
    --split-size 2-     -> split at 2 GiB - 512
    -Z2-                -> split at 2 GiB - 512


*******************************************************************************
*******                      Some options in detail                     *******
*******************************************************************************

The option --sort defines the sort mode for output lists.

  Syntax: --sort sort_mode | -S sort_mode

'sort_mode' is a comma separated list of the following keywords:

    -  | NONE    : Do not sort

         ID      : Sort by id
    T  | TITLE   : Sort by title taken from title db
    N  | NAME    : Sort by name of disc
    F  | FILE    : Sort by file name
    SZ | SIZE    : Sort by size
    OF | OFFSET  : Sort by offset (or index)
    R  | REGION  : Sort by region
         WBFS    : Sort by wbfs file name
         NPART   : Sort by number of partitions

    IT | ITIME   : Sort by itime (insertion time)
    MT | MTIME   : Sort by mtime (last modification time)
    CT | CTIME   : Sort by ctime (last status change time)
    AT | ATIME   : Sort by atime (last access time)
    TI | TIME    : Sort by itime|mtime|atime|atime, decided by the time options.
    D  | DATE    : Alternative keyword for 'TIME'

      DEFAULT    : Use the default sort method for that output

      ASCENDING  : Sort in ascending order.
      DESCENDING : Sort in descending order (reverse).
      REVERSE    : Alternative keyword for 'DESCEND'.

The latest keyword supersedes the previous one of the same group.
'NONE' resets all. Abbreviations are allowed as long as they are unique.


*******************************************************************************
*******                   Hidden options (for testing)                  *******
*******************************************************************************

There are some hidden options implemented for testing:

 --io value

    wit and the other tools can handle files via open() (file mode) and via
    fopen() (stream mode). The option --io=value allows to control the method.
    Bit #0 is for opening WBFS and Bit #1 is for openening ISO images.
    ('ISO' includes ISO in all supported formats)

    --io=0 : WBFS=open()  ISO=open()  **default**
    --io=1 : WBFS=fopen() ISO=open()
    --io=2 : WBFS=open()  ISO=fopen()
    --io=3 : WBFS=fopen() ISO=fopen()


*******************************************************************************
*******                      Environment variables                      *******
*******************************************************************************

The user can define environment variables as additional way to submit options
to the tool. All options are accepted and used as default. 

See https://wit.wiimm.de/info/environ.html for details.


*******************************************************************************
*******                            Signals                              *******
*******************************************************************************

The WIT tools will handle the following signals:

 INT or TERM

    If catched first time the tool will finish after current job.
    If catched second time the tool will finish immediately with cleanup.
    If catched third time the tool will finish immediately without cleanup.

 USR1, USR2

    USR1 will decrease and USR2 increase the verbose level.
    The effect is delayed until beginning the next job.


*******************************************************************************
*******                              END                                *******
*******************************************************************************
