-
Apprentice
[client] How To Hex A New Client And Create A Diff
:: Overview ::
Well considering I might not be around forever, and we can always use more hexers, I've decided to post everything I know about hexing clients and creating diff files. The way I do it is probably not as complicated as most people would like to think, and it's also the reason I have never really added any new hexes unless someone else posted it first. Keep in mind that you must be able to recognize patterns and be fairly familiar with reading hexidecimal to do this.
This guide will not teach you how to disassemble a program to create new hexes. It will only teach you how to use an existing hex and update it to work in a newer sakexe. If you want to learn how to create new hexes that haven't been used before, try here.
Anyway, let's get started!
:: Requirements ::
You will need the following software to create diff files. Click the title of the software to download it.
Hex Workshop
Although it doesn't have to be this particular hex editor, you will need one that has the ability to compare two binary files and show you the differences. Since I use this hex editor myself, I will give examples of using it in the guide.
RO Patcher 3.9.9.5 (by AdamN, updated by glucose)
This program will be able to create most of the difficult patches for your client, such as adding DNS support or Custom Mobs.
DiffGen v0.1 (by naith_kk)
This program is very useful and will save you a lot of time in creating diff files with large patches.
DiffTools Complete v1.1 (by Maldiablo)
This links to Maldiablo's post on the Aegis Support Board which contains links to his Complete Diff Tools package. This package contains both the diff patcher and a diff file creator tool. The only problem I found with the diff creator tool was that if you tried to create a file that had more than one hex affecting the same address, it would overwrite any other hexes that were using that address with the last one added. This might have been fixed in version 1.1, but I don't know for sure as I haven't used his diff creator since I first tried it. (I'm not saying it's bad, but I just never bothered to test it out more I guess...) You can use whichever tools you want to create diff files, but since I don't use that aspect of his software, my guide will only use the diff patcher part. If you want to download only the diff patcher itself, then click here.
:: Getting Started ::
Ok, the first thing I usually do when I'm getting ready to create a new diff file is to create a new "sandbox" to work in. I like to be organized, so I have a folder called "kRO_sakexe" and inside that folder, I have a folder for each client I've done.
For example: D:\Projects\kRO_sakexe\2006-02-06a\
After I have my folders created, I like to copy all of the tools I use (diffgen, diffpatcher, and ropatcher) and the client into that folder to make it easier to fix anything if I need to later on. (I will explain what custom_order.txt is later on.)
:: Creating Patches with RO Patcher ::
Now you're all set to start creating your new diff file. First thing I usually do is get the big patches out of the way first by using RO Patcher 3.9.9.5, which I have in the ropatch folder. Your patcher won't have the mobs area filled in on the right side yet since this is probably your first time using it. Don't worry about that for now and keep reading on.
As you can see, the first thing to do when opening this program is to load the sakexe you are currently working on. After loading the sakexe, you will want to choose one patch to start with. For sake of being organized, let's start with the "Always play openning.bik intro" (1). Once you have check the box for that patch, click the Patch It! button (2) to write the patch to the destination file, which as you can see from above will be "cSakexe.exe" in the same folder.
After applying the patch, check the bottom textbox to make sure the patch succeeded (3). If it says "All Failed" or "Partial Failed" then that means the patch you tried to use doesn't work anymore from RO Patcher and you will have to add it manually later.
If more than one patch is selected, you will see more than one "Success:" line in the text box, and this means that you obviously have multiple patches selected. Go back to the first screenshot of RO Patcher and make sure your patcher looks exactly the same as that one. Some of the options are gray checked by default but that means that is how the exe normally is. If you check or uncheck those ones that are gray checked, it will enable that patch, and you don't want that. You must make sure that you only patch one thing at a time for this to work correctly. The gray checked boxes actually have 3 settings: a regular check, no check, and a gray check which is the default. Make sure those options stay gray checked until you need to patch them later.
If it says "All Succeed" then you are ready to add this patch to your diff file. Go ahead and open DiffGen v0.1 and make sure it looks like the following:
1. Click on the first browse button and select the original unchanged sakexe.exe
2. Click on the second browse button and select the patched csakexe.exe that was made by RO Patcher 3.9.9.5
3. Type in the name for the patch as you would want it to appear in the diff patcher.
Make sure you use underscores _ instead of spaces in the name!
4. Click the Generate button to generate the diff code for this patch.
5. After the code is generated, click the Copy to Clipboard button.
At this point you are going to need to open a text editor. I use windows notepad myself. Once your text editor is open, paste the code into it by right clicking in it and clicking Paste. It should look something like this:
Ok, so you have your first patch! It is a good idea to go ahead and save your new text document as a diff file just incase something happens later. You wouldn't want to lose any of the work you've done so far! Once you've saved your new diff file, go back to RO Patcher 3.9.9.5 and uncheck the option you just made a patch for so that it won't show up in the next patch you do.
After making sure the last patch is now unchecked, you need to follow all these steps again to do the same thing you just did in RO Patcher and DiffGen, over and over, until you've done all of them except 5 of the patches. The 5 patches you do not want to do yet are:
CODE
1) multiple grf support
2) dns support
3) proxy support
4) custom auras
5) custom mobs
This is what I have saved in custom_order.txt which is in the folder we are working from. You must save these options for last because they actually add new code into the exe and have to be added in a different way than the rest of the patches. To make it easier for you later on, you should probably copy that order into your own custom_order.txt. And aside from these 5 patches, you will also need to remember the patches that failed in RO Patcher so you can add them manually later on.
After you have added all your patches to your new diff file, you are ready to add the 5 options in custom_order.txt. It probably doesn't matter what order you actually do them in, but to make it easier for everyone, I will explain it using the order I listed above.
First thing to do is the Use Multiple GRF/GPF patch. You will do this first one just like you did for all the rest of them.
1. As with the rest of the patches, make sure the Use Multiple GRF/GPF patch is the only one selected to patch.
2. Click Patch It!
3. Go to DiffGen and generate the code
4. Copy the code into your diff file
5. Go ahead and save the diff file (you can never be too careful!)
Now for the next option:
1. Go to RO Patcher 3.9.9.5
2. Click the browse button and instead of selecting sakexe.exe, you will now need to select cSakexe.exe then click Open.
This is the exe you just patched with the Multiple GRF Support, and I will explain later why you need to do this.
3. This time, make sure the DNS Support patch is the only one selected to patch.
4. Click Patch It!
5. Go to DiffGen
6. Click the first browse button (on top) and select cSakexe.exe then click Open.
7. Click the second browse button (on bottom) and select ccSakexe.exe then click Open.
This is the new exe you generated in RO Patcher by patching cSakexe.exe
8. Generate and copy the new code into your diff file
9. Make sure the number of lines in the DNS patch is not the same number of lines as the Multiple GRF patch.
If it is, then you probably forgot to select the new files in DiffGen and are still generating the Multiple GRF patch.
10. Save the diff file
Now repeat this process for the next patch:
1. Go to RO Patcher 3.9.9.5
2. Click the browse button and select the file with the most amount of 'c's in front (which is ccSakexe.exe in this case) then click Open.
3. Make sure the Proxy Support patch is the only one selected to patch.
4. Click Patch It!
5. Go to DiffGen
6. Click the first browse button (on top) and select ccSakexe.exe then click Open.
7. Click the second browse button (on bottom) and select cccSakexe.exe then click Open.
8. Generate and copy the new code into your diff file
9. Make sure the number of lines in the Proxy patch is not the same number of lines as the DNS patch.
If it is, then you probably forgot to select the new files in DiffGen and are still generating the DNS patch.
10. Save the diff file
Do these same steps for the Custom Aura Sprites patch, using cccSakexe.exe in RO Patcher, and then using cccSakexe.exe in the first box and ccccSakexe.exe in the second box of DiffGen.
After adding your Custom Aura sprites to the diff file, go ahead an fill in the Custom Monster/NPC(s) as shown in the RO Patcher screenshots above. When you're done filling that in, follow the same steps you have been doing so far, just adding another 'c' before the sakexe as normal. This time, when you generate the code in DiffGen, you should call the patch "[ADD]_Custom_Mob_". This will make them easier to break apart in the next step.
Once you have your Custom Monsters generated and saved in your diff file, you will have to break them apart in the code since you added all of them in the same patch. Adding all of them at the same time is a lot easier than adding them all separately, and it's not really that hard to separate them once you have the code. The code for the custom monsters should look something like this:
CODE
byte_[ADD]_Custom_Mob_:207247:176:111
byte_[ADD]_Custom_Mob_:207248:171:71
byte_[ADD]_Custom_Mob_:207249:107:90
byte_[ADD]_Custom_Mob_:207757:116:31
byte_[ADD]_Custom_Mob_:207758:162:45
byte_[ADD]_Custom_Mob_:207759:107:103
byte_[ADD]_Custom_Mob_:207769:108:45
byte_[ADD]_Custom_Mob_:20776A:162:45
byte_[ADD]_Custom_Mob_:20776B:107:103
byte_[ADD]_Custom_Mob_:20777B:100:57
byte_[ADD]_Custom_Mob_:20777C:162:45
byte_[ADD]_Custom_Mob_:20777D:107:103
byte_[ADD]_Custom_Mob_:208339:88:69
byte_[ADD]_Custom_Mob_:20833A:156:45
byte_[ADD]_Custom_Mob_:20833B:107:103
byte_[ADD]_Custom_Mob_:20836F:36:120
byte_[ADD]_Custom_Mob_:208370:156:124
byte_[ADD]_Custom_Mob_:208371:107:106
byte_[ADD]_Custom_Mob_:208957:164:81
byte_[ADD]_Custom_Mob_:208958:154:45
byte_[ADD]_Custom_Mob_:208959:107:103
byte_[ADD]_Custom_Mob_:2089B1:88:91
byte_[ADD]_Custom_Mob_:2089B2:154:45
byte_[ADD]_Custom_Mob_:2089B3:107:103
byte_[ADD]_Custom_Mob_:272D1F:0:72
byte_[ADD]_Custom_Mob_:272D20:0:79
byte_[ADD]_Custom_Mob_:272D21:0:76
byte_[ADD]_Custom_Mob_:272D22:0:76
byte_[ADD]_Custom_Mob_:272D23:0:79
byte_[ADD]_Custom_Mob_:272D24:0:87
byte_[ADD]_Custom_Mob_:272D25:0:95
byte_[ADD]_Custom_Mob_:272D26:0:80
byte_[ADD]_Custom_Mob_:272D27:0:79
byte_[ADD]_Custom_Mob_:272D28:0:82
byte_[ADD]_Custom_Mob_:272D29:0:73
byte_[ADD]_Custom_Mob_:272D2A:0:78
byte_[ADD]_Custom_Mob_:272D2B:0:71
byte_[ADD]_Custom_Mob_:272D2D:0:65
<and it continues on>
Now at first glance, you can tell where the existing mobs are being replaced and where the new names start. The part after "byte_<name>" is the hexidecimal address in the exe where the data is being replaced and looks like "207248". After that is the decimal value of the original byte to be replaced, and the last number on the line is the decimal value that will be replacing the original value. If the original value is "0" that means we are writing new data into a null space. We are not actually adding new space to the exe file, but we are writing new data into a space that is already empty in the file. And in this case, the new data is the new sprite names of the custom monsters.
So the first thing you want to do is separate the new address pointers from the new monster names, like so:
CODE
........
byte_[ADD]_Custom_Mob_:20836F:36:120
byte_[ADD]_Custom_Mob_:208370:156:124
byte_[ADD]_Custom_Mob_:208371:107:106
byte_[ADD]_Custom_Mob_:208957:164:81
byte_[ADD]_Custom_Mob_:208958:154:45
byte_[ADD]_Custom_Mob_:208959:107:103
byte_[ADD]_Custom_Mob_:2089B1:88:91
byte_[ADD]_Custom_Mob_:2089B2:154:45
byte_[ADD]_Custom_Mob_:2089B3:107:103
byte_[ADD]_Custom_Mob_:272D1F:0:72
byte_[ADD]_Custom_Mob_:272D20:0:79
byte_[ADD]_Custom_Mob_:272D21:0:76
byte_[ADD]_Custom_Mob_:272D22:0:76
byte_[ADD]_Custom_Mob_:272D23:0:79
byte_[ADD]_Custom_Mob_:272D24:0:87
byte_[ADD]_Custom_Mob_:272D25:0:95
..........
Once you've separated the replaced data from the new data, you will begin to break up the new address pointers, which happen to be in groups of 3 lines most of the time. Like so:
CODE
byte_[ADD]_Custom_Mob_:207247:176:111
byte_[ADD]_Custom_Mob_:207248:171:71
byte_[ADD]_Custom_Mob_:207249:107:90
byte_[ADD]_Custom_Mob_:207757:116:31
byte_[ADD]_Custom_Mob_:207758:162:45
byte_[ADD]_Custom_Mob_:207759:107:103
byte_[ADD]_Custom_Mob_:207769:108:45
byte_[ADD]_Custom_Mob_:20776A:162:45
byte_[ADD]_Custom_Mob_:20776B:107:103
byte_[ADD]_Custom_Mob_:20777B:100:57
byte_[ADD]_Custom_Mob_:20777C:162:45
byte_[ADD]_Custom_Mob_:20777D:107:103
byte_[ADD]_Custom_Mob_:208339:88:69
byte_[ADD]_Custom_Mob_:20833A:156:45
byte_[ADD]_Custom_Mob_:20833B:107:103
byte_[ADD]_Custom_Mob_:20836F:36:120
byte_[ADD]_Custom_Mob_:208370:156:124
byte_[ADD]_Custom_Mob_:208371:107:106
byte_[ADD]_Custom_Mob_:208957:164:81
byte_[ADD]_Custom_Mob_:208958:154:45
byte_[ADD]_Custom_Mob_:208959:107:103
byte_[ADD]_Custom_Mob_:2089B1:88:91
byte_[ADD]_Custom_Mob_:2089B2:154:45
byte_[ADD]_Custom_Mob_:2089B3:107:103
If you look at the last character in the hexidecimal address, you can easily see where to break them up. For those of you who don't know, hexidecimal is a base16 number, which means it starts at '0' and goes to 'F' before reaching '10'.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12.....
Ok, so after you've separated the new address pointers, you'll want to separate the new sprite names. You will need to do this the same way you separated the first part by looking at the last character of the hexidecimal address. There will be a 1 number gap between names, as shown in this example:
CODE
byte_[ADD]_Custom_Mob_:207247:176:111
byte_[ADD]_Custom_Mob_:272D1F:0:72
byte_[ADD]_Custom_Mob_:272D20:0:79
byte_[ADD]_Custom_Mob_:272D21:0:76
byte_[ADD]_Custom_Mob_:272D22:0:76
byte_[ADD]_Custom_Mob_:272D23:0:79
byte_[ADD]_Custom_Mob_:272D24:0:87
byte_[ADD]_Custom_Mob_:272D25:0:95
byte_[ADD]_Custom_Mob_:272D26:0:80
byte_[ADD]_Custom_Mob_:272D27:0:79
byte_[ADD]_Custom_Mob_:272D28:0:82
byte_[ADD]_Custom_Mob_:272D29:0:73
byte_[ADD]_Custom_Mob_:272D2A:0:78
byte_[ADD]_Custom_Mob_:272D2B:0:71
byte_[ADD]_Custom_Mob_:272D2D:0:65
byte_[ADD]_Custom_Mob_:272D2E:0:68
byte_[ADD]_Custom_Mob_:272D2F:0:65
byte_[ADD]_Custom_Mob_:272D30:0:82
byte_[ADD]_Custom_Mob_:272D31:0:75
byte_[ADD]_Custom_Mob_:272D32:0:80
byte_[ADD]_Custom_Mob_:272D33:0:79
byte_[ADD]_Custom_Mob_:272D34:0:82
byte_[ADD]_Custom_Mob_:272D35:0:73
byte_[ADD]_Custom_Mob_:272D36:0:78
byte_[ADD]_Custom_Mob_:272D37:0:71
byte_[ADD]_Custom_Mob_:272D39:0:70
byte_[ADD]_Custom_Mob_:272D3A:0:73
byte_[ADD]_Custom_Mob_:272D3B:0:82
byte_[ADD]_Custom_Mob_:272D3C:0:69
byte_[ADD]_Custom_Mob_:272D3D:0:95
byte_[ADD]_Custom_Mob_:272D3E:0:80
byte_[ADD]_Custom_Mob_:272D3F:0:79
byte_[ADD]_Custom_Mob_:272D40:0:82
byte_[ADD]_Custom_Mob_:272D41:0:73
byte_[ADD]_Custom_Mob_:272D42:0:78
byte_[ADD]_Custom_Mob_:272D43:0:71
As you can see from these 3 monster names I have split up, the first split goes from 272D2B to 272D2D, skipping 272D2C. You must look for these breaks and separate the lines as shown above.
After you have everything split up, you can start adding the monster names to the patch lines. The monster names start with the lowest monster id and go to the highest. If you added the monsters in the same order I did in my screenshot, then the names will be in the same order here. One thing you need to know is that two of the monsters will not have new names since their names already exist in the exe. These monsters are Scorpion King which uses "sk" as the sprite name and Mastering which uses "mastering" as the sprite name. I'm actually not sure why there is a custom mastering monster when one already exists, but since people requested it, I added it anyway.
Here is an example of adding the monster names:
CODE
byte_[ADD]_Custom_Mob_Scorpion_King:207247:176:111
byte_[ADD]_Custom_Mob_Scorpion_King:207248:171:71
byte_[ADD]_Custom_Mob_Scorpion_King:207249:107:90
byte_[ADD]_Custom_Mob_Hollow_Poring:207757:116:31
byte_[ADD]_Custom_Mob_Hollow_Poring:207758:162:45
byte_[ADD]_Custom_Mob_Hollow_Poring:207759:107:103
byte_[ADD]_Custom_Mob_Dark_Poring:207769:108:45
byte_[ADD]_Custom_Mob_Dark_Poring:20776A:162:45
byte_[ADD]_Custom_Mob_Dark_Poring:20776B:107:103
byte_[ADD]_Custom_Mob_Fire_Poring:20777B:100:57
byte_[ADD]_Custom_Mob_Fire_Poring:20777C:162:45
byte_[ADD]_Custom_Mob_Fire_Poring:20777D:107:103
byte_[ADD]_Custom_Mob_Pumpkinring:208339:88:69
byte_[ADD]_Custom_Mob_Pumpkinring:20833A:156:45
byte_[ADD]_Custom_Mob_Pumpkinring:20833B:107:103
byte_[ADD]_Custom_Mob_Mastering:20836F:36:120
byte_[ADD]_Custom_Mob_Mastering:208370:156:124
byte_[ADD]_Custom_Mob_Mastering:208371:107:106
byte_[ADD]_Custom_Mob_Ayame_Man:208957:164:81
byte_[ADD]_Custom_Mob_Ayame_Man:208958:154:45
byte_[ADD]_Custom_Mob_Ayame_Man:208959:107:103
byte_[ADD]_Custom_Mob_Giant_Baphomet:2089B1:88:91
byte_[ADD]_Custom_Mob_Giant_Baphomet:2089B2:154:45
byte_[ADD]_Custom_Mob_Giant_Baphomet:2089B3:107:103
byte_[ADD]_Custom_Mob_Hollow_Poring:272D1F:0:72
byte_[ADD]_Custom_Mob_Hollow_Poring:272D20:0:79
byte_[ADD]_Custom_Mob_Hollow_Poring:272D21:0:76
byte_[ADD]_Custom_Mob_Hollow_Poring:272D22:0:76
byte_[ADD]_Custom_Mob_Hollow_Poring:272D23:0:79
byte_[ADD]_Custom_Mob_Hollow_Poring:272D24:0:87
byte_[ADD]_Custom_Mob_Hollow_Poring:272D25:0:95
byte_[ADD]_Custom_Mob_Hollow_Poring:272D26:0:80
byte_[ADD]_Custom_Mob_Hollow_Poring:272D27:0:79
byte_[ADD]_Custom_Mob_Hollow_Poring:272D28:0:82
byte_[ADD]_Custom_Mob_Hollow_Poring:272D29:0:73
byte_[ADD]_Custom_Mob_Hollow_Poring:272D2A:0:78
byte_[ADD]_Custom_Mob_Hollow_Poring:272D2B:0:71
byte_[ADD]_Custom_Mob_Dark_Poring:272D2D:0:65
byte_[ADD]_Custom_Mob_Dark_Poring:272D2E:0:68
byte_[ADD]_Custom_Mob_Dark_Poring:272D2F:0:65
byte_[ADD]_Custom_Mob_Dark_Poring:272D30:0:82
byte_[ADD]_Custom_Mob_Dark_Poring:272D31:0:75
byte_[ADD]_Custom_Mob_Dark_Poring:272D32:0:80
byte_[ADD]_Custom_Mob_Dark_Poring:272D33:0:79
byte_[ADD]_Custom_Mob_Dark_Poring:272D34:0:82
byte_[ADD]_Custom_Mob_Dark_Poring:272D35:0:73
byte_[ADD]_Custom_Mob_Dark_Poring:272D36:0:78
byte_[ADD]_Custom_Mob_Dark_Poring:272D37:0:71
byte_[ADD]_Custom_Mob_Fire_Poring:272D39:0:70
byte_[ADD]_Custom_Mob_Fire_Poring:272D3A:0:73
byte_[ADD]_Custom_Mob_Fire_Poring:272D3B:0:82
byte_[ADD]_Custom_Mob_Fire_Poring:272D3C:0:69
byte_[ADD]_Custom_Mob_Fire_Poring:272D3D:0:95
byte_[ADD]_Custom_Mob_Fire_Poring:272D3E:0:80
byte_[ADD]_Custom_Mob_Fire_Poring:272D3F:0:79
byte_[ADD]_Custom_Mob_Fire_Poring:272D40:0:82
byte_[ADD]_Custom_Mob_Fire_Poring:272D41:0:73
byte_[ADD]_Custom_Mob_Fire_Poring:272D42:0:78
byte_[ADD]_Custom_Mob_Fire_Poring:272D43:0:71
byte_[ADD]_Custom_Mob_Pumpkinring:272D45:0:80
byte_[ADD]_Custom_Mob_Pumpkinring:272D46:0:85
byte_[ADD]_Custom_Mob_Pumpkinring:272D47:0:77
byte_[ADD]_Custom_Mob_Pumpkinring:272D48:0:80
byte_[ADD]_Custom_Mob_Pumpkinring:272D49:0:75
byte_[ADD]_Custom_Mob_Pumpkinring:272D4A:0:73
byte_[ADD]_Custom_Mob_Pumpkinring:272D4B:0:78
byte_[ADD]_Custom_Mob_Pumpkinring:272D4C:0:82
byte_[ADD]_Custom_Mob_Pumpkinring:272D4D:0:73
byte_[ADD]_Custom_Mob_Pumpkinring:272D4E:0:78
byte_[ADD]_Custom_Mob_Pumpkinring:272D4F:0:71
byte_[ADD]_Custom_Mob_Ayame_Man:272D51:0:65
byte_[ADD]_Custom_Mob_Ayame_Man:272D52:0:89
byte_[ADD]_Custom_Mob_Ayame_Man:272D53:0:65
byte_[ADD]_Custom_Mob_Ayame_Man:272D54:0:77
byte_[ADD]_Custom_Mob_Ayame_Man:272D55:0:69
byte_[ADD]_Custom_Mob_Ayame_Man:272D56:0:95
byte_[ADD]_Custom_Mob_Ayame_Man:272D57:0:77
byte_[ADD]_Custom_Mob_Ayame_Man:272D58:0:65
byte_[ADD]_Custom_Mob_Ayame_Man:272D59:0:78
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D5B:0:71
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D5C:0:73
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D5D:0:65
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D5E:0:78
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D5F:0:84
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D60:0:95
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D61:0:66
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D62:0:65
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D63:0:80
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D64:0:72
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D65:0:79
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D66:0:77
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D67:0:69
byte_[ADD]_Custom_Mob_Giant_Baphomet:272D68:0:84
Hopefully you can see the pattern here, and as I explained above, the Scorpion king and Mastering do not have new sprite names, so they do not get copied to the bottom half.
Once you have completed the custom monster names, you are done with RO Patcher and DiffGen, so you can go ahead and close both of those programs. Now would be a good time to go and download the latest diff file available or if you already have the latest diff file, go ahead and copy it into your working folder.
:: Creating Patches with Hex Workshop ::
Now it begins to become time consuming. With your own diff file open, you will need to open the latest diff file you just copied into your folder. It's probably easiest to open them side-by-side so you can copy the existing patches in the latest diff to your new diff so you can change them from there. You can also delete all those extra sakexes in your folder now (the ones that start with c's).
You will now need the sakexe that goes with the latest diff file you copied earlier. If you're doing things like I do, I've already made a folder with the date of the latest diff in my sandbox folder.
Like this: D:\Projects\kRO_sakexe\2006-01-09a
And in this folder, I have the diff file, sakexe, and diff patcher for that version.
Alright, so the first thing you're going to want to do is go to the folder with the previous diff files and open Maldiablo's Diff Patcher. Once open, go ahead and load the last diff, which is the 2006-01-09a diff in this example, as well as the 2006-01-09a sakexe. It is very important that you are opening the latest diff with the latest sakexe. Mixing up diff files with sakexes will mess up your hexes if you try to create patches from the wrong files. Once everything is loaded, move all of the patches to the left side except for the required patch, which is the aura crashfix in this example:
If you have more than one required patch, you will need to make a backup of the diff file then go in and delete the "[Required]" part from the diff options inside the diff file then re-open it in the diff patcher so that you can patch one at a time.
After the Aura Crashfix is the only patch on the right side, click the Write the patch! button. After the patch is written, you will need to open Hex Workshop.
The first thing I normally do when opening Hex Workshop is to open my new sakexe that I'm working on, which is the 2006-02-06a sakexe.exe in this case. Once you've opened that, click the Tools menu and browse to the Compare option, then select Compare Files.... After clicking that, you should see a box like this:
The Source is the original 2006-01-09a sakexe.exe and the Target is 2006-01-09a_Sakexe_v1.exe which was created by the Diff Patcher. Make sure Resynchronizing Compare is selected then click OK. Once the compare is complete, both the original 2006-01-09 and the diff patched exes will open. At this point, you should have 3 total sakexes open in Hex Workshop, the two compared files, and the new sakexe which will be minimized in the bottom corner of the main window. For easy viewing, you should restore the minimized sakexe (just click the minimize button on it). Once you have restored it, press the F2 Key which will tile all 3 of them horizontally with the new sakexe on the top, followed by the original 2006-01-09 in the middle, and the patched 2006-01-09 on the bottom. Like so:
Reduced: 65% of original size [ 973 x 730 ] - Click to view full image
On the screen above, the red arrow is pointing at the differences between the original file and the patched file. If you click on one of the lines there, it will bring you to where the differences are.
Reduced: 65% of original size [ 973 x 730 ] - Click to view full image
Here you can see that the hex code "7529" in the original file was replaced with the hex code "9090" in the patched file. So now you have to find the same code location in the new file you're making a diff for. Start by selecting the part you want to find in the original file first. I always like to select more than the hex itself so that I can be sure I'm finding the correct place. A lot of the time, the same code you are hexing can be found in several places in the exe, and if you hex the wrong one, your exe will not work.
Reduced: 66% of original size [ 961 x 410 ] - Click to view full image
When you select the code, make sure you select the hex code on the left side, and not the ascii representation of it on the right side. You will be searching for the hex codes, not the text. So, having selected and copied the Hex code on the left side, make sure the top file in the window is now active (the new exe) and then open the Find window by either pressing the Control key and F at the same time, or by going to the Edit menu and selecting Find. You should then see a screen like this:
Make sure the Type box is set to "Hex Values" and then paste what you copied into the Value box, as shown above, then click OK.
The program will then select the hex code you were looking for in the new client if it was found. If you did it just like I did here, you should have these results:
Reduced: 67% of original size [ 954 x 411 ] - Click to view full image
At this point, you should press the F3 key to repeat the same search again, just to make sure it doesn't find any more spots with the same hex code. If it does find another matching code in another place, you will need to go back to the original sakexe and select more code around you part you are looking for, then go back to the new sakexe and search with the new hex code you just copied.
Keep in mind that not all hexes are going to be exactly the same from an old exe to a new exe. I'll try to explain more about this later on.
So now that you have your hex code found in the new exe, you need to get the starting address of the code to change, so you can update your diff file. You will need to click the very first character to be changed in the new file then look at the address in the lower left box, like this:
Reduced: 65% of original size [ 973 x 730 ] - Click to view full image
As you can see, I selected the first character of the data to change at arrow 1, and now you can see the starting address at arrow 2. We are only interested in the hexidecimal address here, not the decimal address. The hexidecimal address is the one in [brackets], and in this case, it is 1436EC. You do not need the extra zeros at the beginning of the address if there are any.
So now that you have the address, you will copy the Aura Crashfix DIFF code from the 2006-01-09a diff file to your new diff file. After copying the diff code, you will need to change the addresses in it.
Here is the 2006-01-09a diff for Aura CrashFix:
CODE
byte_[Required]_Aura_Crashfix:14356C:117:144
byte_[Required]_Aura_Crashfix:14356D:41:144
byte_[Required]_Aura_Crashfix:1A0A95:124:144
byte_[Required]_Aura_Crashfix:1A0A96:7:144
Look carefully at the addresses on those 4 lines. The first 2 lines addresses are right next to eachother, and the second two lines addresses are also right next to eachother. By looking back at Hex Workshop, you can see that there are two replacements in that bottom right box. Since we only found the first one, we will only be changing the address on those first two lines, each line being one character in the exe.
Here is where being good at math is important tongue.gif
You will need to change the old starting address 14356C to our new starting address 1436EC, and then change the address on the second line from 14356D to 1436ED In short:
14356C -> 1436EC
14356D -> 1436ED
Now assuming you understand how that works, and what we just did, you should be able to do the same thing on the second replacement for this patch. This time you should end up with:
1A0A95 -> 1A0F45
1A0A96 -> 1A0F46
Now both of these having the same last character is pretty common since things don't move around a lot between each exe, but sometimes they do, and the last number will not be the same. If that happens, you just need to check the diff code and calculate the numbers to add to your starting address to get to where you need to be.
As I said before, you should only do one patch at a time in the diff patcher, so now that we are done with the Aura Crashfix, we will need to delete it from the old diff file. You can also delete any other patches that you already have in your new diff file, since you probably did a lot of them in RO Patcher already. Once you've removed what you want, go ahead and save the file then reload the diff patcher so that the patches are no longer there. With the required patch gone, you can now remove all of the patches from the right side so that it's empty. Once you've done this, you can then start going through each of the patches one at a time and doing the same steps you did above for the Aura Crashfix.
There are going to be a few tricky patches to make. Not all hex codes stay the same from exe to exe, so if you can't find an exact match to the code you're looking for, try starting outside of the hex code and select only a little bit inside of it to see if you can get a match that way. If that works, you will be able to find the new starting address of course, but you will also need to update the original values in the diff code as well.
If you look in the screenshot of Hex Workshop above, you will see an area below the hexidecimal address location that lists a bunch of data types. When you click on a character in the hex code window above, it will show the value of the byte you are currently on in that window on the bottom left. You will always want the Unsigned Byte value for the character, nothing else. In the example above, the Unsigned byte Value is 117 and if you look at the code I posted below it, you can see where the 117 fits into the diff code.
So from here on out, you will need to have great skill in observing patterns and a lot of patience.
:: Skipping the license screen ::
This one took me a bit to figure out initially, but luckily I did and now I can tell you how to do it as well.
Since you already know how to patch the old sakexe and compare the old original and patched versions, I will just show you the hard part about figuring out the addresses and bytes to replace for this particular patch.
Reduced: 65% of original size [ 973 x 730 ] - Click to view full image
The key here is looking for the pattern that appears just before all those X's. As you can see, it contains something like "_^[..]". I selected quite a few characters before and including that pattern then searched the new sakexe. I found a total of 4 matches of that hex code in the exe, but only one of them had all those X's after it. Those X's and the code around them are actually involved in the starting process of the client, and by skipping the first 2, you skip the license screen.
Let's take a look at the middle sakexe in Hex Workshop. The red area shows what was changed, but in reality, you will need to look beyond that area to finish this patch.
CODE
28DC 5800 CBDC 5800 0BDE 5800
Notice the pattern? The 5800's are the seperators, and the codes to the left are what we are interested in. The code to the left of the third 5800 is the address we want to be at so that the license screen doesn't show up. So what you need to do is make a diff patch that does this:
CODE
0BDE 5800 0BDE 5800 0BDE 5800
See what happened? We changed the first two sets of code to match the third one. You can take a look at some of the diff files I've released to see how that turns out inside the diff file. The example used here was from the 2006-01-09 sakexe.
:: GRF adata/bdata Support ::
This one is also very hard to update.
The pattern in this one is very hard to see unless you have your screen resolution set to 1280x1024 and have Hex Workshop maximized. The reason for this is because the pattern is only easy to see when you have a column span that is 36 characters wide on the right side of the hex code.
(Click on the image to enlarge it)
If you look at the middle exe, at where I've highlighted, you can notice the pattern. That pattern of characters always appears before the first replacement for the adata/bdata patch. The characters are not always the same, but they are in the same arrangement. All you need to do is look for that pattern, and maybe even search for some of the characters in the pattern, to find the correct area for your adata/bdata patch. The reason you would need to look for this pattern is because the adata/bdata patch itself changes from exe to exe, so you can't do an exact search for the hex code in it.
:: Conclusion ::
Well guys, I hope this helps out anyone who wants to become a diff hexer. I'm not sure how much longer I'll be around to make diff releases, so I hope to see some of you releasing some new diffs before I go.
Good luck and Have Fun!
Last edited by tomak; 18-07-07 at 08:35 AM.
Reason: added some pic...
-