SME-CODE
#1
HUGE credits to Wiimm and Leseratte! Without them this would not have been possible.

"So what is this?" you may ask, well, this is a special code I developed to go alongside the code handler, patched into the main.dol/start.dol.

How this works, is when the game boots, there are some pointers to the FST section of the game's memory, with only one of them being used by the game as a limiter and also being static. How the game uses this pointer, is as a point in which the memory should no longer be used dynamically, meaning everything beyond the value of this pointer (but before the original FST section) is never touched, and can be used for mods.

SME-CODE (the "code loading code loading loading codes" as I like to call it), takes this pointer, subtracts from it, stores it. This means the game now leaves a larger area alone than normal. SME-CODE also is designed to hold a gct within it, so when it recalculates the pointer, it takes the gct and moves it to the very start of the untouched area. When it does this it also rewrites the code handler to look in this area for the codes. Lastly it dynamically finds and hooks the code handler to the VI Hook commonly used for games, depending on if the game is a Gamecube or Wii game (Since they differ slightly).

So, with all of that said, what kind of space can be allocated for codes using this? In testing, I was able to safely reserve up to 0x40000 bytes of space with SME-CODE in melee, with the absolute limit being 0x40BA0 before the game simply couldn't boot.

As for other games, Super Mario Sunshine was able to have over 0x100000 bytes of space, so this shows that games vary in terms of what you can get away with.
Because yes, this is designed to work across ALL games, including Wii games.

Tutorial showcasing the steps of patching a game with SME-CODE (Size of code space set to 0x30000):


Finally, the download link includes two exe files to aid in patching DOL's with this code, although PyiiASMH MUST be used in the process or else it won't compile!


Super Mario Eclipse, what Super Mario Sunshine could've been.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)