Page 7 of 14

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Mar 27, 2014 10:12 pm
by archibalduk
Are you using Excel or OpenOffice/LibreOffice?

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Mar 27, 2014 10:18 pm
by ezpkns34
Excel. Should I give OpenOffice a shot?

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Mar 27, 2014 10:29 pm
by nino33
I obviously defer to you Archi, and I haven't yet attempted any saved game editing, but...are Templates used when editing a saved game? Or do you just edit the exported files directly? I read pages 19-20 in the Read Me and that's the impression I got

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Mar 27, 2014 10:34 pm
by ezpkns34
nino33 wrote:I obviously defer to you Archi, and I haven't yet attempted any saved game editing, but...are Templates used when editing a saved game? Or do you just edit the exported files directly? I read pages 19-20 in the Read Me and that's the impression I got
That was the first thing I tried & I got the same "Unknown updater file type" result

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Fri Mar 28, 2014 12:37 am
by ezpkns34
Tried using OpenOffice for XML & CSV, same result

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Fri Mar 28, 2014 7:11 pm
by archibalduk
nino33 wrote:saved game editing, but...are Templates used when editing a saved game?
Ah thanks for pointing out that it's a saved game being edited. I had completely overlooked that fact from ezpkns34's original post.

The reason for the error is because contract_update cannot be used to edit saved games. As with many aspects of saved game editing, it is more complex than DB editing. Whereas the DB only stores details of the contract length and salary, the saved game stores details of the different salaries each year of the contract and the various clauses. It's something I'd love to make editable in the future, but adding more DB editing functions to the Updater is the priority right now.

The templates are used to edit the saved game like normal. It's just that only some aspects of the saved game can be edited right now and so the Updater won't let you import a template for something that isn't supported for saved game editing [NOTE TO SELF: Make the Unknown Template error for saved games a little more helpful/explicit].

The readme on page 20 lists which templates/functions are compatible with saved game editing. I think it'd be helpful if there was a clear table/chart in the readme which says which templates can be used for DB and/or saved game editing [Another note to self]. At present, only the attribute_update and nonplayer_update can be used with saved games (but note the issue about some attributes being encoded relative to the player's CA).

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Tue Apr 01, 2014 1:17 pm
by Asbeen
I've been updating height and weight in a "saved" game before without any problems and now only the weight seems to not updating correctly, it appears lower than I input, any ideas on what might be causing this?

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Tue Apr 01, 2014 6:55 pm
by archibalduk
Can you give me some examples of what values you are entering and how they are appearing in game?

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Tue Apr 01, 2014 10:18 pm
by Asbeen
Ex. Sam Reinhart height 185 weight 83 => Ingame 161cm 60 kg (I tried both with metrics and imperial mesures)

Christer Fabricius 173 73 Ingame 167cm 49kg

Could it be because I applied the "Calculate Strentgh" on the saved game before I updated their weight and height?
(It was done last week, not at the same time)

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Wed Apr 02, 2014 9:16 pm
by Asbeen
Another interesting thing; I updated the Height and Weight with the SGE and got this result:

Jacob de la Rose: SGE entries 189cm 86kg and result ingame is 188cm 78kg

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 03, 2014 8:37 pm
by archibalduk
Sounds like might be EHM adjusting the values in-game. Try exporting the player attributes from your saved game using the Updater. This will show how the heights and weights for those players are stored in the saved game.
Asbeen wrote:Could it be because I applied the "Calculate Strentgh" on the saved game before I updated their weight and height?
(It was done last week, not at the same time)
No, all that does is set the Strength attributes. It doesn't affect any heights or weights.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 03, 2014 9:26 pm
by Asbeen
In the exported attributes it's correct, same thing I entered so the game is changing it for whatever reason.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 03, 2014 9:53 pm
by archibalduk
They're all very young players. I wonder if EHM somehow moderates the heights and weights of young players?

