Wiimms SZS Tools

From Custom Mario Kart
Revision as of 16:50, 4 July 2011 by Wiimm (talk | contribs)
Jump to navigation Jump to search
Wiimms SZS Tools
File:Wiimms-SZS-Tools.png
Author: Wiimm
Operating Systems: Linux (i386,x86_64),
Mac (ppc,i386,x86_64),
Windows (cygwin).
Software Type: SZS, BMG, StaticR.rel and Image Manager
File Formats: SZS, U8, BRRES, BREFF, BREFT, BMG, TPL, TEX0, StaticR.rel, PNG
Current Version: 0.12a, 2011-06-16
Current Beta: 0.13a beta3, 2011-07-04
Website: szs.wiimm.de

Introduction

Wiimms SZS Tools is a set of different tools to manipulate SZS, U8, BRRES and BMG files. All tools are command line tools and run without any interaction. The tools are available for Linux, mac and Windows. The main goal is to run them in batch files and scripts to automate recurring jobs. At the moment there are two tools:

One main goal is the fully automated track name replacement. The tools together can do this. Another goal is to extract all sub files recursivley and transforming they into user friendly file formats (like text of png files) and support recreation of the original source files.

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

There is also an little How To.

History and Download

What's new

Beta Version

  • Tool wszst can now extract images of BREFT subfiles and of TPL and TEX0 files. The following Image Formats are supported: I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA32, C4, C8, C14X2 and CMPR.
  • If tool 'wszst creates an archive, to looks for new PNG files and convert them back to the internal file and image format.
  • The new tool wimgt will convert file and image formats:
    • Supported file formats: BREFT subfiles, TPL, TEX0 and PNG.
    • Supported image formats: I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA32, C4, C8, C14X2, CMPR and PNG.
      • Creating TPL images files with more than 1 image is not supported yet.
      • Creating palette image formats C4, C8 and C14X2 are not supported yet.


Change Log

szs v0.13a.beta3 r2805 - 2011-07-04

 - Bug fix for tool wszst: Tool chrashed when creating BRRES files with empty
   sub directories.

 - wszst: Export of internal images (BREFT subfiles, TPL, TEX0) to PNG files
   is done while extracting archives if decoding is enabled. Supported image
   formats: I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA32, C4, C8, C14X2 and CMPR.

 - New tool: wimgt = Wiimms Image Tool : Convert and manage images files.
   Supported file types: BREFT subfiles, TPL, TEX0 and PNG.

    - wimgt LIST:    List images files and print types and geometry data.
    - wimgt DECODE:  Export an internal image to a PNG file.
    - wimgt ENCODE:  Import PNG images and store them in internal formats.
    - wimgt CONVERT: Convert formats (file and image format).

 - All tools: new command FILETYPE (=FT): Scan the header of the entered files
   and print file type and path for each file as list.


Known bugs:

  - If creating a BRRES the internal name of the sub file is not set to
    the filename. This could be problematic if a sub file was renamed.

  - Creating TPL images files with more than 1 image is not supported yet.

  - Creating palette image formats C4, C8 and C14X2 are not supported yet.


szs v0.12a r2693 - 2011-06-16

 - Bug fix for Windows install script: Remove duplicate SZS entries from PATH.

 - wszst CREATE: Create BREFF and BREFT files.


szs v0.11a r2670 - 2011-06-04

 - New option: --single-line (-1): No continuation lines for BMG text output.

 - Support for BREFF and BREFT files: Listing and extraction, but not creation:

    - wszst LIST: List also BREFF and BREFT files inlcuding recursive lists.

    - wszst EXTRACT: Extract also BREFF and BRRES files. Recursive extraction
      of theses file types is implemented but disabled because of not
      implemented creation support.

Links

wszst (Wiimms SZS Tool)

wszst is a command driven tool to manipulate SZS files.

Features

  • wszst supports compressed and uncompressed SZS files. Uncompressed files are good for analysis. Supported archive formats are U8, BRRES, BREFF and BREFT. The format of each source file is detected independent of the file name.
  • wszst LIST lists the content of a SZS, U8, BRRES, BREFF and BREFT archives and directories. It lists also extracted file systems to preview the creation process.
  • wszst DIFF compares 2 SZS files on file level. This comparing is independent of the compression and of file order.
  • wszst NORMALIZE read an U8 archive, compressed or not, and write it back in a normalized form.
    • The files are sorted in a Nintendo like order.
    • Unused data holes are removed.
    • If directory '.' is available it becomes the root directory for all others.
    • Compressed sources are compressed again with maximum compression (level 9).
    • The destination is only written if any data changed.
  • wszst COMPRESS and wszst DECOMPRESS convert SZS files from and to compressed format.
  • wszst EXTRACT extract the directories and files to the local file system to make access very easy. Recursive extraction and automatic decoding of some file formats is also possible.
  • wszst EXTRACT extract known archives reclusively and can decode BMG files and graphic images on the fly.
  • wszst CREATE creates SZS files from directory structures. All files are included, include and exlcude lists are supported. Recursive creation and automatic encoding of some file formats is also possible.
  • wszst CAT allow to access one or more sub files within SZS files. The output of all sources is concatenated and written to stdout.
  • Extrating a SZS file and creating again results in the same SZS file. Only the internal order of the files may be changed.
  • wszst DIFF compares 2 SZS files on file level. This comparing is independent of the compression and of file order.

