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 chose the Show Item Early Code for this guide since ASM (C2 type) codes are not as simple as 32-bit (04 type) codes but still easy enough for any beginner to grasp quickly. Basically in 95% of all codes, the C2 and 04 lines are what need to be ported. All other lines remain the same. There are other 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 do CLTR+O your RAM Dump file 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 starting with.

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

Code:
C27AB9D4 00000002
807F0020 907F001C
60000000 00000000


What we want to do is find the RAM Address (offset & column location) where the Code is at. To figure this out simply take out the first 2 digits off the first line (the C2 line) of the code. The other lines in the code are to left . If you did the conversion correctly, you should come up with a RAM address 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, do CTRL+C on your keyboard to copy it.

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 do CTRL+F and a 'Fine' prompt will appear.

[Image: findwindow.png]

For the "Search for" field, paste in what you just copied. Change Datatype to Hex.

[Image: findwindow1ststring.png]

Click OK.

If done correctly, you will be brought to offset 000F441C indiciated 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 used 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 USA 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


Messages In This Thread
How to Port Codes to other Regions - by Vega - 02-23-2018, 06:31 PM
RE: How to Port Codes to other Regions - by Vega - 03-17-2020, 02:50 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)