I am trying to load the map part of a saved game into memory (SGAME0.OP2). Saved game files contain some header data not present in map files. I don't really need the info in the saved game header, so it could just be ignored, or loaded into a variable.
Source Material Location: \Outpost2SVN\OllyDbg\InternalData\SavedGame and Map.txt
Outpost 2 .op2 File Format (Saved Games)
----------------------------------------
Offset Size Description
------ ---- -----------
0x0 0x19 "OUTPOST 2.00 SAVED GAME", 0x1A, 0 - String must match exactly or else load error
---------------------------
Note: The following is repeated as an array of 0x74 (116 decimal) elements
0x19+i*0x1E0 4 **TODO** Figure this out
0x1D+i*0x1E0 0x1DC **TODO** Figure this out
---------------------------
Note: From here, the format matches that of .map files
So, I'm using the following:
ifstream file(filename, ios::in | ios::binary);
if (saveFile)
}
file.ignore(0x19);
file.ignore(0x74);
}
file.read((char*)&mapHeader, sizeof(mapHeader));
When I load a map file, the code works fine. When trying to load a save file, it appears the map header data isn't being loaded properly. I'm assuming that my ignore commands are not placing the ifstream at the proper position to start reading the map data, but I'm not very familiar with doing this.
Any help would be appreciated!