Friday, 7 October 2011

Mario Sports Mix: Texture Hacking Tutorial



Finally, after almost half a year of waiting, I've been able to get the materials needed to modify the contents of Mario Sports Mix. And because of this, I decided to give you guys a tutorial on how it's done.

To begin, you need the following items, programs, and tools...

1: Mario Sports Mix ISO; get it legally or with Google.
2:
ntcompress.exe; required to decompress/compress the ISO files. Google up Revolution SDK, as a direct link is illegal to post.
3:
BrawlBox; required to convert textures into TEX0 files.
4:
SZS Modifier; required to view texture offset placements.
5: The GIMP or Adobe Photoshop CS3/CS4; The GIMP is free, but not Photoshop.
6: A Hex Editor; required for replacing texture data. Hex Workshop is one example.


The first thing to keep note of is that the ntcompress.exe program that you'll need is a newer revison, so the one that Super Smash Bros. Brawl uses is rendered useless.

1: File Decompression

First up, you need to use ntcompress.exe to decompress the files that you want to edit. Now, Mario Sports Mix uses the LH compression, which is a combination of the LZ77 and Huffman encoders. With Command Prompt, head to the folder that has ntcompress.exe, and input the following...

ntcompress -x -o [output file] [compressed file]

If done correctly, you should get a decompressed version of the ISO file.

2: Texture Modifying

With the files decompressed, it's time to extract the textures. You can use BrawlBox for the BRRES files, but some of the decompressed files are ARC container files, which can only be opened up with the SZS Modifier.

Once you've opened up the archives, extract the textures that you want to edit, and use an image editing program to edit the textures. The GIMP or Adobe Photoshop CS3/CS4 are the best programs to use. CS3/CS4 has the ability to view alpha layer data, which will make modifying RGB5A3 and RGBA8 textures easier when exported as TarGA (.tga) files.

After modifying the textures, import them with BrawlBox. You can also use the SZS Modifier, but there are three texture formats that the SZS Modifier does not handle. More on that later.

If you use BrawlBox, you must extract the modified textures as TEX0 files. You must then use a hex editor to import the new textures onto their respective files. You can use the SZS Modifier to find the offset placements of each texture.

3A: TPL Editing

Like with Mario Kart Wii, Mario Sports Mix has TPL files too. However, Mario Sports Mix features a lot of CI4 and CI8 textures, which can't be modified with the SZS Modifier. You have to use a combination of BrawlBox and a hex editor to edit them.

When dealing with the CI4 and CI8 textures, you need to not only export your textures as TEX0 files, but you also need to export the palettes as PLT0 files.

Regarding the TPL data, it varies, depending on the texture format. For I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA8, and CMPR, the texture data always begins at offset placement 0x40.

For CI4 and CI8, however, the TPL data is a bit different. The palette data begins at offset placement 0x20, but the texture data offset placement varies, depending on the size of the palette.

0x080 - 16 color palette
0x0a0 - 32 color palette
0x0c0 - 48 color palette
0x0e0 - 64 color palette
0x100 - 80 color palette
0x120 - 96 color palette
0x140 - 112 color palette
0x160 - 128 color palette
0x180 - 144 color palette
0x1a0 - 160 color palette
0x1c0 - 176 color palette
0x1e0 - 192 color palette
0x200 - 208 color palette
0x220 - 224 color palette
0x240 - 240 color palette
0x260 - 256 color palette


With a hex editor, import the PLT0 data onto the palette data portion of the TPL file, and then import the TEX0 data onto the texture data portion of it. However, after inputting the palette data, you need to skip 64 bytes before inputting the texture data.

On a side note, some textures use the CI14x2 texture format, which is incompatible with BrawlBox. As a result, those textures can't be modified, even with the SZS Modifier. Fortunately, this texture format is rarely ever used.

3B: CSS Icon Editing


The character select screen uses TPL files that use the CI8 texture format. However, each CSS icon uses a different color amount. To replace them, you need to keep the following info in mind...

ico_daisy.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_diddykong.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_donkeykong.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_kinopio.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_kinopio_p01.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_kinopio_p02.tpl - 80x32px - CI8 texture - RGB5A3 palette - 224 colors
ico_kinopio_p03.tpl - 80x32px - CI8 texture - RGB5A3 palette - 224 colors
ico_koopa.tpl - 80x32px - CI8 texture - RGB5A3 palette - 256 colors
ico_koopajr.tpl - 80x32px - CI8 texture - RGB5A3 palette - 256 colors
ico_kuroma.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_kuroma_p01.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_luigi.tpl - 80x32px - CI8 texture - RGB5A3 palette - 256 colors
ico_mario.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_moglie.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_ninjya.tpl - 80x32px - CI8 texture - RGB5A3 palette - 224 colors
ico_ninjya_p01.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_peach.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_sabotender.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_shiroma.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_shiroma_p01.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_slime.tpl - 80x32px - CI8 texture - RGB5A3 palette - 208 colors
ico_slime_p01.tpl - 80x32px - CI8 texture - RGB5A3 palette - 160 colors
ico_slime_p02.tpl - 80x32px - CI8 texture - RGB5A3 palette - 144 colors
ico_waluigi.tpl - 80x32px - CI8 texture - RGB5A3 palette - 240 colors
ico_wario.tpl - 80x32px - CI8 texture - RGB5A3 palette - 256 colors
ico_yoshi.tpl - 80x32px - CI8 texture - RGB5A3 palette - 176 colors
ico_yoshi_p01.tpl - 80x32px - CI8 texture - RGB5A3 palette - 176 colors
ico_yoshi_p02.tpl - 80x32px - CI8 texture - RGB5A3 palette - 176 colors
ico_yoshi_p03.tpl - 80x32px - CI8 texture - RGB5A3 palette - 192 colors


