MKW LAN Mod Guide [w/ USB Loading & Gecko Codes]
#1
Ramble-y Preamble: Feel Free to Skip

So, I had a MKW LAN party late last year using DWC emulator, and while it went great, I don't think I'll ever bother to set up (or maintain/keep around) DWC emulator again, since its honestly kind of a pain in the ass, and it doesn't seem to have been maintained in a few years now, so it'll only continue to be more and more of a pain in the ass as time goes on.

So, I wanted to find a better solution that wasn't "Fuck it, I'mma just use Wiimmfi", so I turned my attention back to the MKW LAN mod made by Chadderz and MrBean35000vr. The reasons I hadn't used it then were pretty simple: I couldn't USB Load with it (big deal breaker, this game is like $40 a pop!), I couldn't run any Gecko codes with it (I need my 150cc), and it doesn't work in Dolphin (which is through no fault of the mod as far as I know, its an issue with Dolphin, sadly). Well, I managed to find solutions to both how to USB load it, and how to run Gecko codes alongside the LAN mod, making it much easier to set up a LAN party without nearly as much fuss.

I set to work first to figure out how to get it to USB load. I already knew it couldn't be ISO patched at all, and while its not impossible for BrainSlug module support to be added into a USB loader directly, no one has done it. I've got to use the BrainSlug boot.dol no way around it. Well, it just so happens I lucked, out: You can go into your game settings and simply enable alternate dol and place the BSlug .dol according, and the USB loader will load BrainSlug, and then BrainSlug will load its modules and then the game .dol like a charm. I can't believe I didn't think to do that before, but now I don't have to worry about spending tons to get 6 copies of Mario Kart Wii.

The biggest effort I had to put in was not having Gecko Codes of course. The first thing I tried was turning on Ocarina codes in USB Loader GX, and no dice. Nothing changed. In the same vein as the last problem, I also tried to see if I could get BrainSlug to load GeckoOS or the other way around, and then load into the game, but I just couldn't find any way to do this. Finally, I simply tried to patch the codes into the game's main.dol with wstrt, and again nothing. Nothing changed at all even though no vanilla dol was available! Well, I guess BrainSlug just wacks off extra hooks or something, and there ain't much to change about that.

If I'm getting cheats to run with the LAN Mod, its going to be in BSlug module form. Originally I had no clue how to pull off making a Gecko codehandler module, and in this guide's original form I had instead just figured out how to do basic RAM writes directly to convert basic 00/02/04 codes into stand alone modules. For what it was worth, it did its job fine enough, but it left ASM/C2 codetypes unusable, and still had a lot to be desired tho. Thankfully InvoxiPlayGames dropped me some great info in this thread, and helped me out in Discord DMs, and I was able to make a complete Gecko codehandler module that loads GCTs right from the SD card. Its ended up being really simple (much simplier than coverting codes into modules lol), and it works for any game too. I can't really say I can take credit for it though, IPG basically make the code for me, and while I managed to figure out a good bit of it on my own before that I wouldn't have gotten anywhere without her, so big shout outs to InvoxiPlayGames!

I've left the old code conversion modules I made in the post below, if you happen to be interested for whatever reason.



MKW LAN Mod: Pros & Cons, Requirements

Requirements:
* All Wiis will need to have the homebrew channel installed (and cIOS if you plan to use a USB loader). Check out https://wii.guide/ for a good tutorial on Wii, and https://wiiu.hacks.guide/ on Wii U.
* You'll need at least half as many Wiis as you do players (you can have 1 or 2 players per Wii), 1 TV per Wii, 1 controller per player, and a router to network them all together. If you're at a huge event (tournament, convention, etc) you might want to be mindful of all the wireless talk around and use ethernet if you can, but otherwise Wifi works just fine.

Pros:
+ Simple, easy
+ Doesn't require any extra computers, just Wiis
+ Can be used with a USB loader and Gecko codes, for custom tracks and more

Cons:
- Can't use Dolphin (emulator bug)
- Can't invite remote players, if the whole gang can't be there in person
- Does not support NTSC-K (intentional crash)

If you know your way around Linux, got an extra computer/VPS/Rasberry Pi, and want to suppliment your Wiis with PCs running Dolphin and/or want to invite remote friends to join in, you'd be better off using DWC Emulator (or if you're not good with Linux, saying fuck it and using Wiimmfi).

