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

[Bug] GYRO_ON activated by multiple buttons interfere with each other #77

Open PianoMastR64 opened 2 years ago

PianoMastR64 commented 2 years ago

I stripped down my config file as much as I could to demonstrate the issue:

RESET_MAPPINGS
VIRTUAL_CONTROLLER = XBOX

GYRO_OUTPUT = RIGHT_STICK
GYRO_ON = NONE
GYRO_SENS = 1

RIGHT_STICK_MODE = RIGHT_STICK

S = X_B\ GYRO_ON\
ZL = X_LT\ GYRO_ON\

When I press ZL, I can gyro aim. When I release ZL, gyro aiming turns off on its own, similar to any virtual button. Same thing for S. But, when I press ZL, then press and release S, gyro aiming turns off, even though I haven't yet released ZL. ZL↓ gyro on SS↑ gyro off ZL

I tried this slightly more complex sequence and got an interesting result: ZL↓ gyro on SZL↑ gyro off ZL↓ gyro on SZL↑ gyro off

If I set S and ZL, to the same virtual button like this:

S = X_LT\ GYRO_ON\
ZL = X_LT\ GYRO_ON\

or

S = X_LT
ZL = X_LT

then X_LT or any virtual button does not have this weird behavior. It seems like GYRO_ON should behave like any other button where if it's being pressed at all, it should just be on, otherwise it should be off.

If this isn't a bug, then one possible solution is to keep it as is, and have two new keywords GYRO and GYRO_HALT (or whatever), the former behaving like a button where its state is simply the logical or of all physical buttons it's assigned to, and the latter simply halting gyro only when pressed.

As of now, I have to include these additional assignments to prevent this interference for those who want a solution:

S = X_B\ GYRO_ON\
ZL = X_LT\ GYRO_ON\

S,ZL = X_LT
ZL,S = X_B

If I wanted to assign GYRO_ON to three buttons, I'd need 6 additional chords.

Electronicks commented 11 months ago

Hi. Thank you for reporting this issue.

So, the current behaviour is intended behaviour. When binding gyro actions in mappings, the active action is cleared on the first request to release it. This is to ensure responsiveness and avoid a situation when someone expects the gyro action to be properly released and wouldn't.

The good news is that your desired behaviour can be created with an existing system in place : the good old gyro button binding.

RESET_MAPPINGS
VIRTUAL_CONTROLLER = XBOX

GYRO_OUTPUT = RIGHT_STICK
GYRO_ON = ZL # not NONE
GYRO_SENS = 1

RIGHT_STICK_MODE = RIGHT_STICK

S = X_B\ GYRO_ON\
ZL = X_LT # also GYRO_ON button

The following will work as expected, and that is because the gyro button is processed at a higher level. Hopefully this helps resolve your issue.

Naturally, there can be only one gyro button, so it may be possible that having more gyro bindings can still have conflicts, but again, that is intended behaviour. at the present.