Hexediting savegame file for Stronghold Crusader HD

As promised, here are my old notes for when I was hexediting Stronghold Crusader HD‘s savegame file.

For Stronghold Crusader HD, the file is ~/Documents/Stronghold\ Crusader\crusader.cfg
To set the Crusader campaign level unlocked, modify byte 0x0343
00000340: 0000 0e00 0000 0200 0000 0e00 0000 0000  ................
                +------ bye 0x343 is 0E which means mission 14 is unlocked.
The mission status bytes start around 0x035A
00000350: 0000 f945 0000 4f00 0000 1100 0000 c700 ...E..O.........

Each mission takes 4 bytes, with the first byte representing how many months it took you to complete.

6D00 0000 = 6D 00 00 00 , so 6D = 109 months or 9.0833 years. A regular mission will have 0000 as the last 2 bytes.
A mission where you used the chicken button to advance without actually playing the mission, will have these exact bytes:
50FB FFFF = 50 FB FF FF, and must be calculated differently. The second two bytes, or FFFF represent that you used the "chicken," but I don't know how the 50FB ends up being exactly 100 years.


Original research

See also

Hexedit stronghold.cfg to easily unlock military campaign missions | Knowledge Base

Compare two files in hexadecimal view

Just a quick and dirty list for myself. When I was looking for hexeditors with a file-compare view, these came up. All three of these options seem useful in slightly different ways.
vimdiff and :%!xxd
Vimdiff just calls vim with a bunch of preset options.

vimdiff file1 file2

Once inside, you have to convert each file with :%!xxd and then after making any changes, convert back with :%!xxd -r before saving. Slightly clunky, and I’m sure there’s a way to automate all that. But I was only making select changes. And a few keystrokes isn’t so bad.

Hexedit stronghold.cfg to easily unlock military campaign missions

When I installed the Stronghold HD patch to take my CD installation of Stronghold v1.2 up to the latest, version 1.3, I had to rearrange the savegame files as indicated in the helpful documentation (for me, that was file ~/.wine/drive_c/Program Files/FireFly Studios/Stronghold/readme_en.html).

Old savegames and settings

Stronghold HD stores user maps, saves and settings in the Documents\Stronghold folder. If you have upgraded to Stronghold HD from an old version of Stronghold you will need to copy the maps, saves and settings from the Program Files\Firefly Studios\Stronghold folder (default location) to the Documents\Stronghold folder.

Savegames (.sav files)

Old Location: Program Files\Firefly Studios\Stronghold\saves
New Location: Documents\Stronghold\Saves

Maps (custom .map files)

Old Location: Program Files\Firefly Studios\Stronghold\maps
New Location: Documents\Stronghold\maps

Settings (stronghold.cfg)

Old Location: Program Files\Firefly Studios\Stronghold
New Location: Documents\Stronghold

Because I’m using the proper ISO saved from the original game disc, I’ve never needed a no-cd patch.
Anyway, I noticed that my military campaign mission status was not transferred to the new HD installation. I ensured the .sco files were in the new spot (the Saves directory) but it did not unlock the missions. I helpfully had a mission 17 b save that was right at the tail end of that mission, so loading and finishing it got me up to mission 18. However, I didn’t want to have to go through the difficult fixed-force invasion of the Pig’s castle, so I looked for cheat codes for a computer game for the first time in about a decade. Believe it or not, but I couldn’t find any (working) cheats that just declare “success” for a mission. So, I decided to hack the stronghold.cfg.

I’m old-school, so I whipped out vim and :%!xxd and here is the results of my research:

To set the military campaign level unlocked, modify byte 0x147 which is in line:

    00000140: 0000 0055 0000 0013 0000 0021 0000 0000  ...U.......!....
#                               ^
#                               +-- this is hex 0x13 or decimal 19.
This corresponds to being able to play level 19 of the military campaign.

You can use vi with :%!xxd and :%!xxd -r to convert stronghold.cfg to hexedecimal and back.

For Stronghold HD, that is file ~/Documents/Stronghold/stronghold.cfg

Of course you could abuse this, but I was just using it to recover my progress.
castle gate with soldiers garrisoned


My own original research and hacking on the config file.