If you just want simple and easy, and you've got enough Wiis, this is the guide for you.



Tutorial: How to get set up and running

0) Ensure you have a disc copy of MKW, or have a WBFS of the game on your USB and ready to rock for each Wii (U) console you will be using. You can use discs and WBFSs in any mixture, you just need 1 per Wii. Every following step will focus on just one Wii, repeat for each Wii.

1) Download the MKW LAN mod from here: http://www.chadsoft.co.uk/downloads/LAN_MKW_v0.9.zip

2) Copy the contents of the release folder to the root of your SD card.

2.1) If you are USB Loading, you will need to make a copy of the boot.dol file in the /apps/brainslug folder and move/rename to the appropriate location to use it as an alternate dol. For USB Loader GX, you should rename boot.dol to RMCE01.dol (for NTSC-U, use RMCP01 for PAL, and RMCJ01 for NTSC-J) and put it on the root of your USB or SD card.

3) If you want to use Gecko Codes (ex: Force 150cc in Friend Rooms), download the attached files on this post for a zip folder containing a Gecko codehandler BrainSlug module, and copy the contents to the root of the SD card (you should have 4 new .mod files in /bslug/modules). Then just make a GCT of all the codes you want to use (https://mkwii.com/gct) and copy it to /codes/RMCE01.gct (RMCP01 for PAL, RMCJ01 for JP). You only need to make the GCT once, you can copy the same GCT for every Wii.

4) Once you have everything copied over, insert your SD card (and USB) into your Wii and turn it on. If you are playing on a disc, you can just launch BrainSlug from the homebrew channel. BrainSlug will now load all your modules and boot the game. This Wii is now ready to go, rinse and repeat this process for all Wiis.

4.1) If you are USB loading, launch your USB loader, and turn "alternate dol" on, then launch the game. You should see BrainSlug appear and start loading modules. It should boot into the game once it is done. This Wii is now ready.

Pro tip: BrainSlug modules are loaded entirely into RAM, so once the game boots you can remove the SD card and reuse it on the next Wii!

5) Now that all the Wiis are ready, if they are all set up on the same network, you should be able to hit 1 or 2 player LAN Multiplayer on all of them, have one of them open a room, and the rest of them can check the friends list and join the host. Thats it! Its time to play!



Misc Notes

Just some useful observations that I honestly don't know where to put.

1) The Gecko codehandler module I made and provided in this post has a GCT limit much lower than you'd normally expect out of other codehandlers. Your GCT can only be about ~230 lines long or 1880 bytes long. Any longer, and you'll get a crash on the strap screen. I'm honestly not entirely sure what the issue is, since I swapped the USB Gecko modules codehandler with JoshuaMKW's full codehandler, which is supposed to do up to 450 codes. Source code is provided with the Gecko codehandler module, so if you think you can extend/increase the modules GCT space before it crashs, feel free to give it a crack.

TL;DR: Keep your GCT under 230 lines of gecko codes. This shouldn't be too hard to do, so long as you stay away from MrBean's item rain code (or other obscenely long codes). That thing is 201 lines alone! Yeesh!

2) Despite being able to use alternate dol in USB Loader GX to load BrainSlug and then load into the WBFS, trying to load into BrainSlug from Riivolution just results in a crash. BrainSlug seems to shake off hooks or something as it boots, which includes ingoring sections of the dol it is booting. Even tho you can inject a GCT directly into MKW's dol file with wstrt, it does nothing after BrainSlug boots it. This is probably due to how BrainSlug modules work, being relocatable ELF files in a similar way to how StaticR.rel works, and Brainslug ends up dropping the dol section with the GCT. Due to the above two factors combined, you won't be able to use an Riivolution mod packs you already have with the LAN mod. InvoxiPlayGames does have a Emvolution module that reads game files off the SD card similar to Riivolution, but it currently requires you complie the module yourself to use your own list of file replacements, so I wouldn't recommend it for casual player. A modded WBFS works better, since a lot of mods out there provide a pre-made WBFS, but most all mod packs now a days both use some Gecko code or another somewhere, and usually embed it into the game dol, so even with a pre-made WBFS, you'll still be missing the critical Gecko codes other parts of the mod may rely on if launched with BrainSlug.