Assuming of course that this issue hasn't affected older players too.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Fri Apr 04, 2014 12:20 am
by Asbeen
archibalduk wrote:They're all very young players. I wonder if EHM somehow moderates the heights and weights of young players?

Assuming of course that this issue hasn't affected older players too.
It makes sense because when changing older players it's fine and I have noticed that younger players which I edited their height and weight are getting unrealistically bigger with age. So they still grow up until 19-20.
(I was trying to make their ingame H & W to their real one for draftees. Its probably better to let them get older before adjusting)

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 4:29 pm
by Corwin86
archibalduk wrote:
nino33 wrote:saved game editing, but...are Templates used when editing a saved game?
Ah thanks for pointing out that it's a saved game being edited. I had completely overlooked that fact from ezpkns34's original post.

The reason for the error is because contract_update cannot be used to edit saved games. As with many aspects of saved game editing, it is more complex than DB editing. Whereas the DB only stores details of the contract length and salary, the saved game stores details of the different salaries each year of the contract and the various clauses. It's something I'd love to make editable in the future, but adding more DB editing functions to the Updater is the priority right now.

The templates are used to edit the saved game like normal. It's just that only some aspects of the saved game can be edited right now and so the Updater won't let you import a template for something that isn't supported for saved game editing [NOTE TO SELF: Make the Unknown Template error for saved games a little more helpful/explicit].

The readme on page 20 lists which templates/functions are compatible with saved game editing. I think it'd be helpful if there was a clear table/chart in the readme which says which templates can be used for DB and/or saved game editing [Another note to self]. At present, only the attribute_update and nonplayer_update can be used with saved games (but note the issue about some attributes being encoded relative to the player's CA).
Hi,

I'm using this great project to edit data in EHM 2007,but after I reading this answer, I would like to know if really there isn't a way to change a player contract in a saved game.

Also, to implent this feature, maybe I can be of help: I'm a Java, PHP, Javascript software developer (but, I can provide only my spare-vacation time) :-)

There is maybe a way to change a player contract directly editing the exported saved game?
For example, in the case of a free agent, maybe is possible to create a new contract for him? So isn't possible with the updater or with other tools?

Thanks very much!

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 7:37 pm
by archibalduk
Corwin86 wrote:There is maybe a way to change a player contract directly editing the exported saved game?
For example, in the case of a free agent, maybe is possible to create a new contract for him? So isn't possible with the updater or with other tools?
I can't remember, but does the Saved Game Editor do this?

Otherwise, yes you could certainly do this using a hex editor. The easiest way would be to first extract the sub-files from the saved game using the Updater. Then once you've made the changes, re-pack the sub-files into the saved game using the Updater.

There are three things you'll need to do in order to move a player to another team:

1. Edit the appropriate record in staff.dat. The two fields you'll need to edit are StaffClubContracted and StaffClubPlaying (see the DB structure here).

2. Update the appropriate records in club.dat. Each team has a ClubSquadList array. This stores a list of the staffIDs of players on that team's roster. So you'll need to remove the ID from the former team and add it to the new team (again, see the DB structure above).

3. Update contract.dat. This stores the contract data for all existing contracts and future transactions (the dat file is split into two with the current contracts first followed by the future contracts). If the player is a free agent, you'll need to a record to the existing contracts. If he is already on a team's roster, you'll just need to edit the appropriate entry. We don't have the full structure, but you'll find some details here. Also, take a look at this which has some details of how many bytes per record.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 7:50 pm
by Corwin86
archibalduk wrote:
I can't remember, but does the Saved Game Editor do this?
Sadly, no :-(

You can edit player data, finances and arena's data.

Thanks very much for your explation, I will try to use these info and maybe I'll succeed :-)

If I find something, I'll post the result.

Thanks again! (and please add this option to your project, I think can be very useful :-) )

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 8:59 pm
by Corwin86
I'm having problem in finding the correct row of data, searching with the id (in hex) of the player.

