Wiimms SZS Tools

From Custom Mario Kart
Jump to navigation Jump to search

Introduction

Wiimms SZS Tools should be a set of different tools to manipulate SZS files. All tools are command line tools and run without any interaction. The main goal is to run them in batch files and scripts to automate recurring jobs. At this moment there is only one tool:

  • wszst : Wiimms SZS Tool

A second tool to change the content of message files is planned. Both tools together can be used to change the track names of all message files of all languages without interaction.

This toolset will not replace the SZS Modifier or SZS Explorer, because they are interactive tools with GUI support and can work directly with many sub file formats.

History

szs v0.01a.beta r2385 - 2011-03-31

 - new Tool: wszst (Wiimms SZS Tool)
   The following main commands are supported:
     LIST, COMPRESS, DECOMPRESS, EXTRACT, CREATE.

szs v0.01a r2392 - 2011-04-01

 - Bug fix for "wstsz CREATE": Wrong calculation of parent directory link.
 - New option: wstsz CREATE --align: Overwrite the default aligment (32=0x20).
 - wstsz LIST: If --long is set three times debugging mode is enabled.
 - wstsz LIST: If listing a directory, then a virtual SZS file is created
   (like CREATE do it) and listed.
 - New command: wszst DIFF: Compare two sources (each SZS, U8 or directory)
   on file level and report mismatches for each sub file.

wszst (Wiimms SZS Tool)

wszst is a command driven tool. Only a few commands are implemented yet; other will follow.

wszst HELP

The HELP command print the built in help. Type wszst HELP for a general help. Add a command to print command specific help:

wszst : Wiimms SZS Tool : List, (de-)compress, extract and create SZS
        files.