TL;DR: While its possible to play with custom tracks using this guide, its beyond the scope of this guide to help you do that. If you don't have the tech know how to do it, tehn you should just use CTGP instead. It has the LAN Mod built in, and you get access to all of CTGP's usual features. All you have to do is install CTGP and change your online setting from Wiimmfi to LAN in the CTGP channel. This will mean you'll need a real disc for every Wii though, so I hope your wallet is ready.



Conclusion: Thanks to all you dedicated modders

Honestly, I already put all my words (too many words!) into the rest of this thread, so I don't have too much more to say. A massive thanks and shout out to all the dedicated modders out there that have done so much to learn and document so much stuff about the Wii and modding it, Mario Kart Wii and how it works, as well as mod the game to hell and back with ASM cheat codes, custom tracks, and just tons of insane work I can't even begin to mention like the LAN Mod this guide is about, and all the tools and info out there to be find and used. I wouldn't have been able to do any of it if I didn't have all this stuff to use as a foundation. Thank you all so much!

I'd especially like to give a shout out to InvoxiPlayGames, thank you so much for the help with making a Gecko codehandler BrainSlug module!


Attached Files
.zip   Gecko Codehandler BrainSlug Module.zip (Size: 40.02 KB / Downloads: 53)
Reply
#2
Here is old, original version of this guide. Its a bit of a word salad, IMO, but hey, maybe this is the kind of bathroom reading material you need, IDK. At any rate, just follow the guide in the above post, there isn't much worth while in here (that isn't up there already).



Ramble-y Preamble: Feel Free to Skip

So, I had a MKW LAN party late last year using DWC emulator, and while it went great, I don't think I'll ever bother to set up (or maintain/keep around) DWC emulator again, since its honestly kind of a pain in the ass, and it doesn't seem to have been maintained in a few years now, so it'll only continue to be more and more of a pain in the ass as time goes on.

So, I wanted to find a better solution that wasn't "Fuck it, I'mma just use Wiimmfi", so I turned my attention back to the MKW LAN mod made by Chadderz and MrBean35000vr. The reasons I hadn't used it then were pretty simple: I couldn't USB Load with it (or so I thought), I couldn't run any Gecko codes with it (which does seem to be true, but some elbow grease has gotten me some pay off here, enough to satisfy me), and it doesn't work in Dolphin (which is through no fault of the mod as far as I know, its an issue with Dolphin). Well, if I can resolve a couple of these enough to satisfy me, then this can be a much simpler and more permanent solution to hosting a MKW LAN party in the future.

I set to work first to figure out how to get it to USB load. I already knew it couldn't be ISO patched at all, and while its not impossible for BrainSlug module support to be added into a USB loader directly, no one has done it. I've got to use the BrainSlug boot.dol no way around it. Well, it just so happens I lucked, out: You can go into your game settings and simply enable alternate dol and place the BSlug .dol according, and it will load BrainSlug, and then BrainSlug will load its modules and then the game .dol like a charm. I can't believe I didn't think to do that before, but now I don't have to worry about ordering 6 copies of Mario Kart Wii.

The biggest effort I had to put in was not having Gecko Codes of course. The first thing I tried was turning on Ocarina codes in USB Loader GX, and no dice. Nothing changed. In the same vein as the last problem, I also tried to see if I could get BrainSlug to load GeckoOS or the other way around, and then load into the game, but I just couldn't find any way to do this. Finally, I simply tried to patch the codes into the game's main.dol with wstrt, and again nothing. Nothing changed at all even though no vanilla dol was available! Well, I guess BrainSlug just wacks off any attempt to load a Gecko code handler, and there ain't much to change about that.

If I'm getting cheats to run with the LAN Mod, its going to be in BSlug module form. I could make a BSlug module that loads a gecko code handler and then loads codes for the game, but honestly IDK shit about Gecko, Wii ASM, coding in C, or any of the Wii methods/environment, etc, so making a BSlug Gecko handler would be *way* out of my ability. I instead looked for a short cut: armed with a template module, a handful of module source code to reference (including the MKW LAN modules source), Gecko code documentation and some computer fundamentals, I went about trying to convert basic codes into stand alone BSlug modules.