Example: "Matthew Samsonovich" (id: 16284) --> the database says long integer --> 3F9C... and here we start with the problem.

I think isn't correct 3F9C only, because I find 6 different values in the hex of "staff.dat".

Maybe I must convert with a different tool?

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 9:12 pm
by archibalduk
The bytes are byte swapped. So your 00 00 3F 9C long integer becomes 9C 3F 00 00.

Here's a note of the record sizes (in bytes) of each table:

Code: Select all

// Struct lengths
enum ENUM_TABLE_SIZES {
    DB_AFFILIATIONS_SIZE = 16,
    DB_CITY_SIZE = 81,
    DB_CLUB_SIZE = 733,
    DB_CLUB_COMP_SIZE = 219,
    DB_CLUB_COMP_HISTORY_SIZE = 30,
    DB_CLUB_HISTORIES_SIZE = 29,
    DB_CLUB_RECORDS_SIZE = 257,
    DB_COLOUR_SIZE = 58,
    DB_CONTINENT_SIZE = 69,
    DB_CURRENCIES_SIZE = 119,
    DB_DRAFTED_PLAYERS_SIZE = 21,
    DB_DRAFTS_SIZE = 61,
    DB_INDEX_SIZE = 63,
    DB_INJURIES_SIZE = 217,
    DB_NAMES_SIZE = 60,
    DB_NATION_SIZE = 255,
    DB_NONPLAYER_SIZE = 38,
    DB_OFFICIALS_SIZE = 44,
    DB_PLAYER_SIZE = 73,
    DB_PLAYER_INFO_SIZE = 44,
    DB_PLAYER_RIGHTS_SIZE = 16,
    DB_RETIRED_NUMBERS_SIZE = 110,
    DB_STADIUM_SIZE = 78,
    DB_STAFF_SIZE = 116,
    DB_STAFF_COMP_SIZE = 109,
    DB_STAFF_COMP_HISTORY_SIZE = 58,
    DB_STAFF_HISTORY_SIZE = 37,
    DB_STAFF_INFO_SIZE = 12,
    DB_STAFF_LANGUAGES_SIZE = 9,
    DB_STAFF_PREFERENCES_SIZE = 52,
    DB_STAGE_NAMES_SIZE = 135,
    DB_STATES_PROVINCES_SIZE = 117,
    SG_FIXTURES_SIZE = 76,
    SG_HOST_COUNTRY_SIZE = 34,  // First 2 bytes = record count
    SG_IIHF_RANKINGS_SIZE = 44, // Garbage 452 bytes at end of file. Final 6 bytes of the garbage = a char followed by an SI_DATE
    SG_PLAYER_STATS_HISTORY_SIZE = 83
};
Also, I have a couple of notes in my source code where I've mapped out a bit of the contract.dat file (in preparation for when I do eventually tackle it):

Code: Select all

 * CONTRACT_DAT
First 8 bytes = 0s -> Next 4 bytes = record count
 -> Current contract records (209 bytes per record) -> 8 bytes = 0s
 -> Next 2 bytes = record count -> Future transfer contract records (237 bytes per records) (if record count is greater than zero)
 -> Final 2 bytes = 0s

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 10:39 pm
by Corwin86
archibalduk wrote:The bytes are byte swapped. So your 00 00 3F 9C long integer becomes 9C 3F 00 00.

Here's a note of the record sizes (in bytes) of each table:

Code: Select all

