Page 1 of 3
EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sat Apr 26, 2014 12:24 am
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).

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sat Apr 26, 2014 1:07 am
by nino33
Wow!

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sat Apr 26, 2014 7:22 am
by Alessandro
Wow indeed!
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sat Apr 26, 2014 7:53 am
by Tonait
Amazing, thanks!!
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sat Apr 26, 2014 2:43 pm
by Tasku
Nicely done!

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sat Apr 26, 2014 6:38 pm
by ForNever
If I could I'd like the hell out of the first post.

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sun Apr 27, 2014 12:49 pm
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.

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sun Apr 27, 2014 2:23 pm
by Leafsdude
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sun Apr 27, 2014 3:10 pm
by Primis
This is amazing. This is exactly what someone like me has wanted.

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sun Apr 27, 2014 3:59 pm
by archibalduk
I was thinking of maybe teasing you for a year or two first!
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.
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Sun Apr 27, 2014 5:36 pm
by Vollinger
Great work man, looking forward it

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Mon Apr 28, 2014 9:29 pm
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...

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:

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Tue Apr 29, 2014 5:09 pm
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.
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 3:34 am
by CeeBee
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 7:36 am
by Alessandro
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 7:38 am
by Alessandro
For this to happen we'll need to recall the Hobbit from the Shire
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 10:47 am
by Filip Croatia
So, if I undestand correclty, with this editor we can edit leagues and their structure as well ?

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 1:18 pm
by nino33
Alessandro wrote:
For this to happen we'll need to recall the Hobbit from the Shire
HaHa! Maybe he'll want to go on another adventure!
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 1:57 pm
by Alessandro
nino33 wrote:Alessandro wrote:
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

especially for us

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 8:05 pm
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.
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 8:15 pm
by archibalduk
Filip Croatia wrote:So, if I undestand correclty, with this editor we can edit leagues and their structure as well ?

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!

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.
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 8:31 pm
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
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Wed Apr 30, 2014 10:16 pm
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).

Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Thu May 01, 2014 2:29 pm
by Filip Croatia
Re: EHM 2007 Hardcode Editor (An exe / hex editor) [WIP]
Posted: Fri May 02, 2014 11:32 pm
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.
