EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

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
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:

EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

Click here to download the latest version of the Hardcode Editor (v0.0.3): http://1drv.ms/1g0Ob2j

The source code can be found here (licensed via GNU General Public License v3.0): https://github.com/archibalduk/EHM_2007_Hardcode_Editor

I've started working on a new editor for EHM 2007. This one will edit the hardcoded data in the exe. At present, it can edit the line-up rules and next I'll be adding folder path editing - i.e. being able to edit where the various folders are located (this is useful if you want a second exe which uses different facepack and logo folders for a retro DB). I then want to look at editing the hardcoded league names and hopefully other rules and league structures.

All credit must go to Hobbit13 and all of his tutorials and snippets. In essence, I'm transferring all of this knowledge into a simple to use editor so that we don't have to mess about with hex editors and so that editing the exe is a more accessible task.

I haven't tested the exe's I have edited using my editor, but I have been checking the results in a hex editor and it seems to be working as planned. I'm just working at getting all of the leagues entered into the editor so that all leagues can be edited (as you'll see from the screenshot below, I have only added a couple of leagues so far).

Image
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by nino33 »

Wow! 8-)
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Alessandro »

Wow indeed!
User avatar
Tonait
Junior League
Posts: 24
Joined: Mon Sep 19, 2011 9:15 pm
Location: Turku, Finland

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Tonait »

Amazing, thanks!!
User avatar
Tasku
TBL Admin Team
Posts: 8158
Joined: Sat Jul 10, 2004 9:36 pm
Custom Rank: W-WPoTBLfaSaD
Favourite Team: WSH Capitals
Location: Finland

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Tasku »

Nicely done! 8-)
ForNever
Minor League
Posts: 277
Joined: Tue Dec 31, 2013 10:26 am
Favourite Team: SaiPa (Liiga), Anaheim (NHL)
Location: Joensuu, Finland

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by ForNever »

If I could I'd like the hell out of the first post. =D> :notworthy:
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

I've been spending some time getting the text editing function up and running. Although I haven't tested it in-game yet, it does seem to be working exactly as planned. The reason for not doing any testing in-game yet is because it is much quicker and easier to look at the changes in a hex editor. If the changes appear as planned then I know my Editor is doing what it is supposed to be doing. My Editor is really just a simplified hex editor and it doesn't involve the complex array of index updating, linked tables, etc which is involved with DB editing (such as the Pre-Game Editor and Updater).

With the text editing function now running, it is just a case of identifying the text we want to edit. This involves identifying the offset (address within the hex code) where the text is located and the maximum length of the text. Although this is very simple, it is time-consuming because I must make a note of the offset and maximum length of every string of text we want to edit. To start with, I have setup all of the file/folder locations with EHM. This will be useful for retro databases because it allows us to keep the retro logos, facepacks, etc located in separate folders from the modern logos, etc. Of course this will involve having one ehm2007.exe for the modern game and then a separate, edited exe for the retro DB - but EHM doesn't mind what the game exe is called and so you can have as many custom EHM exes in your EHM folder as you like.

The screenshot below shows all of the folder names that can be edited right now. There are also some image names that can be changed (e.g. the intro images - this might be useful if you want different start-up images for your retro DB). In practice, you'll probably just want to use a new 'pictures' folder and perhaps different intro images for a DB. The rest of the folder names probably are of little use. But seeing as it's so easy to make all of the text editable and because I don't want to limit what can be edited, I've added it all to this screen. This does however mean that the screen gets a bit cramped at 1024x768 resolution. The screenshot below will be shrunk down according to the size of your browser screen, but you can view a larger version here: http://s209.photobucket.com/user/archib ... c.png.html

The next bit of work to be done is to add all of the remaining leagues to the League Rules screen.

Image
Leafsdude
Junior League
Posts: 37
Joined: Sat Apr 19, 2014 8:23 pm

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Leafsdude »

This looks awesome.

Any idea when something usable will be released? Seems like you're just teasing us right now. :rant: 8-[ :-( :-D
User avatar
Primis
Freeware Moderator
Posts: 1698
Joined: Tue Aug 03, 2010 7:46 pm
Location: Michigan, USA

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Primis »

This is amazing. This is exactly what someone like me has wanted. :notworthy:
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

Leafsdude wrote:This looks awesome.

Any idea when something usable will be released? Seems like you're just teasing us right now. :rant: 8-[ :-( :-D
I was thinking of maybe teasing you for a year or two first! :-D

Hopefully I'll be able to get all of the leagues added to the Editor later today (just want to get some more work done on the 98/99 DB first) seeing as the weather is terrible today and I'm not going anywhere. I also want to tidy up the UI slightly and some minor behind the scenes things. Hopefully I can get a usable beta out this week or the week after.
User avatar
Vollinger
Junior League
Posts: 5
Joined: Sun Mar 23, 2014 7:08 am

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Vollinger »

