Making Mods Tutorial 2 - Using HxD with SVGs

Using HxD With SVGs


Editing or modding savegames can be a bit of a pain with HxD. It does have its benefits and drawbacks, but for most SVG mods, I recommend Codtool.




There are a few rules to editing a savegame with HxD. If you make a mistake, it will probably corrupt your savegame, so make sure to follow them precisely. They are:



  • Each dvar and value is preceeded by three "00" hex value pairs and a hex with the same value as the length of the dvar or value.
  • Only edit in the allotted space


HxD is a great program and it will warn you if you are about to change the file size. You cannot add or delete anything, you can only overwrite. Changing the file size will corrupt the savegame and most files. It will probably take a while to get used to having everything you type overwrite instead of insert. Don't worry about the second rule, I'll explain when we get to it. Same with the third rule.


You will, of course, need a savegame. If you don't know how to get a savegame by this point, you shouldn't be using HxD. I've never edited a savegame completely in HxD, and I don't recommend you do either. Even if you aren't going to mod with Codtool, you should at least open the savegame with it and add a random dvar and value and click "save changes". Codtool will null out the section of the savegame used for dvars and then add a dvar called "codtool" before and after any codes you enter in the advanced tab. This will make it easier to find the editable area in HxD and give us some useful boundaries. If you don't know how to do that with Codtool, then, again, you shouldn't be using HxD.


Assuming you've done the above in Codtool, open up HxD and either drag-and-drop your savegame or open it from the file drop-down menu. You should see something like the following:




Probably seems a bit scary if this is your first time using HxD, but never mind that, you'll get over it. Hit ctrl+F and search for "codtool". If you did what I said above, it should take you to here:




The text portion of the screen makes it look like there are four periods, but it's very important that the first three periods have a hex value of "00" and the fourth character has the same value as the length of the dvar or value. Look at the following picture:




In the text portion, I have highlighted what looks to be the four periods preceeding the dvar "CoDTool". In the hex portion, you can see "00 00 00 07". Each pair of digits in the hex value make one character in the text portion. We have the three "00"s and then we have "07" because "CoDTool" is 7 characters long. Take a look at the next picture:




Again we see three of "00"s and then we see "01". The value that Codtool was given was "0". "0" is only 1 character, so the length of the fourth character is "01". Now let's look at the dvar I added in Codtool, "".




And again, there are the three of "00"s, but this time the fourth character's hex value is "0E". "0E" is the hex equivelent of 14. You might be wondering how you're supposed to know the hex equivalents of numbers, but that's just another reason why HxD is great.




When we highlight something, it tells us the length of it, IN HEX VALUE. There it only shows "E", but you just add a "0" before it and you're fine.


Let's say we want to add a dvar called "tutorial" and we want it's value to be "I'm learning how to mod with HxD". I can't think of a reason why we would every want a dvar like that, but let's just go with it. We'll first put four periods and then the dvar.




Notice how actual periods have a hex value of "2E". DO NOT leave those hex values, the first three must of "00" and the fourth the value of the length of the dvar. We are only using periods here as space holders. Now let's add the value. Again, another four periods




The periods still have the wrong HeX values, so no lets put our cursor in the hex portion and change them.




When "tutorial" is highlighted, HxD tells us that the length is "8", so I changed the fourth hex value to "08" and the other three to "00". Now let's do the value of "tutorial".




HxD says the length is "20", but remember, that's in hex. The length of "I'm learning how to mod with HxD" is actually 32 characters, but we don't need to know that. So again, the first three periods are changed to "00" and then the fourth to the value of the length of the dvar's value.


When you're done adding everything, save the file and then rehash and resign if you haven't already.




That's really all there is to it. Remember though, it will corrupt your file if you change the size or if you don't have the correct hex values.