Ps2Dis: Extending and relocating a string

Programs and files needed:

Any Hex editor. In this example I am using HxD though.
HACK_00.ELF (This is found on your .hack.//Fragment disk.) (This is also the online ELF for the game, the single player version is HACK_01.ELF


Socom 2 Imposter Maker by Dark Killer ( I used this to convert text to hexadecimal. It’s not needed but it makes it quicker.)


When translating this game from Japanese to English you tend to run into space constraints when dealing with how many letters you can cram in a memory location.  The problem came up where a translation wasn’t correct and since there just wasn’t room to actually have the correct text it instead was made to be something else. As a quick example the Twinblade spell “Tiger Claws” is currently just “Claws”.

A way to fix this issue

In the game .hack//fragment strings are loaded in by pointers.
For this example I am going to show how we can extend a string past the limit it currently has.
Currently I have a level 15 Blademaster that knows the spell Vak Slash and I want to call it something else, something longer.

So we open up PS2Dis and take the HACK_00.ELF and drag it over to PS2Dis. Press Control G and type the following “Vak Slash”, you should see something like this:
ps2Dis Label List

Double click on “Vak Slash” and you will be brought to the place in the file where it exists.
ps21Dis ValSlash Label

As you can see, there isn’t much room after the “h” to really add anything more to this string. So what we need to do now is find the pointer that checks this address “0060a940” and loads this string.

Press Control F and type in the following: 40a96000. Check as hex string as shown below:
ps2Dis Find Hex String

Click ok and you will be brought to the address “004cac80”. This is the pointer. If you press W while on this line and then enter twice you will see that it shows “Vak Slash”. Take note of the data of this address since we will need this later when we go to hex edit our changes in. The pattern is 40a96000.
ps2Dis Vak Slash Pointer

Take note of the pointer address “004cac80” because we will need to come back here later.

So now we need to find an area in this file that is empty. The best way to do this is to Press Control F again and enter a bunch of zeros. So something like 000000000000000000000000000000000000000000000000000000000000000000000000 should be just fine. Once you press enter you should end up at the address “004cfca0”. If you look a few addresses below it you will see that there is a decent amount of space to work with so this is where we will be adding in our new text.
ps2Dis Empty Memory

Take note however of the data in address “004cfc9c” because this will be important when it comes to hex editing this file later. I will give you the hex pattern here so you won’t have to worry about it later. The pattern is b0437000.

Creating our Text

To create our new string I am going to use the program S2 Imposter maker that I mentioned above. Once you open the program you will be presented with this:
socom2 Imposter Maker Main Screen

You can ignore everything on here in terms of options. The only thing we care about is the Text box. The address in the second textbox can also be ignored since thats for a different game, all we care about is the data that this generates. So I want to name my spell to Smashy McSmash. I do understand that this string really isn’t that long and probably could fit into the original area in the file but for the sake of keeping this rather simple this will do just fine. I type it into the textbox and the second textbox will update in real time. So you should see something like:
socom2 Imposter Maker Filled In Text

All we care about is the data however what we do not need is the data 20202020. Again this is part of the code that this was originally generating and does not apply to what we are doing. So you can skip the first line and move onto the second.

In PS2Dis copy and paste the data from S2 Imposter Maker in the the lines starting at address “004cfca4”. You should end up with something like this:
ps2Dis Updated Text

You will know if you did this right because in the grey text area in PS2Dis you will see your text:
ps2Dis Grey Window

While this next step is not super important, it could help when it comes to understanding the change we are about to make. So the addresses you just changed, if you press B on every line you will end up turning them in “byte”. Once you do that go back to “004cfca4” and press enter twice. This will create a label. See below:
ps2Dis Byte View

Now that this is done we need to go back to our pointer and have it point to the address “004cfca4”. The pointer should now look like this:
ps2Dis Vak Slash Pointer Update


You will notice that it still says “Vak Slash”. However on the far right it will actually show what it’s pointing to. The reason it say’s “Vak Slash” Still is because when we hit enter on it twice it just created a label. You can remove it by hitting enter on it and deleting the text in the label but it’s really not that important. So as far as this is concerned we are done with our setup and we can now start writing this data to the file. Do not close PS2Dis since we will be needing this still to know what data to add into the HACK_00.ELF file.

Modifying the ELF File

Open HxD and drag the HACK_00.ELF into it. The first thing you may notice is that the addresses on PS2Dis and HxD don’t quite match up. That’s fine, its not important.

Now we want to write our changes and the first place to start is with the pointer. In HxD press Control F and enter the the hex pattern 40a96000 and select Hex-Values for DataType.
You will be taken to the place in the file where this exists and this would be our pointer. We need to change the 4 bytes to our new address. In PS2Dis on the make sure the pointer line is highlighted and in the grey textbox take the 4 bytes A4 FC 4C 00 and replace 40 A9 60 00 in HxD. When you make a change it will be marked in red in HxD.
hxd Opened Elf

Now we want to edit in our new text into HACK_00.ELF.  In PS2dis make sure your pointer address is selected and press spacebar. The line will now change from the dark blue to a grey. Press the right arrow key on your keyboard and it will take you to your new text that you entered in prior. Now since this area in the original file is nothing but zeros doing a Hex Value search for this would be a pain.

This is why I said to take note of the data in address “004cfc9c” since we are going to use that as what we search for in HxD. In HxD press Control F and enter the hex pattern b0437000 and press ok. You will be brought to a new location in the file. Now need to skip the next 4 bytes since in pcsx2 we did that as well. Just as we did with the pointer we are going to enter our text. In PS2dis go to the first line in your new text and in the grey text above take that and just enter it into HxD. You should end up with this:
hxd Updated Code

Once this is done you can save you changes in HxD. Now if you make an ISO of your game and copy the edited HACK_00.ELF you made and launch the game (granted you have the same spell) you will see your change in game.

This entry was posted in .hack//Fragment, PS2/PSP. Bookmark the permalink.