// Struct lengths
enum ENUM_TABLE_SIZES {
    DB_AFFILIATIONS_SIZE = 16,
    DB_CITY_SIZE = 81,
    DB_CLUB_SIZE = 733,
    DB_CLUB_COMP_SIZE = 219,
    DB_CLUB_COMP_HISTORY_SIZE = 30,
    DB_CLUB_HISTORIES_SIZE = 29,
    DB_CLUB_RECORDS_SIZE = 257,
    DB_COLOUR_SIZE = 58,
    DB_CONTINENT_SIZE = 69,
    DB_CURRENCIES_SIZE = 119,
    DB_DRAFTED_PLAYERS_SIZE = 21,
    DB_DRAFTS_SIZE = 61,
    DB_INDEX_SIZE = 63,
    DB_INJURIES_SIZE = 217,
    DB_NAMES_SIZE = 60,
    DB_NATION_SIZE = 255,
    DB_NONPLAYER_SIZE = 38,
    DB_OFFICIALS_SIZE = 44,
    DB_PLAYER_SIZE = 73,
    DB_PLAYER_INFO_SIZE = 44,
    DB_PLAYER_RIGHTS_SIZE = 16,
    DB_RETIRED_NUMBERS_SIZE = 110,
    DB_STADIUM_SIZE = 78,
    DB_STAFF_SIZE = 116,
    DB_STAFF_COMP_SIZE = 109,
    DB_STAFF_COMP_HISTORY_SIZE = 58,
    DB_STAFF_HISTORY_SIZE = 37,
    DB_STAFF_INFO_SIZE = 12,
    DB_STAFF_LANGUAGES_SIZE = 9,
    DB_STAFF_PREFERENCES_SIZE = 52,
    DB_STAGE_NAMES_SIZE = 135,
    DB_STATES_PROVINCES_SIZE = 117,
    SG_FIXTURES_SIZE = 76,
    SG_HOST_COUNTRY_SIZE = 34,  // First 2 bytes = record count
    SG_IIHF_RANKINGS_SIZE = 44, // Garbage 452 bytes at end of file. Final 6 bytes of the garbage = a char followed by an SI_DATE
    SG_PLAYER_STATS_HISTORY_SIZE = 83
};
Also, I have a couple of notes in my source code where I've mapped out a bit of the contract.dat file (in preparation for when I do eventually tackle it):

Code: Select all

 * CONTRACT_DAT
First 8 bytes = 0s -> Next 4 bytes = record count
 -> Current contract records (209 bytes per record) -> 8 bytes = 0s
 -> Next 2 bytes = record count -> Future transfer contract records (237 bytes per records) (if record count is greater than zero)
 -> Final 2 bytes = 0s
Thanks for all these answer, I'm really feeling I'm so close to gain it, and then I lost something... :help:

I'm a developer, but it's the first time I work on hex.

So, if I've understood well, I can use (clearly) the table size to directly access, for example, a record in "staff.dat": so, using the past example, 16284 is the player id, and also the number of the record? Or am I missing something? The table size is 116.
Then I make a quick search for 16283 (16284-1) * 116, but it doesn't seems correct...

Sorry If I ask all these question, but maybe this can also help others :-)

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 11:07 pm
by archibalduk
Most hex editors let you change the number of bytes shown per row (usually it is labelled as a "columns" or "column numbers" setting). Set this to 116 and you'll see one record per row. This makes things much easier. Hopefully this explanation will help you (but please do let me know if you're still struggling): 16284 * 116 = 1,888,944 (in hex = 001C D2B0).

The first record ID is 0. The first byte location is 0. Therefore the first record (ID 0) is located at bytes 0 (0x00) to 115 (0x73). The second record (ID 1) is located at bytes 116 (0x74) to 231 (0xE7).

Thus record ID 16284 is actually the 16,285th record in the file. This is located at byte number 1,888,944 (in hex this is 0x1CD2B0 - or to put it another way - 001C D2B0).

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Thu Apr 17, 2014 11:24 pm
by Corwin86
archibalduk wrote:Most hex editors let you change the number of bytes shown per row (usually it is labelled as a "columns" or "column numbers" setting). Set this to 116 and you'll see one record per row. This makes things much easier. Hopefully this explanation will help you (but please do let me know if you're still struggling): 16284 * 116 = 1,888,944 (in hex = 001C D2B0).

The first record ID is 0. The first byte location is 0. Therefore the first record (ID 0) is located at bytes 0 (0x00) to 115 (0x73). The second record (ID 1) is located at bytes 116 (0x74) to 231 (0xE7).

