ChaoticAlexander / helldivers2-stratagem-activator

A simple script for activating a stratagem command using simulated keyboard input
10 stars 3 forks source link

Key presses not registering #16

Open peterbuchberg opened 6 months ago

peterbuchberg commented 6 months ago

Hi - first of all, thank you for making this :)

However, I'm having issues getting it to work. I used the setting.exe file multiple times to try different combinations of stratagem key press/hold/toggle, and none appears to work for me. I have a Loupedeck Live S, and I have followed your setup guide to the letter. When I press any of my configured buttons, nothing happens in-game (If I'm luck the stratagem menu will open, but nothing else). I have tested the application via terminal and that way the key presses appears to register as expected.

In order to further test, I set up a keylogger on my machine, to record the keypresses registered when pressing a button on the loupedeck, and I have captured this:

wwwsss[CTRL][NUM 2][NUM 4][NUM 2][W][W][W][S][S][S][A][A][A][D][D][D][CTRL][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][ALT]

"wwwsss" is me setting a flag to look for in the log.

You can see from the following "[CTRL][NUM 2][NUM 4][NUM 2]" that part of the stratagem activation code is entered (Grenade launcher or AC I believe) and then nothing else.

"[W][W][W][S][S][S][A][A][A][D][D][D]" is me setting a new flag

"[CTRL][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R][R]" is the second attempt to activate via the loupedeck

"[ALT]" is me tabbing out of the Helldivers application.

After tabbing out, I noticed that CTRL appeared to be sticking in other application, which disappeared after I pressed the physical key a couple of times.

Let me know if there are any further information I could help provide. I would really like this to work :)

ChaoticAlexander commented 6 months ago

Hey! Thanks for the details! I'm aware of all the inconsistencies around this script and I've been busting my head trying to figure it out.

However, I'm away from my computer for a while, so I'll look into it again when I'm back home.

Thanks again, and I'll keep you posted regarding the progress of this.

ChaoticAlexander commented 6 months ago

Btw what keylogger are you using? The browser based ones I found online, as well as the one I created in python, all show the complete sequence so maybe if I use yours I might be able to debug a bit better

ChaoticAlexander commented 6 months ago

@peterbuchberg I think this issue has more to do with the loupedeck software and/or the execution rights of the script. Whenever I ran the script as admin, it worked 100%, but then I'd get the UAC dialog which is not really ideal.

Try running the loupedeck software as admin and see if that makes any difference. Also, something else to try out; set the stratagems.exe file to "run as administrator" and test it out just to confirm that this is indeed the issue. if the stratagem gets activated when running the script as admin, we'll make sure it's related to execution rights rather than the code itself.

in the meantime, I'll think of potential fixes or workarounds for this

peterbuchberg commented 6 months ago

Btw what keylogger are you using? The browser based ones I found online, as well as the one I created in python, all show the complete sequence so maybe if I use yours I might be able to debug a bit better

Thanks for your reply :) I used the one found at https://keyboardtracer.com/

Is it possible to setup this app up, the stratagem activator, so it logs its code execution step, akin to running with debug log enabled? I'm a .NET developer myself, had this been .NET I would just have attempted to run it with a debugger attached.

peterbuchberg commented 6 months ago

@peterbuchberg I think this issue has more to do with the loupedeck software and/or the execution rights of the script. Whenever I ran the script as admin, it worked 100%, but then I'd get the UAC dialog which is not really ideal.

Try running the loupedeck software as admin and see if that makes any difference. Also, something else to try out; set the stratagems.exe file to "run as administrator" and test it out just to confirm that this is indeed the issue. if the stratagem gets activated when running the script as admin, we'll make sure it's related to execution rights rather than the code itself.

in the meantime, I'll think of potential fixes or workarounds for this

I think you might be on to something. It aligns well with my experience running the app through the terminal with out any issues. I will go ahead and do some testing, and get back to you :)

peterbuchberg commented 6 months ago

Okay, I have done some testing. Running Loupedeck and/or stratagem activator as admin appears to have no effect. I have however found a couple of other things.

I have used the settings.exe app to set my key bindings to arrow keys. However when testing using the terminal, I noticed that numbers were outputted. After that I have changed my key bindings in-game to also be numpad-arrows instead of arrow keys. (I also checked, with the settings.exe app, and it writes the same settings to the .ini file regardless of whether arrow keys or numpad-arrows being entered. That might be a bug?).

This works in-game - sometimes. I did some more testing with the stratagem activator settings, and found a slower set of timings works better. This appears to be the fastest values I can set on my machine - any faster and keys are not registered/skipped:

open_mode = toggle delay_min = 300 delay_max = 400 press_time = 200

And still, often when I activate via the Loupedeck the stratagem menu opens in-game, but no keys are entered. I suspect there might be an issue with the delay between opening the menu and entering the first key - meaning keys might get entered before the menu is open/accepting input.

Other times the menu does not appear at all. I found that spamming CTRL (my open stratagem menu keybind) a couple of times appears to fix this. I'm not really sure why.

Still, I hope it is possible to setup debug logging, I would be very interested in knowing what is happening when activating the app :)

ChaoticAlexander commented 4 months ago

Haven't forgotten about this, I just don't have enough time lately to look into it