Great work man, looking forward it :D
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

Here is version 0.0.2 of the Editor: [EDIT: See the first post of this thread for the download link]

I managed to get the behind the scenes stuff done quicker than anticipated as I was able to borrow some code from the Updater.

As mentioned before, I have done very little testing with the Editor so far. It makes the changes as planned and the limited testing I have done seemed fine (e.g. I was able to change the location of 'pictures' folder and edit the rules of the EIHL).

Installation is pretty straightforward. Just extract the zip file to a folder of your choice. Alternatively, you can place the Editor exe file in the same folder as your Updater folder. Both the Editor and the Updater use the same dll files and so they can sit in the same folder with the dll files. If the exes you'll be editing are located in your C:/Program Files/.../ folder then you'll need to use Run as Admin when running the Editor.

Please do let me know if you think the user interface of the Editor could be improved in any way (e.g. I think maybe the Folder Paths screen is a bit cramped). Also, if any line up rules don't work or don't work as described, any crashes, etc.

Hopefully the Editor is fairly intuitive, but here are some brief notes on how to use the two screens:

League Rules
  • Simply select the league you want to edit and then use the drop-down menu to change the line up rules.
  • You'll see that the "No Restrictions (Austria)" setting has a question mark next to it. When I tried using this setting with the EIHL, the line up rule didn't change (it was still at a 10 foreigner limit). The "No Restrictions (Denmark)" setting does work with the EIHL however. I don't know whether this is just a quirk with the EIHL or whether perhaps the Austria setting is wrong.
  • You'll see that many leagues listed in the left-hand column are listed by their country name and not their league name. This is something I need to work on. I think for most leagues, it's straightforward (e.g. the Austria entry is clearly the EBEL). However, for leagues where there is promotion and relegation (e.g. Sweden and Finland) and the IIHL which falls under either Slovakia or Slovenia (I always forget which) it seems the line up rules are all merged into one entry - e.g. there is just a single entry for "Sweden" rather than there being individual entries for the SHL and Allsvenskan.
  • There is various other information displayed on the screen (e.g. Offset A and B and Relative Position). I'll explain these when I have more time (they're only really useful if you want to try and find more settings in the exe using a hex editor).
  • For those of you who have used Marek's guide, you'll notice that the hex codes are written backwards in the Editor. This is because, in the same way as looking at the DB dat files, the hex code in the exe is byte swapped (see diagram below). The Editor corrects for this by showing the hex in its correct order. You'll notice that when displayed in the correct order, the hex code settings look remarkably similar to the offsets listed in my ArtMoney guide. The similarity is no coincidence. I think the hex settings in the exe are in fact references to offsets in the memory. For example, the hex setting for the Czech Republic line up rule is 00 8F 24 30 whereas the offset in ArtMoney for editing the Czech line up rule is 00 08 24 3E (that's a difference of 14 bytes).