I'll spare some of the details, but I tried Auto A at Strap Screen first, copying the USB Gecko Debugger source nearly verbatim and hey, it worked! Didn't work for other codes tho, because turns out writing it to RAM at start and never again doesn't work. Looking at the MKW LAN mod revealed to me that I should do the RAM writes in the OSLink method instead, and hey! I got a basic RAM write code to work!

I didn't get any other kind of code to work, because again, I don't understand ASM, and just dumping the ASM at the write place didn't work (game just crashed if it was ever called), and I gave up there knowing that its well beyond my understanding. Anything else I can do would just be shooting in the dark. So I decided instead to scale back what codes I "need", and found "good enough" alternatives for ASM codes, and got a result that works for me. Lets see it shall we?



MKW LAN Mod: Pros & Cons, is it right for you?

Pros:
+ Simple, easy
+ Doesn't require an extra computer
+ Can use a modified WBFS for custom tracks and such if you USB Load (you could probably use Riivolution and a real disc too, just didn't test that)

Cons:
- Can't use Dolphin
- Lacks full Gecko Code support, so you'll have to make compromises on the non-vanilla changes you're used to having
- Can't invite remote players, if the whole gang can't be there

If you know your way around Linux, got an extra computer/VPS/Rasberry Pi, and want access to a full range of Gecko codes and/or to invite remote friends to join in, you'd be better off using DWC Emulator (or if you're not good with Linux, saying fuck it and using Wiimmfi).

If you just want simple and easy, and aren't very picky about a mostly vanilla experience, this is the guide for you.



Tutorial: How to get set up and running (Real disc and USB Loading)

Requirements
- Every Wii you plan to use will need to have the homebrew channel installed (and cIOS if you plan to USB load the game on that Wii). Check out https://wii.guide/ for a tutorial on that.
- Other than that, ensure you have at least half as many Wiis as you do players (you can have 1 or 2 players per Wii), 1 TV per Wii, 1 controller per player, and a router to network them all together. You can go insane and go full ethernet, or you can just use wifi for everything.

0) Ensure you have a disc copy of MKW, or have a WBFS of the game on your USB and ready to rock for each Wii (U) console you will be using. You can use discs and WBFSs in any mixture, you just need 1 per Wii. Every following step will focus on just one Wii, repeat for each Wii.
1) Download the MKW LAN mod from here: http://www.chadsoft.co.uk/downloads/LAN_MKW_v0.9.zip
2) Copy the contents to the SD card.
2.1) If you are USB Loading, you will need to make a copy of the boot.dol file in the /apps/brainslug folder and move/rename to the appropriate location to use it as an alternate dol. For USB Loader GX, you should rename boot.dol to RMCE01.dol (for NTSC-U, use RMCP01 for PAL, and RMCJ01 for NTSC-J) and put it on the root of your USB or SD card.
3) Check the attached files on this post for a zip folder containing BrainSlug conversions of various cheats found on this forum. Pick any modules that strike your fancy, and copy them to the /brainslug/modules folder on your SD card.
4) Once you have everything copied over, insert your SD card (and USB) into your Wii and turn it on. If you are playing on a disc, you can just launch BrainSlug from the homebrew channel. BrainSlug will now load all your modules and boot the game. This Wii is now ready to go.
4.1) If you are USB loading, launch your USB loader, and turn "alternate dol" on, then launch the game. You should see BrainSlug appear and start loading modules. It should boot into the game once it is done. This Wii is now ready.

Pro tip: BrainSlug modules are loaded entirely into RAM, so once the game boots you can remove the SD card and reuse it on the next Wii!

5) Now that all the Wiis are ready, if they are all set up on the same network, you should be able to hit 1 or 2 player on LAN Multiplayer on all of them, have one of them open a room, and the rest of them can check the friends list and join the host. Thats it! Its time to play!



Gecko Codes: But 100cc sucks! And I need everything unlocked! And how am I going to get rid of those shitty TCs?

