Tutorials for hexediting EHM

Discuss all aspects of editing the data and databases in EHM here. Have a question about the EHM Editor, EHM Assistant, editing the .cfg files, hex editing the .dat or .db files? Want to tweak the EHM exe file to change league rules/structure, start date etc? This is the place!
Forum rules
This is the forum to discuss all aspects of editing the EHM data and tweaking the game.

Have a bug or feature request for the EHM Editor? Post them in the EHM Editor thread. Please start a new thread or post in another thread if you have a question about how to use the EHM Editor.

Given the large number of questions on similar topics, we ask that you start a new thread for a new question unless you can locate a similar question in an existing thread. This will hopefully ensure that similar questions do not get buried in large threads.

Useful links: EHM 1 Assistant (Download) | EHM 1 Editor (Download) | EHM 1 Editor Tutorials | Editing Rules & Structures Guide | Converting EHM 2004 / 2005 DBs to EHM 1 | Converting an EHM 2007 DB to EHM 1 | Extra_config.cfg | Import_config.cfg | Player Roles
User avatar
nino33
Mr. Goalie
Posts: 6088
Joined: Sat Aug 07, 2010 3:37 am
Custom Rank: Retro Rosters Specialist
Favourite Team: 1970s hockey

Re: Tutorials for hexediting EHM

Post by nino33 »

Hmmm.....I was able to "delete" the Stanley Cup history with a long string of FF FF FF.....

Would this work with the club_records file? By using FF FF to "delete" the whole record string? Or just the Team ID?
In this way maybe I could delete NHL club records in the club_records file, and then use the record_config file to input the records? Because the record_config file would be much easier to deal with...
User avatar
archibalduk
TBL Admin Team
Posts: 20372
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Tutorials for hexediting EHM

Post by archibalduk »

Riz, Graeme Kelly or mne2 would be better placed to give a definitive answer, but here's my guess:

A long string of FF FF FF FF is the equivalent of 4,294,967,295 (this is a handy hex -> dec calculator). So if you change a record ID number to FF FF FF FF then I wonder if you're setting the ID to that value? The game presumably wouldn't pick it up because Index.dat will have the number of records listed for the club_records.dat file (or whichever .dat file you're editing) at a much lower number than the 4+ billion. Does the game pick up records listed after the record that you changed to FF FF FF FF?

I guess what I'm saying is that it's not the proper way of doing things. But then if it works, who cares?! :D I'm guessing is that the only disadvantage is that it may result in larger saved game files (because the blank records might be incorporated into the saved game).
User avatar
Isles22
Junior League
Posts: 15
Joined: Tue Nov 22, 2011 6:10 pm

Re: Tutorials for hexediting EHM

Post by Isles22 »

archibalduk wrote:Yeah it would be a big task to edit. To be honest, the best way to edit it would be to first export the staff, names and team .dat files so that you can figure out what ID each player/team has (this is something I'm interested in doing once I have time).
I have an interest in doing this as well. I've been poking around in the club.dat file and I think I have figured a few things out, but some other things are slowing down progress.

Code: Select all

struct CLUBS
{
// original data
...
LONG	 ClubTacticTraining[ MAX_TACTIC_TRAINING ];
...
STAFF_PTR	 ClubDirectorList[ DIRECTOR_SIZE ];
...
STAFF_PTR	 ClubSquadList[ SQUAD_SIZE ];
STAFF_PTR	 ClubCoachList[ COACH_SIZE ];
STAFF_PTR	 ClubScoutList[ SCOUT_SIZE ];
STAFF_PTR	 ClubPhysioList[ PHYSIO_SIZE ];
...
};
My understanding at this point is that the above fields would lead to each club having a variable record length. (since not all clubs have the same amount of staff, players etc.)
Am I on the right path with that thinking?

Also, is there a list of all the clubs in the database?
Or does anybody even know how many clubs there are in total?
I was playing around with the info from club_records. dat and I came up with 2743 clubs, is that correct?

Thanks
User avatar
Lazion
Second Line
Posts: 661
Joined: Tue Oct 23, 2007 5:34 pm
Favourite Team: Flyers

Re: Tutorials for hexediting EHM

Post by Lazion »

You should look into club.dat and scroll down to very last team and check team id.
In my DB there's total of 4756 teams.
User avatar
archibalduk
TBL Admin Team
Posts: 20372
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Tutorials for hexediting EHM

Post by archibalduk »

I've been doing a lot of work with the database over the past month or two and have a much greater understanding than I did before.

Each field does have a variable length but you can calculate this according to the field type. All of this information can be found in the EHM 2007 database structure (you quoted a bit of it in your post). For example STAFF_PTR is a long which is four bytes long (= four pairs of hex). Another thing to note is that the bytes are reversed. I posted a bit more detail here: http://www.ehmtheblueline.com/forums/vi ... 59#p129959

With some reasonably simple C/C++ it is possible to extract and reimport the .dat files using the database structure.
User avatar
Isles22
Junior League
Posts: 15
Joined: Tue Nov 22, 2011 6:10 pm

Re: Tutorials for hexediting EHM

Post by Isles22 »

Yes, I understand the _PTR part. My concern is with the _SIZE portion.
For Example the STAFF_PTR ClubSquadList[ SQUAD_SIZE ]; SQUAD_SIZE can vary upto 75 but it may be less.

As I see it now the length is (4 x Squad size) but the squad size is variable, so the record length would be variable.
It would be the same for Coach, Scout and Physio.
User avatar
archibalduk
TBL Admin Team
Posts: 20372
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Tutorials for hexediting EHM

Post by archibalduk »

Ok, I see your question now. I'm not really sure what the ClubSquadList is for because I haven't looked at that part of the database. However, STAFF_PTR ClubSquadList[ SQUAD_SIZE ] means that that field will be 75 bytes long. If the data stored in that field is not 75 bytes then it'll be filled with blank bytes. So even if the data in that field is not long enough, blank bytes are added to make it 75 bytes long. So each field and each record will be of a consistent length.

If it helps, I can take a look at how long each record is in any of the tables if you like. It's just a quick sizeof() function in C.
User avatar
nino33
Mr. Goalie
Posts: 6088
Joined: Sat Aug 07, 2010 3:37 am
Custom Rank: Retro Rosters Specialist
Favourite Team: 1970s hockey

Re: Tutorials for hexediting EHM

Post by nino33 »

archibalduk wrote:I had a quick look in HxD and can see that each record is 257 bytes long. If you look at the top of the HxD window there are three drop down boxes / text boxes. If you enter 257 into the first one then you'll be able to see one record per row.
Can anyone tell me how long the staff_comp_history file is?...



I have the "structure" that Archi posted but I can't figure it out...
archibalduk wrote:The CHAR/SHORT/LONG/etc indicate the type of data stored and the number of bytes. For example, the ClubRecordsID field is a LONG field. A LONG field is 4 bytes long (i.e. four pairs of hex). Some of the other fields in that .dat file are SHORT (=2 bytes / two pairs of hex) and others are CHAR (=1 byte / one pair of hex). CHAR, SHORT and LONG are all fields that store numbers rather than text (IIRC).
I can see "LONG" and "SHORT" in the structure (below)....but most of the lines explaining the structure have nothing indicating how long it is...


struct STAFF_COMP_HISTORIES
{
LONG StaffCompHistoryID;
CLUBS_PTR StaffCompHistoryFirstPlacedClub;
CLUBS_PTR StaffCompHistorySecondPlacedClub;
CLUBS_PTR StaffCompHistoryThirdPlacedClub;
STAFF_COMPS_PTR StaffCompHistoryStaffComp;
STAFF_PTR StaffCompHistoryFirstPlacedIndex;
STAFF_PTR StaffCompHistorySecondPlacedIndex;
STAFF_PTR StaffCompHistoryThirdPlacedIndex;
CHAR_PTR StaffCompHistoryFirstPlacedFirstName;
CHAR_PTR StaffCompHistoryFirstPlacedSecondName;
CHAR_PTR StaffCompHistorySecondPlacedFirstName;
CHAR_PTR StaffCompHistorySecondPlacedSecondName;
CHAR_PTR StaffCompHistoryThirdPlacedFirstName;
CHAR_PTR StaffCompHistoryThirdPlacedSecondName;
SHORT StaffCompHistoryYear;
};



I was hoping/thinking if I can just figure out what I'm looking at I may be able to figure it out further...

Thanks!
User avatar
archibalduk
TBL Admin Team
Posts: 20372
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Tutorials for hexediting EHM

Post by archibalduk »

I think it is 58 bytes per record. I'll double check when I get home.

All of those _PTR fields are 4 bytes each (because all the _PTR types are LONG) and so is LONG. SHORT is 2 bytes.

There are 14 LONGs / _PTRs and 1 SHORT, therefore:

14 x 4 bytes = 56
1 x 2 bytes = 2
TOTAL = 58 bytes


EDIT: I have now had opportunity to check and it is 58 bytes as previously mentioned
User avatar
Primis
Freeware Moderator
Posts: 1698
Joined: Tue Aug 03, 2010 7:46 pm
Location: Michigan, USA

Re: Tutorials for hexediting EHM

Post by Primis »

*bump*

Bumping this so it's easier to find and not buried on the second page of the forum. Good, good stuff in here on swapping league rules.
dougr
Learning to skate
Posts: 3
Joined: Wed Aug 27, 2008 4:18 pm

Re: Tutorials for hexediting EHM

Post by dougr »

I have a request. I've read these threads and this coding stuff is really above my head. What I'm simply looking to do through either hex editor or artmoney is edit the AHL rules from the 5 vet dressed limit either up to like 20 people or remove the limit all together. Can someone tell me how to do that?
User avatar
Primis
Freeware Moderator
Posts: 1698
Joined: Tue Aug 03, 2010 7:46 pm
Location: Michigan, USA

Re: Tutorials for hexediting EHM

Post by Primis »

dougr wrote:I have a request. I've read these threads and this coding stuff is really above my head. What I'm simply looking to do through either hex editor or artmoney is edit the AHL rules from the 5 vet dressed limit either up to like 20 people or remove the limit all together. Can someone tell me how to do that?
I've successfully removed the AHL vet limit altogether, but it's been a while so bear with me. My memory on what I did might not be 100%, but I'm pretty sure this is what I did.

Open the .EXE in a hex editor, and do a search for the string "40 5C 8F" (that's the AHL's current vet limit, and the AHL is the only league to use that string IIRC) and then replace it with "F0 20 8F" (which Austria and the NHL use to denote no such restrictions). Then save the .EXE under a new filename, and run that .EXE instead when you want to use a game with AHL with no vet limits.

If you look back on Page 1 of this thread, there are lists of the different values and what they do/mean. If can be confusing because some of them are hex, and some are not (which I think are for ArtMoney memory addresses instead, and those are octets of 8 characters... ). I've never had luck in ArtMoney myself trying stuff, so I just edit straight in a hex editor.

For hex values, just remember you want the strings with six characters (hex=six).

A handy thing to do is to copy and paste the hex values from previous posts and paste them into a Google Doc you can always get to online. That's what I did.

And FWIW, I'm not a programmer or adept at this stuff either. It takes some persistence to get comfortable doing it, but after a while with those values, you can play around with rulesets quite a bit. Not only have I removed the AHL vet limit before, I also modified the NHL ruleset so that teams could only sign and play "domestic" players for the most part (ie, Jokerit can only use Finns, and non-Finns count against a 3-foreigner limit).
MKoivuFan
Checking Line
Posts: 526
Joined: Wed Mar 07, 2007 5:05 am
Custom Rank: MKoivuSports

Re: Tutorials for hexediting EHM

Post by MKoivuFan »

my question is if i find the world U20 in the hexeding do i just hit enter and copy and past it for U18-17 and how do i go about setting which countries go..
User avatar
MillionDollarMan
Junior League
Posts: 5
Joined: Sat Aug 24, 2013 8:18 pm

Re: Tutorials for hexediting EHM

Post by MillionDollarMan »

Okay so I get how to edit some of the line up rules like how many foreigners dressed. What I'm having trouble with is editing the roster rules. For example, I want to set up the UHL into a custom league and want to get rid of the max 19 players on roster requirement. Any help?
User avatar
archibalduk
TBL Admin Team
Posts: 20372
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Tutorials for hexediting EHM

Post by archibalduk »

MillionDollarMan wrote:Okay so I get how to edit some of the line up rules like how many foreigners dressed. What I'm having trouble with is editing the roster rules. For example, I want to set up the UHL into a custom league and want to get rid of the max 19 players on roster requirement. Any help?
You could try using the Hardcode Editor: http://www.ehmtheblueline.com/forums/vi ... 10&t=12295
Post Reply