Age of Empires II (2013)

Age of Empires II (2013)

View Stats:
Age of Empires II (2013) > Support > Topic Details
AOE 2 HD+The Forgotten Expansion: Mouse Stuck Scrolling Up!
The mouse has been stuck and scrolling up since I bought the game and played it for the first time, I have read that AOE 2 (Un-Hd version) has had this problem in the past and I would like to state that I do not have Zune software... If there is any fix It would be greatly appreciated as the game is curently unplayable.
Last edited by Intrinsic Folly; Jan 3, 2017 @ 8:36pm
< >
Showing 1-15 of 21 comments
I thought I was the only person who had this problem. So this is really interesting. I want to find out how to fix it or pressure the devs to get it fixed.

I have found there are 4 different ways I it seems to happen for me.

  • 1st is when hold down the Alt key and an arrow key at the same time. If it's what is happening to you then you probably accidentally hit the Alt and Up keys. To fix it you gotta hit Alt and Up again.
  • 2nd happens when running in wine. I haven't pinned it down precisely but I think it's when the game loses focus somehow. Say I bring up a program launcher mid game. Fixed by restarting AOHD.
  • 3rd happens randomly when running in wine. Sometimes you can fix it by restarting AOHD but sometimes you can't which brings me to the 4th way...
  • 4th; easily the most annoying. Happens when running in wine. The only way to fix is by restarting the wine server itself. It drives me mad because I restart AOHD and join a new game and the problem persists into the next game.

Anyway, my guess is there possibly 3 reasons why this is happening.

  • The game has some kind of keyboard scancode stream which is going out of sync.
  • The mouse coordinates for the game may be going out of sync with the operating system in a similar way.
  • There is no checks or recalibration of the keyboard and mouse when they go out of sync.

So my overall opinion is it's probably due to "weaknesses" in the AOHD code/poor code.
But also I think there might be weaknesses in the wine code. I'd be interested to know what your findings are.
Oh one more thing to support my reasoning is during games which last perhaps longer than 30 mins, when there are a lot of unit production buildings, you'd typically be bashing the keyboard to build heaps of units. What seems to happen is the game starts to lag and the keyboard (scancode stream?) sometimes goes out of sync. And then, sometimes, something very strange happens. Every key you press from then on seems to act like '.' i.e. goes to an idle villager. No idea why this is. I'd bring up the chat box and start pressing buttons on the keyboard and all i get is ". . . . . . . . . . . . . . . . . . . .".
[KGL]Zauberfisch7 Sep 27, 2015 @ 12:43pm 
I am having the same issue when running this game in wine (mint with latest version from winehq directly), happens every time I tab out of the game.

Update: just found a bug report on winehq: https://bugs.winehq.org/show_bug.cgi?id=30814
Last edited by [KGL]Zauberfisch7; Sep 27, 2015 @ 12:50pm
Sulix Jan 3, 2017 @ 7:39am 
I've 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.
[KGL]Zauberfisch7 Jan 3, 2017 @ 10:46am 
Amazing work. Hope I get a chance to try that soon.

On a different note though: have you tried contacting the official devs to fix that permanently?
After.Darkness Jul 9, 2017 @ 1:13pm 
Wine ver 2.11 staging seems to not have this issue
Lanczos Aug 22, 2018 @ 5:51am 
Still waiting for the devs to fix this. Should be really easy since the fix is described in this topic...
tolyandre Sep 29, 2018 @ 1:00am 
Having this problem with Steam Play on Linux
Tobi Dec 28, 2018 @ 8:55am 
Originally posted by toly:
Having this problem with Steam Play on Linux
me too
Tobi Dec 28, 2018 @ 9:19am 
The problem for me seems to be only when using arrow keys. As long as I scroll using right click or moving the cursor to the borders it appears to be working fine.

Since there does not seem to be a way to disable hotkeys, I overwrote them with some key that is harder to reach. I went to the hotkey settings and changed the scrolling hotkeys all to F5 (which sets 3 of them to ??? essentially disabling them).

I really hope this workaround works out for you as well. It certainly makes the game playable now.
Last edited by Tobi; Dec 28, 2018 @ 9:20am
Hafam_Hock Apr 11, 2019 @ 1:16pm 
same here, mouse stuck scrolling up, no wine, what the ♥♥♥♥ is happening?
Nnarol Apr 14, 2019 @ 2:49am 
I've had this issue as well.
There is a workaround, found by the poster of this thread:

https://steamcommunity.com/app/221380/discussions/2/1736588252407754569/

Many thanks to Zakku for experimenting with this!
Also many thanks to Sulix for finding a very likely permanent solution! Hopefully, the devs will implement it.
Originally posted by Sulix:
I've 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.

Many thanks to Sulix for discovering the root cause! I wrote a more or less general patch which should work with most versions of the game. You can find it here[github.com]. Please let me know if you have any issues so I can improve it to support more versions until it's fixed by the devs.
Originally posted by Sulix:
I've 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.

As this is a process you will have to repeat after every update of the game, this script can help do things a bit less tedious:

Open a terminal and paste this after game updates:


cd .local/share/Steam/steamapps/common/Age2HD cp "AoK HD.exe" "AoK HD.exe.backup" perl -pe 's/\x{80}\x{3C}\x{01}\x{01}/\x{80}\x{24}\x{01}\x{80}/g' <"AoK HD.exe">temp perl -pe 's/\x{5E}\x{0F}\x{97}\x{C0}/\x{5E}\x{0F}\x{95}\x{C0}/g' <temp>"AoK HD.exe" rm temp

< >
Showing 1-15 of 21 comments
Per page: 15 30 50

Age of Empires II (2013) > Support > Topic Details