I’ve gotten alot of request from people on how to add DVARs to a Modern Warfare 3 gamesave. In this tutorial, I will explain how to do it, in detail. This tutorial is assuming that you’ve extracted the file out of your savegame.svg, and you know have it open in a hex editor.
Thanks to CLK for helping map out the save, and Chris for testing stuff
Adding the DVAR
1. First we will need to find out where our DVAR listing is. I have not figured out how to do this by reading it correctly, but you can just search for a DVAR. So search for a common DVAR that should be located in all saves(ex. “hud_missionFaileBd”).
2. Once you find a DVAR, just scroll up until you see the first DVAR. This is not needed, but will make things much simpler. Each DVAR has 2 bytes before the name, so find the location of the name of the first one, and then go back 2 offsets to get to the beggining of the DVAR list. [details=Open Me][/details]
3. This is where we will add our new DVAR.
DVAR Structure:
0x0 = Telling you where the 'B' is located in the name.
0x1 = The length of the string/DVAR.
0x2 - Length of the string = The string/DVAR name.
Byte following the name = B located in the value.
Byte after the previous one = Length of the value.
[details=Example]Saying this, the DVAR with the picture I posted above would have the following values:
B in the name location = 0x10
Length of name = 0x11
DVAR Name = hud_missionFailed (remove the character at 0x10)
B location in the value string = 0x82 (if it is greater than the string length, then remove no characters)
Value length = 0x1
Value = 0
[/details]
So first, obviously find the DVAR you’d like to add. In this case, I guess I will be using the ‘ai_disableSpawn’ DVAR, which disables enemy spawning.
4. Now, we will begin writing the data. Make sure that you have your writing mode on Insert, NOT Overwrite! To do this on HxD, click the text that says ‘Overwrite’ on the bottom toolstrip, so it says ‘Insert’. Now, type the length of your DVAR name, minus one.
So since the length of ‘ai_disableSpawn’ is 0x0F, I will subtract one from that and write 0x0E. Once again, this tells the game where that stupid ‘B’ is stored. In the next byte, write the actual length of the name, so in this case, 0x0F.
So right now, your file should look something like this. (Red = the bytes I added)
View Image
5. We will now add the name of the DVAR. So since we are adding the DVAR, ‘ai_disableSpawn’, and our first byte is 0x0E, we will add a ‘B’ at 0x0E in the name. So our string should be ‘ai_disableSpawBn’. Now, this is the next thing that we will write.
Your data should now look like this:
Open Me
6. Next, we have to write the value of our DVAR. So now, we will not add a ‘B’ into our value, so we will just make it 0x82, which I think simply tells the game that there is no ‘B’ in the value. So now, we will write the length of the value, which will be 1.
Your data should now look like this:
Open Me
Finally, add the the value as a string. We will be making it ‘1’. A value of 1 means true, and a value of 0 means false. This is what our final DVAR inserted should look like:
Open Me
Editing the Sizes
Change your writing mode back to Overwrite now!
-
We will need to do this so the save know’s how many bytes we’ve added to the save. This is not very hard, and will not take long to do. As you can see, we have added 0x15 bytes to our file…
-
First, navigate to offset 0x48A, and get the integer from there. Now advance your position from 0x48E, by the integer you got from 0x48A. Easier: (0x48E + Integer). Now, subtract 4 from that offset.
Current location should look something like this:
Open Me
- Now, read that integer, and add 0x15(the amount of bytes we added) to it, and write it back to its original location.
For me, it is: 0x6E8A + 0x15.
This is what it should look like once you’ve written it back:
Open Me
- Now, go to offset 0x44C, and do the same for the integer at this offset.
Before
After
- We are now finished, besides fixing the files checksum. So first save our modded gamesave, and close your hex editor. Now, download my MW3 Savegame Checksum Fixer, and click Fix Checksum, and select the file. You are now ready to replace your current file in your savegame, rehash and resign, and play!
I know that may have been a bit confusing, so if you have any questions, feel free to ask!