Electronicks / JoyShockMapper

A tool for PC gamers to play games with DualShock 4s, JoyCons, and Pro Controllers. Gyro aiming, flick stick.
Other
332 stars 20 forks source link

[feature req] Hook/Plugin to detect Menus #104

Closed 80T closed 10 months ago

80T commented 10 months ago

If it's possible, a Plugin/Hook would be nice to have and be used to detect whether the game is inside a menu, or not, thus we can have context bindings (ex. motion/gyro enable bindings would work only when not inside a game's menu/map/etc.)

This would be helpful in games where KBM key bindings or a mouse cursor would conflict with gamepad/controller inputs.

Maybe this could be a per-game config deal, as the AutoLoad folder has for the bindings, so we could have per game bindings as we currently do, and on top of that also per game menu hook configs (where the game's required pointers would be stored)

80T commented 10 months ago

Ok, so after reading a bit through the Readme, it seems that what I want by "context bindings" would align with what in JSL acts as "Action Layers" which by default are already supported, but only manually, on demand, by configuration, but with this plugin/hook, the Action Layers would be automatically switched by context. Ex. inside the Menus/MapScreen/Inventory there would be a "Menu_Nav" layer, in the game world on foot there would be a "Base" layer and maybe in certain vehicles/boats there would also be Vehicle/Boat layers. That could help as in some games the buttons for movement and weapon aim/shoot might be conflicting. Ex. in RE4 REmake the Triggers are usually ADS/ATTACK on foot, while on the boat those are ACCEL/REVERSE. If the plugin would detect the player on foot or in a boat, the appropriate layers could be switched automatically. I am quite certain that this would be a per-game basis type of deal where we would need to experiment find the required "triggers" in memory that would account for the player state changes.

Electronicks commented 10 months ago

There is no way for JSM to know about the state of a game. Steam Input had a feature to switch action set upon detecting the cursor appearing or disappearing (some OS hook) which worked in some cases but usually involved KB+M only configurations. And then again it was flakey at times.

My recoommendation is to find ways to map the changing of context in your binding itself, for example: W = E # Interact W,W = "game_menus.txt" # load menu config on double tap

In game_menus.txt

E = !ESC\ "game.txt"_ # hold escape to exit the menu and load game config. or just tap for only escape

Also when dealing with mutiple configs, you can use the LIGHT_BAR setting on sony controllers to indicate which config you have on (and chord?).

80T commented 10 months ago

Oh, I guess this is outside the scope of JSM. Yes, I can think of ways to go around it with configuration, it's just that this would be what I was trying to avoid. Just because it might get confusing and complicated very fast. I am trying to get something more like.. "redistributable" and foolproof, where one could just "copy/paste" a config and anything else would be at the most difficult point intuitive. I think I'll have to figure something else. If it's even possible.