So apparently there is a wine bug that has been open for more than 7 years affecting Age Of Empires II HD. The game keeps scrolling the screen when inside a battle.
Fortunately someone found the specific bytes that can be changed as a workaround for the bug. I am saving the workaround here in case it is lost at some point:
Original link: https://steamcommunity.com/app/221380/discussions/2/622954302095447538/#c154645539343670235
Quote:
Ive been having this issue under wine as well, and finally got annoyed enough to look into it. I have an explanation and fix which seem to have fixed the issue for me so far.
The game is using the GetKeyboardState() function to read the arrow keys (and other keys), and is not checking the result correctly. The MSDN documentation for the function only defines the low bit (0x01, meaning that the key is "toggled" à la Caps Lock) and the high bit (0x80, meaning that the key is pressed). Age of Empires (both 1 and 2) check if the key is pressed by checking if the result is > 1. This works most of the time, as it does not depend on the low bit. However, the undefined "middle" bits are occasionally used by windows/wine internals, and are not guaranteed to be zero. The game should check only the high bit (by ANDing it with 0x80).
I've patched version 5.0 to do this for the arrow keys (replace 80 3C 01 01 at offset 0x4525D4 with 80 24 01 80 and 0F 97 C0 at 0x4525DB with 0F 95 C0 in AoK HD.exe). Note that this doesn't fix the issue across the board — the Tech Tree screen also uses GetKeyboardState() and checks the result in the same way. It'll also need redoing for each version until it's fixed properly by the developers.
I only had to do the first replacement for it to work :); this using any hex editor (like Bless). Afterwards, I can enjoy AoE II HD on Linux.