Author Topic: [Solved] Hotkey recognition stops working after some time  (Read 1235 times)

dlder

  • Newbie
  • *
  • Posts: 8
[Solved] Hotkey recognition stops working after some time
« on: January 31, 2025, 10:07:01 AM »
Ok, this is a very weird issue...

I have been playing DCS in VR and with Voice Attack for about 1,5 years. Mostly without any major problems, plus I have never encountered this bug.
Last time I've played DCS was about 2 months ago and everything worked.
A lot has changed since then...
Win11 thought it would be a good idea to install 24H2
DCS had an update.
VoiceAttack itself had an update (I am now on 1.15 64 bit); I always start "as Administrator".

Now to the problem at hand:
  • VoiceAttack works after starting DCS and launching a mission perfectly well; voice recognition is also working like before
  • but, after "some time" and/or mission restart, VA no longer responds to the keypress I send to it to start listening
  • when I pause the game and look at VA, it seems working fine and not crashed. It just won't recognize they keys anymore...
  • if I close VA and start it again, it works again (for some time)

Is there a log which I could enable and look through?
What could I try to debug this error? I've already tried a different keybind; didn't help.
before:
LCtrl + LWin + LShift + S

now:
LCtrl + LShift + LAlt + X

Cheers!
« Last Edit: February 08, 2025, 09:27:37 AM by Pfeil »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2846
Re: Hotkey recognition stops working after some time
« Reply #1 on: January 31, 2025, 01:59:17 PM »
This is generally indicative of another application taking priority over and or breaking VA's keyboard hook.  Restarting will then give VoiceAttack hook priority.  As you had indicated, this was all working fine before, so, something has changed in your setup.  You will want to take a look at what apps you have running and see if any of those apps are causing issue after being started (or are being activated after some time).

