WU8 (File Format)
The file format WU8 (Wiimms U8) was developed by Wiimm for his SZS Tools. It is designed to allow exchanging of custom tracks over the Internet without any Nintendo stuff and without license problems. The design is similar to the file format U8, but it is encoded in a simple way (XOR only). A WU8 can only be decoded, if the original and unique objects files (BRRES, BREFT, BREFF, BRASD and KCL) are available. This makes WU8 to a patch file against the different sub files.
See »File format: U8 archives« for related file formats.
A normal custom track SZS file consists of many sub files. Some of the sub files are made by the CT creators, some of them are Nintendo's files and some of them are based on Nintendo's file (modified files). The main idea of the WU8 algorithm is, that unmodified files of Nintendo will not be copied and modified Nintendo are only copied in encrypted form with Nintendo's original files as key.
Because there is no secret on a WU8 file, a very easy and fast encryption method is used: XOR (bit wise exclusive or).
And here is the encoding algorithm:
- First, a basic key (8 bit for XORing) is created using the U8 length.
- All sub files are iterated. If the sub file is a well known object support file (a file of the auto-add archive), the original is loaded and the data is XORed with the basic key and the loaded file. The included file can be changed or larger or smaller. Non object files are proceeded later.
- A summary key is created by the the basic key and by all loaded archive files of the previous step.
- In a second iteration all non object support files are coded using the summary key.
- The U8 directory is coded by the basic key.
- The magic is exchanged.
Decoding uses the same steps, but in order 1, 6, 5, 2, 3, 4.
This gives up a new U8 like archive with the following features:
- If the SZS contains an unmodified object support file, its content are replaced by a multiple copy of the same constant. This is very good compressible and makes the WU8 file smaller than the related SZS.
- If the SZS contains an modified object support file, and only some parts are modified (but not moved), the unmodified parts are still the same constant. For the modified part the original file is used as key.
- A totally changed object support file is encoded by the original file.
- All non object support files are coded using the summary key. This summary key is build by all object support files. For decoding, the auto-add library with the original files is needed.
- Because of using only XOR, the files are good compressible by the Yaz0 and other compressors. Using WU8 with bzip2 compression will results in smaller files → WBZ
- The algorithm is very simple, but it should not hide its content, it should only be dependent of the original files.
- This implementation was relative easy, because Wiimms SZS Tools knows already all files of all tracks and the auto-add archive was implemented long time ago.
- Without Nintendo's files its impossible to reconstruct the original SZS. The disadvantage is, that the user must work with Wiimms SZS Tools or with one of the alternative tools.
This part describes the commands of Wiimms SZS Tools, the only tools that support WU8 files.
Create a WU8 file
To create a WU8 file, just type one of ...
wszst normalize --wu8 mytrack.szs wszst compress --wu8 mytrack.szs wszst decompress --wu8 mytrack.szs
... where mytrack.szs is the track file. An new file named mytrack.wu8 is created. Command compress creates always a Yaz0-compressed version of the file and decompress an uncompressed file. Command normalize create a normalized version of a track without changing the compression state. If unsure, use normalize.
Add some of theses options:
- Add --overwrite (-o), to overwrite an existing file.
- Add --dest file (-d file) to create the WU8 file with an alternative file name.
- Add --DEST file (-D file) to create the WU8 file with an alternative file name and if the destination directory does not exist.
Decode a WU8 file
Decoding a WU8 file is simple as encoding it. Just type ...
wszst normalize --u8 mytrack.wu8 wszst compress --u8 mytrack.wu8 wszst decompress --u8 mytrack.wu8
... where mytrack.wu8 is the track file. An new file named mytrack.szs is created. You can use the same options as above.
Creating the Auto-Add Library
Because encoding is done by using Nintendo's original files, the decoding process also needs the same files. Wiimms SZS Tools has a built-in SZS sub file database and supports an auto-add library. These 2 parts are used for en- and decoding the WU8 files.
Extract the track files of a MKW image
First you need a copy of all tracks of the original DVD of Mario Kart Wii. The tracks resides in /Race/Course. You can use WiiScrubber (interactive) or Wiimms ISO Tools (command line) to extract the directory.
With Wiimms ISO Tools you can use:
wit extract --files +/files/Race/Course --flat mkw.wbfs tracks.tmp
- mkw.wbfs is the ISO image of Mario Kart Wii. All known file formats (ISO, WBFS, CISO, WDF, WIA) are supported.
- tracks.tmp is a temporary directory, where all extracted track files are stored.
Create the auto-add library
To create the auto-add library, type:
wszst autoadd /path/to/track_dir
If you have extracted the tracks with the wit command above, type:
wszst autoadd tracks.tmp
You can verify the auto-add library with:
wszst autoadd -v
The following tools can handle WU8 files:
- Wiki links