Folder Paths
  • Again, this screen is pretty straightforward. Just edit the appropriate text box.
  • There is a number in brackets next to each text box. This indicates the maximum number of characters you can enter (the Editor won't let you enter too many characters).
  • Some of the folder paths use special wildcards. If you edit any of these, make sure you keep the wildcards in there. E.g. you'll see that the Players folder is named "players\%s.%s" - if you edit this path, make sure you keep the "\%s.%s". I think these wildcards mean the filename and file extension.
  • Some of those folder paths I hadn't noticed before; such as the "user" face and background images, the left and right flag folders, the Czech PO.png logo, and the rink "boards" folder... :-k
Here's the byte-swapping diagram I was talking about. The left hand side shows how the hex code appears in Marek's guide and when viewing the exe in a hex editor. The right hand side shows how the hex code is displayed in my Editor and this is the actual hex:

Image
User avatar
batdad
The Great One
Posts: 12616
Joined: Thu Aug 17, 2006 7:46 pm
Custom Rank: Mr Technology
Favourite Team: Syracuse Bulldogs.
Location: Look behind you, you peon

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by batdad »

Wow. Here is what I see. AMAZING..garble I do not understand...amazing...garble, garble, garble, garble...

And it all adds up to: Wow archi you are one awesome dude who writes alot of garble to make this game better

Thank you.
User avatar
CeeBee
All-Star
Posts: 1140
Joined: Tue Dec 23, 2008 12:38 pm
Location: The old guy in Chase BC Canada

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by CeeBee »

I am amazed as well... Maybe one day we will have 30 AHL teams, the new division alignment, up to date waiver rules and god knows what. Will be almost like a new EHM :thup: :-D :-D :1st:
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Alessandro »

batdad wrote:
And it all adds up to: Wow archi you are one awesome dude who writes alot of garble to make this game better
Agreed :notworthy: :notworthy: :notworthy: :notworthy:
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Alessandro »

CeeBee wrote:I am amazed as well... Maybe one day we will have 30 AHL teams, the new division alignment, up to date waiver rules and god knows what. Will be almost like a new EHM :thup: :-D :-D :1st:
For this to happen we'll need to recall the Hobbit from the Shire
User avatar
Filip Croatia
Fringe Player
Posts: 334
Joined: Thu Jul 08, 2010 5:55 pm
Location: Zagreb, Croatia

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Filip Croatia »

So, if I undestand correclty, with this editor we can edit leagues and their structure as well ? :notworthy: :notworthy:
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by nino33 »

Alessandro wrote:
CeeBee wrote:I am amazed as well... Maybe one day we will have 30 AHL teams, the new division alignment, up to date waiver rules and god knows what. Will be almost like a new EHM :thup: :-D :-D :1st:
For this to happen we'll need to recall the Hobbit from the Shire
HaHa! Maybe he'll want to go on another adventure!
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Alessandro »

nino33 wrote:
Alessandro wrote:
CeeBee wrote:I am amazed as well... Maybe one day we will have 30 AHL teams, the new division alignment, up to date waiver rules and god knows what. Will be almost like a new EHM :thup: :-D :-D :1st:
For this to happen we'll need to recall the Hobbit from the Shire
HaHa! Maybe he'll want to go on another adventure!
Further improving EHM should be one hell of adventure actually :-D especially for us :-D
User avatar
batdad
The Great One
Posts: 12616
Joined: Thu Aug 17, 2006 7:46 pm
Custom Rank: Mr Technology
Favourite Team: Syracuse Bulldogs.
Location: Look behind you, you peon

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by batdad »

World of EHM renamed as Hobbit characters

1. Archibalduk UK-Gandolf
2. Manimal-Bilbo Baggins
3. Nino - Frodo Baggins
4. Alessandro-Hamfast Gangee (just cause I love the name)
5. batdad-Adalgrim Took
6. CeeBee-Gerontius "the old" Took (oldest living Hobbit on record)


After that just random characters. Could have named philou after one of the girls.
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

Filip Croatia wrote:So, if I undestand correclty, with this editor we can edit leagues and their structure as well ? :notworthy: :notworthy:
At the moment we can only edit the line up rules (and the various folder names). Marek (Hobbit) posted a little bit of information about editing league structures and so I want to see what I can do with that. Ultimately the Editor will edit anything we tell it to. It's just that we need to figure out what sections need to be edited.
Alessandro wrote:For this to happen we'll need to recall the Hobbit from the Shire
Haha! :-D That's exactly what we need. I'm going to drop him an email later this week to see if he has any further information. Also, I want to see if he has any notes from when he tried to edit the start date in the exe. Now that I know what the offsets are in the RAM, I can use this as a basis to test out modifying the exe. It'd make life so much easier if we could just patch the exe rather than having to remember to load the Patch each time.
User avatar
Manimal
TBL Admin Team
Posts: 6344
Joined: Thu Apr 24, 2008 4:01 am
Custom Rank: EHM Rosters Man
Favourite Team: Djurgårdens IF
Location: Karlstad, Sweden

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Manimal »

This is great!
I can't wait to try it, but I have to as I want to finish the work on the roster update
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

I've made some improvements to some behind the scenes code. It will make it much quicker and easier to add new settings, etc to the Editor. It also removes the risk of me miscalculating the length of text strings (previously I had to calculate and input the length of text strings manually, but now the Editor does it automatically). As a result, I can see that I made some mistakes with the text lengths of some of the folder paths (on the Folder Paths screen). Some of the maximum sizes listed are in fact larger than they ought to be. Also, I noticed that the 'Training' path is incorrectly pointing to the Games folder. Anyhow, all of this is now fixed.

In a nutshell, it'll make getting the league/competition name editing function up and running much easier (and quicker). :-)
User avatar
Filip Croatia
Fringe Player
Posts: 334
Joined: Thu Jul 08, 2010 5:55 pm
Location: Zagreb, Croatia

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by Filip Croatia »

archibalduk wrote:
Filip Croatia wrote:So, if I undestand correclty, with this editor we can edit leagues and their structure as well ? :notworthy: :notworthy:
At the moment we can only edit the line up rules (and the various folder names). Marek (Hobbit) posted a little bit of information about editing league structures and so I want to see what I can do with that. Ultimately the Editor will edit anything we tell it to. It's just that we need to figure out what sections need to be edited.
Nice, it would be so cool to have new NHL format divisions in EHM and KHL as well. That would be dream come true =P~ :notworthy: :notworthy:
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: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]

Post by archibalduk »

I've made a bit more progress with the Editor, with the basic team name and league structure editing up and running. I just need to input all of the leagues and settings.

Thanks to Marek's guide and Lazion's table, it seems as though the league structure settings are always located in the same places. So this should make it very easy to make these editable. I have only been through 4 leagues so far, but it does look promising.

Btw, I haven't tested any edited league names or structures in game yet.

Image

Image
Post Reply