The files that contain those TPLs are used with specific languages. For all the languages, view them here.

Note: The list above is incompatible with the Dutch language; lc25_EuDu. This is because its CSS icons do not follow the same setup as the other languages.

4: File Recompression

After modifying the ISO files, you need to recompress them with ntcompress.exe. Remember that Mario Sports Mix uses the LH compression method.

ntcompress -lh -o [output file] [decompressed file]

5: Testing the Edits

To finish up, you need to place the modified files back into their proper directories.

ISO:\ball\ - Balls
ISO:\chr\ - Characters
ISO:\lyt\ - TPL Data
ISO:\stage\ - Stages

There are two ways to test out your edits. You can either use Riivolution, or set up a custom ISO. If you do a custom ISO, there's no need to patch main.dol.

Basically, on an actual Wii system, load up the Mario Sports Mix ISO, and if you did the work right, you'll see your texture edits.

I made sure that my work actually works before making this tutorial, so I'm quite sure that it'll work with other people. Again refer to here for all the IDs that I've covered.

Note: I've only done this work with a custom ISO; this hasn't been tested with Riivolution.

6: Conclusions

And there you have it. You now have the knowledge needed to modify the contents of Mario Sports Mix.

15 comments:

  1. I'm going to sound like a noob here but, can I have a favour? You know New Super Mario Bros Wii had a pack where you just extracted it into the root of the SD card then loaded it trough Riivolution? Well, is it possible to make a pre-made pack with this game to? With the 3 textures made so far (Yoshi and White Mage). I'm terrble with hex and coding ect, and I would LOVE to use the texture hacks. I use the English PAL version of the game. Thank you for reading this! :D

    ReplyDelete
  2. I will let you know that the PAL version of Mario Sports Mix has languages that the NTSC-U version does not cover; there is a blog post that I did, relating to that. Keep that in mind when editing TPLs.

    Anyway, the texture hacks should be region friendly, but that's something that I can't confirm.

    ReplyDelete
  3. I have a serious problem! D: I can find the "newer revision of Revolution SDK" ANYWHERE! I got ntcompress.exe from media fire and it doesn't work either, I'm at a loss what to do! I have Googled as many possibilities of what I can think of and I only get 2.1 which is on pirate bay. I need to open the Menu and Tour mdl files. Where can I get the "newer version" or at least point me in the direction of what to exacly Google. Thanks for your time....... again! xD

    ReplyDelete
  4. Another idea is it possible to upload the two mdl files with White Mage and the two Yoshi's files ALREADY in it? Then you can just place it in the ISO like a snap.

    ReplyDelete
  5. Tip: Include 3.2 in your search. You're on your own after this.

    ReplyDelete
  6. "Sigh" I suppose I'll have to wait for a another "legal" compression tool to be made. :/ I still think it would be easier to upload the mdl files ready to put into the ISO though, I really don't want to create the hacks myself, just use the Yoshi hacks ready-made really. xD

    ReplyDelete
  7. Sorry, but you know that torrents are illegal to distribute. Anyway, the only way you can hack Mario Sports Mix right now, is to use Google to find the newer Revolution SDK.

    Think back to what Brawl hacking was like before BrawlBox came to our lives.

    ReplyDelete
  8. Actually, I never hacked Brawl. :P Only NSMB I still don't. Lol xD ANYWAY I figured out that the 3 files in the chr folder should replace the real ones in the ISO, the hacks work fine exept on tournament mode, the character selection screen and the VS screen before a match the Characters are their origional colours. Any reason why? :P Inside the match the colours are the hacked ones and so are the icons at the top, even the change court faces. Well thanks, again...... again, AGAIN! xD

    ReplyDelete
  9. Menu.mdl contains the character models for the character select screen; Tour.mdl contains the character models for Tournament Mode.

    You have to modify those two files as well, which is why my texture downloads come included with two BRRES files; one is for Menu.mdl; the other is for Tour.mdl.

    ReplyDelete
  10. Ahhh! I see, well I'm fine with just the colour's in game, I guess xD. I'm sure another compression method will be released and I can wait. :P Thanks again (ect). xD

    ReplyDelete
  11. Although...... if you try to play hockey with these textures the game freezes, all the other sports are fine. D:

    ReplyDelete
  12. The game crashes in Hockey? I tested the textures in that sport too, and they work without any flaws.

    ReplyDelete
  13. Seriously! I honestly have no idea why, Dodgeball and Vollyball work fine. I havn't tested Basketball.

    ReplyDelete
  14. Region related maybe? Again my Wii is NTSC-U, so it's likely that the other regions operate differently with its files; the languages are one example.

    ReplyDelete
  15. Okay, it turns out that the problem is not region related, because when I decompressed the PAL files, they used the exact same file size as their NTSC-U counterparts.

    Therefore, judging by this info, the hacks should easily be region friendly. Maybe it's just bad luck on your end.

    ReplyDelete