WhiteMagic / JoystickGremlin

A tool for configuring and managing joystick devices.
http://whitemagic.github.io/JoystickGremlin/
GNU General Public License v3.0
306 stars 45 forks source link

Using EXE profile auto-switching produces erratic delayed input forwarding of axis #488

Open Linkandzelda opened 1 year ago

Linkandzelda commented 1 year ago

I've configured a number of profiles in Joystick Gremlin which forward physical devices to keyboard keys. Some of those bindings are axis to keys, others are just standard 1:1 buttons to keyboard keys. I've noticed some odd behaviour which only seems to show up when using and relying on profile switching by EXE.

The axis that I mapped just seem to be... heavily delayed? Sometimes up to 5+ seconds of moving the axis and nothing happening. Then it will catch up again, then it will delay again, etc. It doesn't seem to matter which axis or device either, essentially it's all of them.

The fix for this issue that I've been doing:

  1. Alt-tab out of the game
  2. Show the JG window
  3. Disable auto profile switching in settings
  4. Re-enable the current profile if not already enabled
  5. Return to the game

After doing this, everything works fine and there's no delays. The problem does not show up either when I first launch/show JG, select and enable my profile, then the launch the game.

I can't provide more info except that I'm still testing things and trying out if this is really the cause for this erratic behaviour.

WhiteMagic commented 1 year ago

The auto switching can't really cause any delay problems, all it does is stop the currently active profile (if any), load the designated profile, activate the profile. This is no different from you manually doing those steps and thus is not able to cause delays.

Scenarios I could think of that cause such behavior could be that the active foreground process is switching constantly on your system, this would cause the profile to be disable and re-enabled as that happens. Also as the profile switcher loads the profile from the given path, changes made to that profile which have not been saved won't be present. Another bit could be if you managed to get two rules matching the executable things could get interesting. Technically there are precedence rules in how Gremlin decides which profile to pick but I would not be surprised if odd issues could arise there and that could then cause constant profile switching.

Linkandzelda commented 1 year ago

I see, is there a way I can check if the foreground process is changing often, and if so what might be causing that to happen?

I checked my rules and there's only 1 for each EXE currently.

EDIT: I just checked the system.log, and I can see that when the foreground process changes there's an INFO line about finding an exact match for the process and returning the profile. In the instance I just tried the controls were not functioning correctly until an alt-tab, and this only produced 2 of those INFO lines. 1 for the initial launch, and one for the alt-tab out and in.

Linkandzelda commented 1 year ago

I just implemented a bat script to launch profiles using JG's command-line options, and disabled launching on startup and disabled profile switching. I wired up my game launcher to call the bat script, and set my profile on game launch. This has fixed the problems I described in this issue (controls working perfectly, after cold rebooting PC).

This bat script essentially does the same thing as what auto profiles should be doing, just externally. I still think there's something funky going on with the auto profile switching so I'm leaving this issue open!

WhiteMagic commented 1 year ago

Yeah, the log file would show this. However, I am unable to reproduce this problem when using the automated profile loading, nor have I ever heard of anyone suffering from this particular issue. So in all likelihood, this is something very specific to either your machine, setup, game, etc. and will not ever be fixed since I can't even reproduce it.