As I mentioned in some of the previous sections, I've gotten *only* very basic Gecko codes to work by converting them to BrainSlug modules. This means that while you are locked out of the nice and fancy ASM based codes we are all spoiled by, like XeR's Force Room CC code that will let us force 150cc and forget 100cc even exists. (Ha! 50cc! Now thats a funny joke!) This sucks, but thankfully, we can work around this by turning Leseratte's Engine Class Modifier code, which we *can* get running, into a "100cc has 150cc speeds" codes. Basically, if you didn't know, all modes takes 150cc and multiplies its speed by a static factor to slow you down to create the effect of a smaller engine. 50cc has a multiplier of 0.8, 100c has a multiplier of 0.9, and Battle has a multiplier of 0.7. If we take just the second line of that code (100cc), and enter in a float value of 1.0, 100cc will now be just as fast as 150cc, making them effectively the same thing. If we can't remove 100cc from friend rooms, then we make it identical to 150cc. There is a down side of course: we can't stop the game from picking Mirror Mode either. If everyone has a 5000vr license, this has something like a 5% chance of happening, so hopefully this should be a "good enough" alternative to forcing 150cc.

Everyone's needs will be different, so I won't waste too much time going on about "good enough" alternatives. If there is something you are hoping to use, you should check my BSlug modules attached below, and see if I got something kind of like what you're looking for. Here are some notable mentions however:

    100cc is 150cc (Because I know you skimmed right to this list)
    High Data Rate (This is actually comes built in with the LAN mod, but I didn't know this until I dug through its source!)
    Unlock All (I was able to convert _tZ's code, which does not modify the save file but temporarily gives you everything)
    Friend Room Race Count (I have a 3 and 5 race one already compiled, I can do other numbers on request)
    No Background Music (What, you want to hear Coconut Mall 12 times simultaniously?)
    Force Thunder Cloud Glitch & No Thunder Cloud Speed Gain (put them together, and it basically makes the TC useless, which is about as good as removing it outright)
    And more! Just check out the attached zip


I also included a basic java program that can take a single line 00/02/04 code and turn it into source code for a brainslug module and a bash script to compile it and move the module into a folder with the rest of them, if you don't find the code you wanted in my zip (or if you don't use NTSC-U. Sorry, I just couldn't be bothered to do it all again for JP and PAL). I also included source for all included modules, with a comment in each for a URL link of what code I based it on.



Conclusion: Thanks to all you dedicated modders

Honestly, I already put all my words (too many words!) into the rest of this thread, so I don't have too much more to say. A massive thanks and shout out to all the dedicated modders out there that have done so much to learn and document so much stuff about the Wii and modding it, Mario Kart Wii and how it works, as well as mod the game to hell and back with ASM cheat codes, custom tracks, and just tons of insane work I can't even begin to mention like the LAN Mod this guide is about, and all the tools and info out there to be find and used. What I've done here with converting basic RAM write codes into BrainSlug modules is childs play in comparison to what everyone else has done, and I wouldn't have been able to do any of it if I didn't have all this stuff to use as a foundation. Thank you all so much!


Attached Files
.zip   MKW Gecko Code to BrainSlug Module Conversions.zip (Size: 200.96 KB / Downloads: 17)
Reply
#3
You can hex edit ASM codes onto an WBFS/ISO but it's a pain.

https://mkwii.com/showthread.php?tid=998 old guide that I haven't updated in a long time, so excuse any noobiness
Reply
#4
Local BrainSlug aficionado here; to get Gecko codes working, if you're using the "gecko.mod" module that comes with BrainSlug itself, you can make a module that just runs "memcpy((void*)0x800028B8, GCTArray, sizeof(GCTArray));" upon startup, where GCTArray is a C char[] with the contents of a GCT file.
Reply
#5
(08-31-2021, 11:31 PM)Vega Wrote: You can hex edit ASM codes onto an WBFS/ISO but it's a pain.

https://mkwii.com/showthread.php?tid=998 old guide that I haven't updated in a long time, so excuse any noobiness

I looked at this, and thats all above my head, but that is a solution.

(09-05-2021, 02:59 PM)InvoxiPlayGames Wrote: Local BrainSlug aficionado here; to get Gecko codes working, if you're using the "gecko.mod" module that comes with BrainSlug itself, you can make a module that just runs "memcpy((void*)0x800028B8, GCTArray, sizeof(GCTArray));" upon startup, where GCTArray is a C char[] with the contents of a GCT file.

...but I'm going to have to toy with this. This looks very promising, thanks for dropping me this tid bit!
Reply
#6
(09-05-2021, 02:59 PM)InvoxiPlayGames Wrote: Local BrainSlug aficionado here; to get Gecko codes working, if you're using the "gecko.mod" module that comes with BrainSlug itself, you can make a module that just runs "memcpy((void*)0x800028B8, GCTArray, sizeof(GCTArray));" upon startup, where GCTArray is a C char[] with the contents of a GCT file.

HOLY SHIT THIS WORKS THIS IS AWESOME! Thank you so much!

Now, if there was a way to make this work by loading a GCT off the SD instead of baking it right into the module, then that'd be perfect.
Reply
#7
(09-06-2021, 01:56 PM)Yuri Bacon Wrote: Now, if there was a way to make this work by loading a GCT off the SD instead of baking it right into the module, then that'd be perfect.

This is definitely do-able, albeit codes like "automatically press A on strap screen" won't work - you'd want to make sure libfat, libfat-sd and libsd are loaded, and make a module that hooks OSLink, to load the GCT into the above memory address then call onto the original OSLink.

Something a bit like this: (this is psuedocode for all intents and purposes, this will not compile + run without a bit of tweaking, I wrote this in 30 seconds in Notepad)
Code:
int OSLinkHook(void* addr1, void* addr2) {
    SD_Mount();
    int fd = SD_Open("sd:/codes/RMCP01.gct");
    SD_Read(fd, 0x800028B8);
    SD_Close(fd);
    return OSLink(addr1, addr2);
}

If you need help making a module that does this, reach out to me on Discord - InvoxiPlayGames#0161 - I'll gladly help you out with it there. (or if you want me to do the work for you, I wouldn't mind whipping something up quickly when I get spare time, although there's a lot of fun in learning!)
Reply
#8
(09-06-2021, 11:09 PM)InvoxiPlayGames Wrote:
(09-06-2021, 01:56 PM)Yuri Bacon Wrote: Now, if there was a way to make this work by loading a GCT off the SD instead of baking it right into the module, then that'd be perfect.

This is definitely do-able, albeit codes like "automatically press A on strap screen" won't work - you'd want to make sure libfat, libfat-sd and libsd are loaded, and make a module that hooks OSLink, to load the GCT into the above memory address then call onto the original OSLink.

Something a bit like this: (this is psuedocode for all intents and purposes, this will not compile + run without a bit of tweaking, I wrote this in 30 seconds in Notepad)
Code:
int OSLinkHook(void* addr1, void* addr2) {
    SD_Mount();
    int fd = SD_Open("sd:/codes/RMCP01.gct");
    SD_Read(fd, 0x800028B8);
    SD_Close(fd);
    return OSLink(addr1, addr2);
}

If you need help making a module that does this, reach out to me on Discord - InvoxiPlayGames#0161 - I'll gladly help you out with it there. (or if you want me to do the work for you, I wouldn't mind whipping something up quickly when I get spare time, although there's a lot of fun in learning!)

I figured I'd need those libraries. I can toy with it when I have some time, but I just got other stuff going on this week. If you make it instead that's awesome. Honestly, I'm surprised this wasn't already a thing, seems like a big oversight to me.
Reply
#9
Finally got around to giving Gecko stuff in BrainSlug another shot earlier this week and with the help of InvoxiPlayGames, and I managed to make a proper Gecko codehandler that loads GCTs off a SD card. Much better, much easier too.

I've updated the guide with the module and stuff, and used the reserved post for the old guide because why not. Just wish this forum had a spoiler tag so I could hide the second post away instead of making the page longer for no good reason Tongue

I had an issue I never ended up resolving where my codehandler module can only load up to ~230 lines of code / 1880 bytes of a GCT, and IPG suggested to me that the GCT was too big and I try a different codehandler without USB Gecko support added. I took her suggestion and changed the codehandler for JoshuaMKW's, but I still couldn't load a bigger GCT. I honestly have no clue why, other than maybe BrainSlug loaded something into RAM near there reducing the space available there or something, IDK. If anyone thinks they can tackle that issue source code is provided with it.
Reply
#10
Hey. Nice work on the tutorial!.
I've gotten it to work on vanilla mario kart with cheats. However, to use a custom track distro i've tried loading this cheat (https://mariokartwii.com/showthread.php?tid=1622). Unfortunately, it does not work. Could someone help me with this?
The cheat does work when the game is launched using the regular main.dol instead of brainslug.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)