crimsoncantab / aok-hotkeys

Hotkey Editor for Age of Empires II
Other
25 stars 9 forks source link

Support for new .hkp File-Structure in Aoe2DE Update 83607 #84

Open 0nelight opened 1 year ago

0nelight commented 1 year ago

I am happy to support efforts to get the Aoe2 DE Update 83607 working :-)

Age of Empires II: Definitive Edition - Update 83607
Age of Empires II: Definitive Edition - Patchnotes

Some things discovered so far: C:\Users\<USER>\Games\Age of Empires 2 DE\<ID>\profile\

For each Hotkey-Profile there are two things getting generated in the above folder:

The \<profilename>.hkp has basically the same structure as the old .hki file except there is for each hotkey an additonal 4-bytes area.

-      HOTKEY_FORMAT = struct.Struct('<Ii???x')
+     HOTKEY_FORMAT = struct.Struct('<Ii???xI')

The base.hkp has basically also the same structure except there is for each hotkey an additonal 4-bytes area and there are no 4-bytes for the total "num_menus".

It seems some Hotkey-Changes get applied in \<profilename>.hkp and some in base.hkp.

Crumbs44 commented 1 year ago

I also want to help (I'm a beginner though so have a long learning curve) Where are you finding the documentation about hki / hkp? I'm struggling to get the ball rolling. Anything you can do to signpost me to the right place will be very helpful :)

0nelight commented 1 year ago

I also want to help (I'm a beginner though so have a long learning curve) Where are you finding the documentation about hki / hkp? I'm struggling to get the ball rolling. Anything you can do to signpost me to the right place will be very helpful :)

Uh, I don't know where to start.

@Crumbs44 let's discuss on discord to not spam this github issue.

I openend a "aok-hotkeys" discord-server - hope @crimsoncantab this is ok with you :)

https://discord.gg/yTjVnnVJcF

Happy to guide you.

KSneijders commented 1 year ago

Hey @0nelight @crimsoncantab,

I spent some time yesterday and today looking into HKI and the new HKP files (based on code in this repo). After a bit of fiddling around I got the new structure working 🙂

I've documented the things I found in a gist:

https://gist.github.com/KSneijders/9231eeec1a66b314c3402729f0c455fa

I haven't spent much time figuring out which hotkey is in which of the two files and/or why but hopefully this is helpful for this project.

Also, thanks for the project, it's a very useful tool!

When I find a bit of time again and figure out if there's logic to what keys are saved in what file I'll post it here, if someone else figures something out in the mean time, please let me know!

crimsoncantab commented 1 year ago

This is awesome, @KSneijders . Thanks for making progress on it. Are you certain that the game is still using the old .hki file in addition to the .hkp? I would hope it's just the *.hkp file - otherwise a user will have to upload both files to edit all their hotkeys.

KSneijders commented 1 year ago

@crimsoncantab It's no longer using the older *.hki file, but it is (unfortunately) using two .hkp files. One of which is using the same format as *.hki and one that has 3 hardcoded menus before the number_of_menus section.

[ This is an assumption, a likely one, but still an assumption ] [ No longer an assumption, I've tested it ] The reason for this is because the one file which has the same pattern as *.hki (./<profile>.hkp) contains the core hotkeys, the ones which are the same between AoE1 (Return of Rome DLC) and the base game (AoE2:DE).

The other file (./<profile>/Base.hkp) contains the keys that are specifically for AoE2:DE. And the third file (if you have the Return of Rome DLC) (./<profile>/Pompeii.hkp) contains keys specifically for AoE1 hotkeys.

So you can change hotkeys for villagers probably in the ./<profile>.hkp file and the changes would be reflected in both RoR and the base game.

KSneijders commented 1 year ago

@crimsoncantab I've confirmed the above, I've documented the current distribution:

https://gist.github.com/KSneijders/8be5b386100548cc4a24da5ff2c6b520