Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: Extract info from saved game
Thread: Extract info from saved game
josa8011
josa8011

Tavern Dweller
posted December 17, 2017 11:56 PM

Extract info from saved game

Hi,

I'd like to extract some info from a saved game. The things I need that I can come up with now is:
- Current player
- Current month, week, day

Is there any info on where this data can be found?

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted December 18, 2017 09:22 AM

Here is it:
save editing

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
josa8011
josa8011

Tavern Dweller
posted December 18, 2017 02:58 PM

That seems to be mostly about editing the game in memory. Does the save file follow the same pattern?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Baronus
Baronus


Legendary Hero
posted December 18, 2017 04:04 PM

This is about save editing. I dont know what more you want?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted December 18, 2017 06:39 PM
Edited by Maurice at 18:40, 18 Dec 2017.

The savegames are actually zipped archives. Before you can do anything with them for the purpose of data extraction, you will need to unzip them.

The savegames themselves are binary files, i.e. not human readable by default (unless your hexadecimal translation is superb ), so you'd need to have some sort of parser to make sense of the data located inside.

The savegame will contain information on anything it needs to create the map upon loading:
- Generic data (like day / month / year, but also filesize and the like);
- Map information (objects, etc ...);
- Town details of all towns on the map;
- Hero details of all Heroes (including those in taverns, otherwise invisible to players);
- Hero details if they were carried over from a previous map;

The order in which these entries follow one another are set in stone. You can readily read names from Heroes and Towns, but that's about it. For the rest you will need to interpret the data elements and transform the hexadecimal values to integers and correlate those to the proper tables (like creature/spell/artifact IDs).

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 18, 2017 08:02 PM
Edited by AlexSpl at 20:18, 18 Dec 2017.

You can try the Heroes of Might and Magic III SaveEditor by Ztalker, but it's in Russian:

http://handbookhmm.ru/forum/download/file.php?id=1394

Or you can search for h3m/cgm/gm* file formats on the netz.

* * *
Maybe the following info will also help. A gm* file is a gzip archive, so you should unpack it prior to editing. Though don't bother to pack it back, as the game recognizes both packed and unpacked saved game files.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
josa8011
josa8011

Tavern Dweller
posted December 19, 2017 12:00 AM

Maurice said:
The savegames are actually zipped archives. Before you can do anything with them for the purpose of data extraction, you will need to unzip them.

The savegames themselves are binary files, i.e. not human readable by default (unless your hexadecimal translation is superb ), so you'd need to have some sort of parser to make sense of the data located inside.

The savegame will contain information on anything it needs to create the map upon loading:
- Generic data (like day / month / year, but also filesize and the like);
- Map information (objects, etc ...);
- Town details of all towns on the map;
- Hero details of all Heroes (including those in taverns, otherwise invisible to players);
- Hero details if they were carried over from a previous map;

The order in which these entries follow one another are set in stone. You can readily read names from Heroes and Towns, but that's about it. For the rest you will need to interpret the data elements and transform the hexadecimal values to integers and correlate those to the proper tables (like creature/spell/artifact IDs).


Thanks! Yeah I've managed to open a few of them but I'm not sure how to continue. I've tried searching for the relevant day / week / month in hex but I get lots and lots of hits so it's very hard to know which one (if any) represents the day / week month. Do you have any links to file format representation?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
josa8011
josa8011

Tavern Dweller
posted December 19, 2017 12:01 AM

AlexSpl said:
You can try the Heroes of Might and Magic III SaveEditor by Ztalker, but it's in Russian:

[url=http://handbookhmm.ru/forum/download/file.php?id=1394]http://handbookhmm.ru/forum/download/file.php?id=1394[/url]

Or you can search for h3m/cgm/gm* file formats on the netz.

* * *
Maybe the following info will also help. A gm* file is a gzip archive, so you should unpack it prior to editing. Though don't bother to pack it back, as the game recognizes both packed and unpacked saved game files.


Thanks, that looks interesting though I'd like to do this in a script so I would need to know what bytes to look at without using an editor. Do you know if the source for that program can be found somewhere?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 19, 2017 12:31 AM
Edited by AlexSpl at 00:39, 19 Dec 2017.

Well, it's pretty straightforward. Google gzip, unpack gm*, search for values you need, write down addresses. I assume you are familiar with hexadecimal editors (HxD, WinHex, etc.).

But... if you are *really* interested in the format, I suggest you to download a free disassembler, e.g. IDA 5.0. You, then, will be able to locate the function that writes data into a file, and track what data and in which order are written to the file.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
josa8011
josa8011

Tavern Dweller
posted December 19, 2017 11:07 AM

I'm not super interested in the format. I was hoping someone has the addresses for the values I need (current player and day / week / month). I get 10+ hits for day / week / month in each file I've tested so far and tracking down the correct one (if any of them is correct, I'm not even sure it's written in that order) would take several hours of work for something not that important.

Thanks for your suggestions though!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted December 19, 2017 04:10 PM

What you could do - something I do, to find specific values - is to make a savegame, then make a small change with respect to the stuff I am interested in and make a second save. Compare the two files and locate the differences.

In this particular case, you could make a testmap with as little as possible on it (maybe a Town and a Hero, all player controlled, just to have reference objects) and then make savegames on consecutive days, without making actual changes ingame (i.e. moving your Hero). Note stuff that changes with new days, like resource income, so you can ignore those differences within the savegame comparison.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
josa8011
josa8011

Tavern Dweller
posted December 19, 2017 06:49 PM

Maurice said:
What you could do - something I do, to find specific values - is to make a savegame, then make a small change with respect to the stuff I am interested in and make a second save. Compare the two files and locate the differences.

In this particular case, you could make a testmap with as little as possible on it (maybe a Town and a Hero, all player controlled, just to have reference objects) and then make savegames on consecutive days, without making actual changes ingame (i.e. moving your Hero). Note stuff that changes with new days, like resource income, so you can ignore those differences within the savegame comparison.


That's a good suggestion. Thanks!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
catshy
catshy

Tavern Dweller
posted January 29, 2019 08:51 PM
Edited by catshy at 21:00, 29 Jan 2019.

Hello Guys! Thanks for this helpful topic. In this page: http://heroescommunity.com/viewthread.php3?TID=18817

I found tip how to find info about hero in memoy/save fine - I mean, you have to first know name of hero and next using Maurice's tip u can find more info.

But my question is - how to get list of heroes if you for example dont know any names?

And second question, Maurice told that each Hero use 1094 bytes in memory, but in example -195 to +876 is 1071 bytes its just mistake?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted January 29, 2019 10:08 PM

catshy said:
And second question, Maurice told that each Hero use 1094 bytes in memory, but in example -195 to +876 is 1071 bytes its just mistake?


Yeah, I forgot a few bytes at the end there; it runs up to +898. Also, Hero data string are only 1094 bytes when they don't contain a custom bio - something I only recently realised. If they have a custom bio, the Hero data is longer by the same amount as bytes as the custom bio takes.
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0529 seconds