Thus record ID 16284 is actually the 16,285th record in the file. This is located at byte number 1,888,944 (in hex this is 0x1CD2B0 - or to put it another way - 001C D2B0).
Thanks, I found it! :joy:

Thanks very much again, now I'll try to modify the record (the "bytes per row" hint is fantastic!) of "staff" and then I'll try on club and contract :-)

I try it now, but maybe I have to answer again tomorrow.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Fri Apr 18, 2014 12:21 am
by Corwin86
Ok, the last update for today :-)

I managed to change data in "staff.dat" and "contract.dat" (in my case, adding a contract to a player, so add a new record, using as "template" the contract of a player already in the team), but not in "clubs.dat".

Also, I have to check why a player still retire if have a new contract:
- I see that I don't change "StaffDateJoinedClub" and "StaffContractExpiresClub" in "staff.dat", can this be a problem?
- Maybe there is value inside a table that show the data of retirement of a player?

As I said, I didn't unserstand how to "work" on club's players list: this is a pointer to an array, but where is it? Or what I don't understand?

Actually, I can create a working (!!!) saving game, but I miss these info and data.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Fri Apr 18, 2014 8:27 am
by archibalduk
The club.dat file needs to be updated because otherwise the player/staff won't appear on the team's roster. If you search for your player in game (using the Search function) you'll see that his contract details are set (because you updated the staff.dat and contract.dat files) but he won't appear on the team's Roster Screen.

Each record in club.dat is 733 bytes long. As mentioned, there are a number of arrays within this table. The size of each array is as follows:

Code: Select all

// club staff table sizes
enum { 
DIRECTOR_SIZE = 3,
SQUAD_SIZE = 75,
SCOUT_SIZE = 15,
COACH_SIZE = 5,
PHYSIO_SIZE = 3
};
With this in mind, let's take a look at the relevant section of the club.dat structure:

Code: Select all

[...]
STAFF_PTR	ClubChairman;
STAFF_PTR	ClubDirectorList[ DIRECTOR_SIZE ];
STAFF_PTR	ClubManager;
STAFF_PTR	ClubAssistantManager;
STAFF_PTR	ClubHeadCoach;
STAFF_PTR	ClubHeadScout;
STAFF_PTR	ClubSquadList[ SQUAD_SIZE ];
STAFF_PTR	ClubCoachList[ COACH_SIZE ];
STAFF_PTR	ClubScoutList[ SCOUT_SIZE ];
STAFF_PTR	ClubPhysioList[ PHYSIO_SIZE ];
STAFF_PTR	ClubCaptain;
STAFF_PTR	ClubAssistantCaptain1;
STAFF_PTR	ClubAssistantCaptain2;
[...]
STAFF_PTR is just a long/integer - i.e. 4 bytes. Taking the ClubDirectorList array, this consists of 3 entries (DIRECTOR_SIZE = 3 as per my list above). 3 entries x 4 bytes = 12 bytes. The section you want to edit is the ClubSquadList which has 75 entries (75 entries x 4 bytes = 300 bytes). All you need to do is add your player's StaffID to the next available entry in the ClubSquadList. Using the array square brackets is just a shorthand way of saying that there are 75 longs/ints/entries.

As for staff retirements, there is a retire.dat file in the saved game (I have never looked into this file before). I don't know the structure, but usually the first 4 bytes of each saved game .dat file is the record count (it seems only the usual DB .dat files in the saved game do not start with a record count). So, ignoring the first 4 bytes (assuming it is the record count), you can divide the file size by the record count to find out how many bytes per record. Although this does only work for files that aren't split into a number of sub-files.

Re: EHM 2007 Updater (A Pre-Game & Saved Game Editor)

Posted: Sat Apr 19, 2014 5:20 pm
by Corwin86
Thanks very much, I will try to continue my "experiments" probably tomorrow :)