How to Port Codes to other Regions
#1
How to Port Codes to other Regions

This guide will teach you how to manually port codes to other regions. There are programs out there (such as Bean's auto porter) that can port codes for you. But at some point, those programs will not work on a particular code, and you will need to manually port.

Requirements:
- Hex Editor**
- RAM Dumps*** (you will need at least the RAM Dump of the region you are porting from and the region you are porting to)

**I recommend HxD. HxD is used in this guide. You can find it very easily on a google search for free download. If you are a Linux User, you will need Wine emulation to run HxD.

***Regarding RAM Dumps: If you have Dolphin Emulator, look at this thread HERE. If not, run this code HERE on your Wii.





Chapter 1: Introduction

We will start off with the NTSC-U Show Item Early Code. We want to port the code to PAL.

I have chosen the Show Item Early Code for this guide since ASM (C2 type) codes are not as simple as 32-bit (04 type) codes, but are still easy enough for any beginner to quickly grasp. Basically in 95% of all C2 and 04 codes, the very first line (the C2XXXXXX/04XXXXXX value) is what needs to be ported. All other lines within the code will remain the same. Of course, there are some codes where this isn't the case, but this guide is meant for beginners.



Chapter 2: Finding Location of Code's Address in RAM

Open HxD and press CLTR+O on your keyboard to open up the menu to search your computer for your NTSC-U RAM Dump. We always start off with the RAM Dump version that matches the region of code we are porting from.

So our NTSC-U Show Item Early code is...

Code:
C27AB9D4 00000002
807F0020 907F001C
60000000 00000000


What we want to do is find the Code's RAM Address (offset & column location) within the RAM Dump. To figure this out, simply remove the first 2 digits off the first line (the C2 line) of the code. Don't worry about any other lines in the code. If you did the conversion correctly, you should come up with a value of...

7AB9D4

On you hex editor, press CTRL+G. a 'Goto' prompt will appear to enter in an offset to search for.

[Image: goto.png]

Paste in that 7AB9D4 number and be sure number/data type is in Hexadecimal (Hex).

[Image: gotofilled.png]

Click OK and HXD will navigate you to row 007AB9D0 under column 4. The last digit of a code's RAM address is the column number value on the hex editor. The following picture contains a red arrow pointing to where your mouse cursor will now be at, the green arrow points to the spot in HxD where you can always see your Offset location for the current file you are in.

[Image: atoffset.png]




Chapter 3: String Searching

What you need to do is highlight the first 4 bytes (8 digits) of code beginning where your cursor was navigated to. If done correctly, you should have highlighted the following hex string...

90 7F 00 1C

[Image: firststringfilled.png]

Once you have that higlighted, press CTRL+C on your keyboard to copy the hex string.

Now open up your PAL RAM dump file, HxD will add it as a new tab. You should automatically be in the PAL Ram dump now, if not click on the tab to view it.

[Image: palopened.png]

Now press CTRL+F and a 'Fine' prompt will appear.

[Image: findwindow.png]

For the "Search for" field, paste in what you have just copied. Change Datatype from Text-String to Hex.

[Image: findwindow1ststring.png]

Click OK.

If done correctly, you will be brought to offset 000F441C indicated by the green arrow.

[Image: 1ststringfound.png]

Right off the bat, I will you that this is the wrong address. When comparing the address of one region to another, if the margin of difference is huge, then it's a high chance that you ported to the wrong address. If we were to use the offset value of F441C and convert that, the PAL code's C2 line would be C20F441C, which is a Huge difference compared to the NTSC-U Code's Address, which means it's obviously wrong. 

There are many instances where a 4 byte string of hex is repeated in MKWii RAM. Sometimes, you only need to use a 4 byte string to find your address, other times you may need to copy something as long as 32 bytes. It all depends on the code.

Lets go back to our NTSC-U RAM Dump file. This time highlight the first 12 bytes (24 digits of code). You should have a hex string of...

90 7F 00 1C 88 1F 00 2D 2C 00 00 00

[Image: highlight2ndstring.png]

Copy that string using CTRL+C. Go back to PAL RAM Dump file. Hit CTRL+F to bring up the 'Find' window. Paste in the new 12 byte string. However, we want to change search direction from "Forward" to "All".

[Image: 2ndstringfind.png]

Since we searched in PAL RAM earlier, we are no longer at the very beginning of the PAL RAM Dump file. So we need the "All" search direction to tell HxD to search both ways from out current spot in PAL RAM. Click OK.

You will be navigated to the offset value of 7BA434 indicated by the green arrow of the above picture.

[Image: 2ndstringfound.png]

If we convert the offset value to a usable C2 line, we get C27BA434. As you can see, this is slightly different than the NTSC-U address. Chances are, this address is the correct one. What you want to also do is compare the surrounding random numbers of both RAM Dumps, they should be very identical (doesn't have to be exactly the same). If it is, there's a very good chance the address is correct. So now you have the C2 line for PAL, complete the rest of the code....

PAL Show Item Early~
Code:
C27BA434 00000002
807F0020 907F001C
60000000 00000000




Chapter 4: Testing; Conclusion

After porting any code, always be sure to test it. If your tests fail, go back to the hex editor and try to re-port the code.
Reply
#2
Thank you very much for tihs Tutorial. Now I have a Question.

I have ported many codes of this Forum with port files from the Internet. But now I have seen that my korean dump file contains very small content. Some non-standard ports are not possible yet. Is there any other way to get RAM dumps besides dumping with the RAM viewer?

Thank you already for the Answer.
Reply
#3
Dumping with the RAM viewer as in Aldelaro's program? You must mean using Dolphin's memory viewer.

https://mkwii.com/showthread.php?tid=1141

You want your RAM Dumps to be as similar as possible. The Korean game is just different than all other regions by default so having differences per Dump should be kept to a minimum.

Delete all your Data Saves, Make new ones. Make all 4 new licenses for every data save. Use a diff mii for each license. And make sure each mii for its license slot is the same for each data save.

Make a RAM dump of each region while being idle on online after connecting for the first time on said data save. For the online connect use the same particular license each time.

And also, only have the ALTWFC code (no ssl + domain changer) applied for each region when online. No extra codes or diff codes per game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)