Just shooting from the hip here (I'm not at my pc at the moment) -  I can't remember if changing VA's profile resets the hook or not  -  you can try just changing to a different profile and back resets the hook.  If that works, you could possibly add an action to reset the current profile.  Opening the options screen might reset it as well.  Would save a full restart.  Again, just speculating.

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #2 on: February 01, 2025, 02:07:42 AM »
Hm... good point. Switching the profile and back. Will try the first thing.

It's just really odd, because all the apps I've running (and kinda needing playing DCS), VA worked without a hitch.

I'll try uninstalling and re-installing VA first. See if that does anything.

But is there no log file which could potentially lead me to the problem? I haven't found any setting, but maybe there's a default log written somewhere?

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #3 on: February 01, 2025, 05:47:17 AM »
Nothing helped so far.

Reinstalled VA.

Tried VA and all apps that I use in DCS, but in another game but it continued to work, even after a few hours of gameplay (I've tried the key combination every once in a while).

Then I started DCS again and, after restarting the mission 2 times, VA stopped working!!

I alt-tabbed to VA and tried the keybind "manually" (not via Joystick button and Joy2Key) and doesn't work. Then I switched profiles. Nothing.

I then tried:
  • unpluged Virpil Stick + Throttle + MP-UFC + Pedals
  • closed every app:
  • Joy2Key
  • XRNeckSafer
  • OBS
  • OpenKneeBoard
  • even DCS
  • Pimax HMD + Software

Still Nothing. The only thing that helped was closing VA and starting it again. And everything works again... This is fekking nuts!
Something in/with VA stops working with, I'd guess, Win24H2. That is the only combination I can think of why this problem might occur.

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #4 on: February 02, 2025, 12:37:35 AM »
So, having this issue sucks. I can't figure out what's to blame, as I have no way of debugging the issue.

I only know that only restarting VA helps.
It seems like the internal VA keyboard hook (or whatever) is crashing.

"Normal" voice commands - where no keypress is needed - work perfectly fine. It's only keypresses that are no longer recognized... on that note: maybe I can find a free button on my Hotas and bind it, see if that stops working also.

If it were DCS or Joy2Key though: it either would or wouldn't work. Meaning if DCS would block all access to the keyboard (which it kinda does), VA would never work.
And if there would be a problem with Joy2Key, it would be the same thing. Either Joy2Key would stop working entirely - no Hotas bindings would work anymore - or it's highly unlike the cause of the issue.


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4836
  • RTFM
Re: Hotkey recognition stops working after some time
« Reply #5 on: February 02, 2025, 07:13:41 AM »
Hooking keyboard input is a Windows API function.

VoiceAttack is instructing Windows to send keyboard input to it, and at some point Windows stops doing that.

Unfortunately Windows doesn't even notify the application that the hook has been removed, let alone why it has been removed.


The "Reset Keyboard Shortcuts" option of the "Windows Miscellaneous Functions" action can be used to reset the hook.
In theory this could be done periodically in a loop, but note that while the hook is being reset no input will be received, and that especially with higher system loads there may be a noticeable momentary "hiccup".


Something you could also try, though this is very advanced, and should not be attempted unless you are very familiar with modifying the Windows registry and the risks involved with that (I.E. this is wholly at your own risk), is to modify (or create; on my machine the data doesn't exist by default) the DWORD value "LowLevelHooksTimeout" under "HKEY_CURRENT_USER\Control Panel\Desktop".
There is no known default value, but the maximum is 1000 (one second); the value is in milliseconds.
You could try starting low and increasing, or just go for the maximum and see what the effects are (if any).

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #6 on: February 02, 2025, 09:47:07 AM »
The "Reset Keyboard Shortcuts" option of the "Windows Miscellaneous Functions" action can be used to reset the hook.
In theory this could be done periodically in a loop, but note that while the hook is being reset no input will be received, and that especially with higher system loads there may be a noticeable momentary "hiccup".
That sounds like a nifty idea; I'm currently doing it "the hard way":
  • Task Scheduler: start VA elevated
  • Task Scheduler: restart VA -> "kill VA" + "start VA elevated"
  • Voice Attack: voice command to restart va -> "restart VA"
  • Switch DCS window to front
That works pretty well.
But your solution wouldn't be such a big, convoluted step...


Something you could also try, though this is very advanced, and should not be attempted unless you are very familiar with modifying the Windows registry and the risks involved with that (I.E. this is wholly at your own risk), is to modify (or create; on my machine the data doesn't exist by default) the DWORD value "LowLevelHooksTimeout" under "HKEY_CURRENT_USER\Control Panel\Desktop".
There is no known default value, but the maximum is 1000 (one second); the value is in milliseconds.
You could try starting low and increasing, or just go for the maximum and see what the effects are (if any).
I'm pretty used to working in the registry, so I'll try it out the next time.

BUT:
As I said earlier, uninstalling VA and installing 1.15 again didn't help. But now I've installed the previous 1.14 and it worked perfectly in the last DCS session!
I'll know more next weekend, when I'll be able to play again, so I might need to use one of your tricks (would be cool if the registry thing worked, then I wouldn't have to restart/rehook anything).

I'll get back to you after my next session.

Thanks and Cheers!

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2846
Re: Hotkey recognition stops working after some time
« Reply #7 on: February 02, 2025, 07:59:34 PM »
Forgot about the 'reset shortcuts' feature.  Thanks, @Pfeil!

As a sanity check for myself, I took a code dive to make sure something wasn't changed between 1.14 and 1.15 that would involve shortcuts.  There were no code changes in that area, but, if that helps your situation then that's great!

(On a side note, not a whole lot changed between those versions, so, you're not too far off).

Let us know if you find anything that relates to this, especially if you happen to find a culprit app (would like to make others aware of it).

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #8 on: February 07, 2025, 07:56:39 AM »
Something you could also try, though this is very advanced, and should not be attempted unless you are very familiar with modifying the Windows registry and the risks involved with that (I.E. this is wholly at your own risk), is to modify (or create; on my machine the data doesn't exist by default) the DWORD value "LowLevelHooksTimeout" under "HKEY_CURRENT_USER\Control Panel\Desktop".
There is no known default value, but the maximum is 1000 (one second); the value is in milliseconds.
You could try starting low and increasing, or just go for the maximum and see what the effects are (if any).
I'm guessing that's 1000 in dezimal (as default is hex).

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4836
  • RTFM
Re: Hotkey recognition stops working after some time
« Reply #9 on: February 07, 2025, 08:06:36 AM »
It would be, yes.

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #10 on: February 07, 2025, 08:08:50 AM »
Code: [Select]
reg query "HKEY_CURRENT_USER\Control Panel\Desktop" /v "LowLevelHooksTimeout"

HKEY_CURRENT_USER\Control Panel\Desktop
    LowLevelHooksTimeout    REG_DWORD    0x3e8

Lets hope for the best :-)

dlder

  • Newbie
  • *
  • Posts: 8
Re: Hotkey recognition stops working after some time
« Reply #11 on: February 08, 2025, 09:25:41 AM »
Let us know if you find anything that relates to this
Well, the Registry fix did the trick it seems. Played several hours without Windows breaking the keyboard-hook!!
I've set it to 1000

edit: is there a way to mark this as "solved"?

edit2: here is the single CMD command to add/set this fix:
Code: [Select]
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "LowLevelHooksTimeout" /t REG_DWORD /d "1000" /f