Runtime Wbz Decoding

From Custom Mario Kart
Jump to navigation Jump to search
Runtime Wbz Decoding
Author: Kazuki
Software type: Code extension
Version: v1.0.1
Date of latest version: 2024-02-14
Download: GitHub
Source code: GitHub

Overview

Runtime Wbz Decoding is a code extension of Mario Kart Wii created by Kazuki. It decodes WBZ/WLZ to U8 when track data is loaded by game code. This reduces the capacity of most tracks by 30-40% (when using WLZ). The extension was designed to reduce the time required to install distributions that distribute tracks as WBZ, such as Wiimms Mario Kart Fun, and to reduce the capacity of huge distributions, such as Insane Kart Wii, by using WLZ. It consists of a custom REL and Gecko code to load it.

As shown here, the "auto-add library" is required for WBZ/WLZ decoding. Therefore, this uses auto-add.arc dumped by RevoKart Dumper.

Credits

Tutorial for Using Runtime Wbz Decoding in Your Distribution

1. Convert SZS Files

Convert SZS files in the /Race/Course directory to WBZ or WLZ. Rename the extension from .wbz/.wlz to .szs.

Wiimms SZS Tools can be used to convert SZS to WBZ/WLZ.

wszst normalize track.szs --wbz --dest track.wbz
wszst normalize track.szs --wlz --dest track.wlz

The following commands convert all *.szs files with a single call (see [1] for %N):

wszst normalize "*.szs" --wbz --dest %N.wbz
wszst normalize "*.szs" --wlz --dest %N.wlz

2. Add Gecko Code to Load RELs

Add the following Gecko code to your distribution:

3. Use Modified LE-CODE Loader (If Your Distribution Uses LE-CODE)

The original LE-CODE Loader cannot be used with custom RELs.

If you are using the LE-CODE Loader or the --add-lecode option in Wiimms StaticR Tool, use the Modified LE-CODE Loader instead. Do not use the --add-lecode option in Wiimms StaticR Tool.

If you are using the CT Distribution Loader, update to v1.1 or later.

4. Add Custom REL File

Add custom RELs to the /rel directory.

Riivolution XML example:

<file disc="/rel/runtime_wbz_decoding_P.rel" external="/{your distribution directory}/rel/runtime_wbz_decoding_P.rel" create="true" />
<file disc="/rel/runtime_wbz_decoding_E.rel" external="/{your distribution directory}/rel/runtime_wbz_decoding_E.rel" create="true" />
<file disc="/rel/runtime_wbz_decoding_J.rel" external="/{your distribution directory}/rel/runtime_wbz_decoding_J.rel" create="true" />
<file disc="/rel/runtime_wbz_decoding_K.rel" external="/{your distribution directory}/rel/runtime_wbz_decoding_K.rel" create="true" />

5. Add auto-add.arc Dumped by RevoKart Dumper

ALL FILES IN auto-add.arc ARE ORIGINAL TRACKS AND SHOULD NOT BE DISTRIBUTED!

Add auto-add.arc to the /Race/Course directory.

For Riivolution patches, the following XML is highly desirable:

<file disc="/Race/Course/auto-add.arc" external="/rk_dumper/auto-add.arc" create="true" />

How to Create auto-add.arc from ISO

If RevoKart Dumper is not available due to disc drive failure or other reasons, Wiimms ISO Tools and Wiimms SZS Tools can be used to create auto-add.arc from an ISO.

1. Create "auto-add library" as a Directory

wit extract --files +/files/Race/Course --flat RMCJ01.iso tracks
wszst autoadd tracks --dest auto-add

2. Archive with Wiimms SZS Tools

Run the following command:

wszst c auto-add --nocompress --pt --dest auto-add.arc

3. Verify auto-add.arc.

wszst sha1 auto-add.arc

It should be a4b2af6b878ee73928d463d5f088be6335af6f0e.

Version History

Version Date of release Information
v1.0 2023-12-26 First release
v1.0.1 2024-02-14
  • Fixed crash when reading staff ghosts.
  • Fixed an issue where WBZ/WLZ could not be decoded correctly on a few tracks.