wszst LIST

The command LIST list the sub files of SZS files.

wszst LIST

Example:

# wszst lll Award_G.szs

* Files of Award_G.szs

off/hex siz/hex size/dec  magic file or directory/
-------------------------------------------------------------------------------
      -       -        -  -     ./
      -       -        -  -     ./award/
      -       -        -  -     ./dpd_pointer/
      -       -        -  -     ./message/
    120    2580     9600  MESG  ./message/Common.bmg
   26a0   18300    99072  MESG  ./message/Menu.bmg
  1a9a0    1fc0     8128  MESG  ./message/Race.bmg
      -       -        -  -     ./message_window/
      -       -        -  -     ./pad_recognize/
      -       -        -  -     ./winning_run/

wszst DIFF

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

wszst DIFF

Example:

# wszst diff Award_G.szs MenuMulti_E.szs

* Only in source #1: ./award/
* Only in source #2: ./bg/
* Only in source #2: ./button/
* Only in source #2: ./control/
* Only in source #2: ./globe/
* File size differ:  ./message/Common.bmg [9984+256=10240]
* File size differ:  ./message/Menu.bmg [97920-7552=90368]
* Only in source #1: ./message/Race.bmg
* Only in source #2: ./model/
* Only in source #1: ./winning_run/
Content differ: Award_G.szs : MenuMulti_E.szs

wszst NORMALIZE

The command NORMALIZE read an U8 archive, compressed or not, and write it back in a normalized form:

  • The files are sorted in a Nintendo like order.
    • ('/' is less than) '.' is less than digits is less than letters is less than others.
    • The case of letters is ignored.
    • For same group of characters use ASCII order.
    • For each directory: Real files are inserted before sub directories.
  • Unused data holes are removed.
  • If directory '.' is available it becomes the root directory for all others.
  • Compressed sources are compressed again with maximum compression (level 9).
  • The destination is only written if any data changed.

Normalized files are for archives and to find files with the same content.

wszst NORMALIZE

wbmgt (Wiimms BMG Tool)

wbmgt is a command driven tool to manipulate BMG files.

Features

  • wbmgt supports raw and text BMG files. Raw BMG is the file format needed by Nintendos software. Text BMG is a user readable and editable format. wbmgt includes in every text export a little syntax documentation.
  • When reading a file, wbmgt detect the format of each source file independent of the file name. This make the usage of raw and text BMG files interchangeable.
  • wbmgt may read BMG files directly from SZS files. Just enter the path and assume that the SZS file is a directory. Example: pathto/my.szs/message/Common.bmg
  • wbmgt LIST lists the contained strings for a fast preview.
  • wbmgt DIFF compares the strings of 2 BMG files and reports the differences.
  • wbmgt PATCH patches each source by using a list of patch files. There are several patching modes: REPLACE, INSERT, OVERWRITE, DELETE, MASK, EQUAL and NONEQUAL. Like every source, raw and text BMG files are accepted as patch.
  • wbmgt DECODE converts each source file into text mode. Patching while decoding is possible.
  • wbmgt ENCODE converts each source file into raw mode. Patching while encoding is possible.
  • Decoding a raw BMG file and encoding again results in the same BMG file.

wstrt (Wiimms StaticR Tool)

wstrt is a command driven tool to manipulate StaticR files of Mario Kart Wii.

Features

  • wstrt can analyze and patch StaticR files of Mario Kart Wii (PAL and NTSC).
  • wstrt ANALYZE analyzes StaticR files and detects CTGP 4.4 patches and modifications of track and arena orders. A possible patch is virtually applied before prinbting.
  • wstrt PATCH modifies the track and arena order of StaticR files. So it is possible to move tracks with special features (like snow or fog) to other slots.
  • wstrt TRACKS and wstrt ARENAS print a list of tracks or arenas with slots and filenames (track and sound files). If a StaticR file is entered, the track/arena order of that StaticR is used. A possible patch is virtually applied before prinbting.
  • wstrt FILES prints a list of filenames of all tracks and arenas in machine readable format. If a StaticR file is entered, the track and arena order of that StaticR is used. A possible patch is virtually applied before prinbting.

wimgt (Wiimms Image Tool)

wimgt is a command driven tool to manipulate graphic images of Mario Kart Wii.

Features

  • wimgt supports internal image formats (I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA32, C4, C8, C14X2 and CMPR) and PNG files. wimgt and also wszst EXTRACT will search for images in BREFT subfiles, TPL and TEX0 files.
  • When reading a file, wimgt detect the image format of each source file independent of the file name.
  • wimgt may read images directly from SZS files. Just enter the path and assume that the SZS file is a directory.
  • wimgt LIST lists the images of a director and print out geometry data for each image.
  • wimgt DECODE converts each image into a ONG file.

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.
  • Read BMG file, convert to internal representation and write a new BMG file. Then compare the new BMG with the original one.
  • Convert all BMG files into the text format and back again. Then compare the new BMG with the original one.

All tests run without errors.

Links