Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAD: Add anti-deadzone #9154

Closed
wants to merge 1 commit into from
Closed

PAD: Add anti-deadzone #9154

wants to merge 1 commit into from

Conversation

KrossX
Copy link
Contributor

@KrossX KrossX commented Jul 3, 2023

Adds antideadzone to axes and triggers.

Anti-deadzone is a feature to overcome a game's deadzone while keeping usable range on the used controller. The way implemented is simply linear since you can remake the axes freely.

I was gonna add radial option but that means a toggle for linear/radial deadzone and another for antideadzone. Could be left for another PR. (Edit: #6718, I guess radial gotta be implemented. Booo~)

Also, when using radial values, there's a possibility to scale the value only when a threshold instead of always. It's the method I was using in Pokopom for x360 controllers to reach the corners while keeping most of the stick range usable.

Closes #9153

PS: I think some code change only affects UI/Binding and I doubt doing an anti-deadzone check is necessary there.

@KrossX KrossX marked this pull request as draft July 4, 2023 12:31
@github-actions github-actions bot removed the GUI/Qt label Jul 4, 2023
@KrossX KrossX marked this pull request as ready for review July 4, 2023 18:42
@KrossX
Copy link
Contributor Author

KrossX commented Jul 4, 2023

Alright, I think it's ready again.

There's a linear and radial method for both deadzone and anti-deadzone with a toggle setting. Both features remap the range so result might not reach the edges perfectly, a bit of scaling/sensitivity would do the trick.

I was considering linear deadzone being default since it's being applied to a remapped control instead of a known stick source. When mixing controls, radial deadzone can give some pretty odd feeling. Anyhow, since there's #6718, radial is the default then.

As for anti-deadzone, the usability would depend on how the game implemented its deadzone.

@KrossX
Copy link
Contributor Author

KrossX commented Jul 29, 2023

Rebase attempt.

Note: This PR needs testing with good gamepads.

@KrossX
Copy link
Contributor Author

KrossX commented Oct 10, 2023

Rebased.

Closing as I cannot test this changes and I'm too lazy to keep it updated. Here's a windows buildbot backup in case someome wants to test it.

PCSX2-windows-Qt-x64-SSE4-pr[9154]-sha[1c48727]-title[PAD Add anti-deadzone].zip

@KrossX KrossX closed this Oct 10, 2023
@m4ti140
Copy link

m4ti140 commented Oct 13, 2023

@KrossX I can test this with a flight stick in AC5, what do I need to check for?

@KrossX
Copy link
Contributor Author

KrossX commented Oct 13, 2023

No idea. First you would need to find a game with noticeable deadzone, then try the antideadzone setting.

Issue #9153 mentions Gran Turismo 3: A-spec with noticeable deadzone for pedals. So you would need to configure the pedals to some analog control and see if you notice a game deadzone, then try the antideadzone setting.

Other than that, just general usage of deadzone, antideadzone and scaling and check if things break.

@m4ti140
Copy link

m4ti140 commented Oct 14, 2023

@KrossX

  1. Is the trigger anti-deadzone supposed to work for both L1/R1 and L2/R2? They are both analog on DS2 and AC games make use of this to make throttle and rudder analog.
  2. Is the output logged, to check if exact numbers make sense?
  3. I can't test the feature for wheels because it's not there: wheels only have steering deadzone implemented, no antideadzone and nothing for pedals. If OP in [Feature Request]: 'Skip Deadzone' sliders #9153 is using wheel emulation (as I imagine he does, otherwise the game wouldn't recognize that a wheel is plugged in) then I guess that's a whole another issue (though the feature is needed for DS2 too, the deadzones are ridiculously big in some games, AC5 needs 50% anti-deadzone to completely cancel them)

From testing so far: Linear anti-deadzone seems to work fine, however unchecking linear deadzone results in weird behavior where diagonal movement is nearly impossible. Deflecting the stick partially in one axis and then trying to deflect it in another while keeping the same input in the original axis, causes the input in initial axis to reduce until hitting 0 near diagonal, and then input in the other axis is increased while approaching it. Also rotating the stick around the rim reveals the deadzones to be back in their original size. It's hard for me to even visualize what shape the deadzones are here, but they're definitely not gone even though linear completely eliminates them at same settings.

As for triggers: They seem to work fine, however as I said, only L2 and R2 have the anti-deadzone applied. It does behave as expected for them. All inputs might need this setting (though they also need sensitivity way more urgently - most games have 0 inner deadzone for buttons and bumpers anyway but plenty of outer deadzone, warranting sensitivity < 100%) since all buttons are pressure-sensitive on DS2 with exception of stick presses and inner function buttons. And if not, then at the very least the trigger settings should apply to R1 and L1 - there is no functional difference between them on DS2, they're both analog, and some games benefit from swapping them (for instance to get AC6 style analog throttle on triggers in AC5). Currently only deadzone is adjustable on per-button basis. But I guess this is another feature request altogether.

Also another bug altogether: it seems that deadzone for buttons and triggers does not remap the range - it skips it. When the trigger/button input crosses deadzone threshold, the output jumps straight to the value equal to input, e.g. if deadzone is set to 20%, instead of 0 input at 19% and 1% at 21% it will jump straight to 21% at 21%.

@KrossX
Copy link
Contributor Author

KrossX commented Oct 14, 2023

Trigger deadzone is applied to whatever triggers else if (IsTriggerKey(index)) here. So no idea.

There's no log, it would spam the console since it would get trigger per each input thing
per frame. There's a pad.elf that helps, but has no visual for sticks to check the linear/radial stuff. padtest_ps2.zip

This changes only affect the DualShock2 code, no specific code for wheels now that you mention it. I don't even know where that code is...

As for the last part about button deadzone... there's a section of code below analog/trigger which seems to do things but didn't touch it, maybe that's the thing.

Triggers should remap the range, so that's a bug I can try to fix in a bit.
EDIT1 fix attempt
EDIT2 build with fix: pcsx2-qtx64.zip

@m4ti140
Copy link

m4ti140 commented Oct 14, 2023

Ok, trigger deadzones now work fine.
Radial anti-deadzones still don't seem to work right (tested with gamepad as well to compare, setting radial antideadzone definitely makes the deadzones bigger at max input). Unless I misunderstand how exactly they're supposed to work. Though I frankly don't see the point of using them, linear anti-deadzone works fine. I guess I'd need to test it in some platformer.

EDIT: Tried Kingdom Hearts, same, linear works fine with smooth direction input along the rim once anti-deadzone is tuned, radial is just cursed, it's hard to get diagonal movement. Guess, it's linear in this game too.

@KrossX
Copy link
Contributor Author

KrossX commented Oct 14, 2023

You can check the difference between linear and radial here. When I tried with pokopom it was great for the x360 controller stick. This would be the idea:
super_graph.

See if radial works fine for deadzone though. If it does, great. For anti-deadzone, it would depend on what kind of deadzone the game uses since it's a compensation thing, also maybe some extra scaling helps. This would greatly benefit from a pad testing program that showed some graphics for the sticks.

@SixelAlexiS90
Copy link

@KrossX Hi! I'm really interested in an anti-deadzone setting for analog sticks in PCSX2, so this only works in the versions you built or there is a chance of having it in the latest versions of PCSX2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: 'Skip Deadzone' sliders
6 participants