Syntax: wszst [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.
  TEST              : Test options: All options are allowed, some are
                      printed.
  ERROR      | ERR  : Translate exit code to message or print a table
                      with all error messages if not exit code is
                      given.

  LIST       | LS   : List all sub files of SZS and U8 files. If
                      listing a directory, then a virtual SZS file is
                      created (like CREATE do it) and listed.
  LIST-L     | LL   : List all sub files with size. 'LIST-L' is a
                      shortcut for 'LIST --long.
  LIST-LL    | LLL  : List all sub files with offset and size.
                      'LIST-LL' is a shortcut for 'LIST --long
                      --long'.
  LIST-LLL   | LLLL : List all sub files with offset and size in
                      debugging mode. 'LIST-LLL' is a shortcut for
                      'LIST --long --long --long'.

  DIFF       | CMP  : Compare two sources (each SZS, U8 or directory)
                      on file level and report mismatches for each
                      sub file.
  DECOMPRESS | DEC  : Decompress SZS files. The default destination
                      is '%P/%N.u8'.
  COMPRESS   | COM  : Create compressed SZS files. The default
                      destination is '%P/%N.szs'.
  EXTRACT    | X    : Extract all sub files of SZS and U8 files. The
                      default destination is '%P/%N.d/'.
  CREATE     | C    : Create SZS files by adding all files of the
                      directory structure. The default destination is
                      '%P/%N.szs'.

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

wszst LIST

The command LIST list the sub files of SZS Files.

wszst LIST|LS : List all sub files of SZS and U8 files.

Syntax: wszst LIST [source]...

Options:

  -l --long       If set, the size of each file is printed. If set
                  twice, offset and size are printed.
  -H --no-header  Suppress printing of header and footer.

wszst DIFF

The command DIFF compares two sources (each SZS, U8 or directory) on file level and report mismatches for each sub file.

wszst DIFF|CMP : Compare two sources (each SZS, U8 or directory) on
                 file level and report mismatches for each sub file.

Syntax: wszst DIFF source1 source2

Options:

  -q --quiet  If set once, only a summary status is printed. If set
              twice, the status is only reported as exit status.

wszst DECOMPRESS

The command DECOMPRESS decompresses a SZS File and stores the decompressed data into file.

wszst DECOMPRESS|DEC : Decompress SZS files. The default destination
                       is '%P/%N.u8'.

Syntax: wszst DECOMPRESS [szs]...

Options:

  -d --dest path    Define a destination path (directory/file).
                      The path may contain escape sequences: %Q is
                    replaced by the fully qualified source name. %P
                    and %F are replaced by the path or by the
                    filename. %N and %E are replaced by filename
                    without extension or by the extension.
  -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$'.

  -o --overwrite    Overwrite already existing files without warning.
  -r --remove-dest  Remove already existing files before creating it.
                    If set, --overwrite is ignored.
  -u --update       Create only files that do not exist. Already
                    existing files are ignored without warning. If
                    set, --overwrite and --remove-dest are ignored.

wszst COMPRESS

The command COMPRESS compresses a binary file and creates SZS File.

wszst COMPRESS|COM : Create compressed SZS files. The default
                     destination is '%P/%N.szs'.

Syntax: wszst COMPRESS [source]...

Options:

  -d --dest path    Define a destination path (directory/file).
                      The path may contain escape sequences: %Q is
                    replaced by the fully qualified source name. %P
                    and %F are replaced by the path or by the
                    filename. %N and %E are replaced by filename
                    without extension or by the extension.
  -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$'.

  -o --overwrite    Overwrite already existing files without warning.
  -r --remove-dest  Remove already existing files before creating it.
                    If set, --overwrite is ignored.
  -u --update       Create only files that do not exist. Already
                    existing files are ignored without warning. If
                    set, --overwrite and --remove-dest are ignored.

wszst EXTRACT

The command EXTRACT extracts the sub file of source files and copy the files into a directory structure.

wszst EXTRACT|X : Extract all sub files of SZS and U8 files. The
                  default destination is '%P/%N.d/'.

Syntax: wszst EXTRACT [source]...

Options:

  -d --dest path    Define a destination path (directory/file).
                      The path may contain escape sequences: %Q is
                    replaced by the fully qualified source name. %P
                    and %F are replaced by the path or by the
                    filename. %N and %E are replaced by filename
                    without extension or by the extension.
  -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$'.

  -o --overwrite    Overwrite already existing files without warning.
  -r --remove-dest  Remove already existing files before creating it.
                    If set, --overwrite is ignored.
  -u --update       Create only files that do not exist. Already
                    existing files are ignored without warning. If
                    set, --overwrite and --remove-dest are ignored.

wszst CREATE

The command CREATE creates a SZS file by adding all files of the directory structure.

wszst CREATE|C : Create SZS files by adding all files of the
                 directory structure. The default destination is
                 '%P/%N.szs'.

Syntax: wszst CREATE [source_dir]...

Options:

  -d --dest path    Define a destination path (directory/file).
                      The path may contain escape sequences: %Q is
                    replaced by the fully qualified source name. %P
                    and %F are replaced by the path or by the
                    filename. %N and %E are replaced by filename
                    without extension or by the extension.
  -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$'.

  -o --overwrite    Overwrite already existing files without warning.
  -r --remove-dest  Remove already existing files before creating it.
                    If set, --overwrite is ignored.
  -u --update       Create only files that do not exist. Already
                    existing files are ignored without warning. If
                    set, --overwrite and --remove-dest are ignored.
     --align size   Define an align value for the sub files in the
                    archive. The value must be a power of 2, the
                    default valus is 32 (0x20)
  -8 --u8           Create an uncompressed U8 file instead of a
                    compressed SZS file. The default destination
                    changes to '%P/%N.u8'.
  -L --logging      Print the internal file list like command
                    LIST-LLL.

Tests

I have made several tests with the following files:

  • All files of Scene/UI/.
  • All files of Race/Course/, some of the tracks have been replaced by custom tracks before.

The tests:

  • Decompress and compress and decompress again SZS files and compare the results.
  • Extract all files, create SZS and extract again. The both extracted file system are equal.
  • Extract some of the files with SZS Explorer and compare them to my extracted files.
  • Extract all files and create a new SZS files. Then create a new ISO image with the new SZS files and play it.

Download

Download Release v0.01a of Wiimms SZS Tools:

Source / public beta:

Source / last release:

Links