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

[BUG]: Mapping the emulator's dpad/shoulder/triggers to controller sticks cause ghost input #7881

Open
simifor opened this issue Jan 14, 2023 · 25 comments

Comments

@simifor
Copy link

simifor commented Jan 14, 2023

Describe the Bug

Input will be detected as though the sticks were being pressed, when they are not. It's not drifting, and no actual input is being detected by the emulator (OSD also shows no input when the controller is idle) yet the game reacts as though it's detecting something. Issue happens even if dead zones are set to high values like 0,95, and happens with both agit compiled version and the appimage from the website.

Another user tested this and had the same issue, so it isn't exclusive to my setup.

Reproduction Steps

  • Configure the emulator's dpad/shoulder/trigger. For example, just mapping the dpad to the left stick of your controller should be enough to reproduce.
  • Start the game.
  • Ghost input should be apparent (in my case, the game acts as if I was holding dpad up, while input OSD will be empty during this)

Expected Behavior

Games should only react when the sticks are actually held.

PCSX2 Revision

v1.7.3888

Operating System

Linux (64bit) - Specify distro below

If Linux - Specify Distro

Arch Linux

@simifor simifor added the Bug label Jan 14, 2023
@simifor
Copy link
Author

simifor commented Jan 16, 2023

Here's a video with Sly Cooper, the OSD shows when I move the sticks, but even when neutral and undetected the menu option selector keeps moving.

sly.cooper.mp4

@Toastarrr
Copy link
Contributor

I've managed to replicate the OSD not showing inputs, but they weren't ghost inputs. You might have drift that isn't being shown.

Have you set both Analog and Button/Trigger deadzones? The analog dead zone is only used when mapping to the analog sticks and won't have any effect when mapping to buttons/triggers.

@simifor
Copy link
Author

simifor commented Jan 17, 2023

I did, or rather, I thought I did, but the settings must not have applied as I re-tested with your prompt and it does prevent this. That being said, I am 99% sure that this isn't a stick drift issue for the following two reasons:

  1. No software I've tried detects any input whatsoever from the stick (this includes gamepadtester, antimicrox, jstest-gtk and pscx2 itself)

  2. the controller's own settings actually allow swapping the dpad and left stick, this makes it so devices connected to the controller think the dpad is a stick and the stick is a dpad (this is useful for games where you can't rebind them). So I changed my controller settings so that the dpad is recognized as a stick and vice versa, then went to pcsx2 and configured only the dpad by using the controller's dpad (which gets recognized by pcsx2 as a stick) and start button, and I can still reproduce the sly cooper issue.

For the sake of clarity, I'll repeat with different wording. Using my digital dpad for sly cooper, it will still have ghost inputs when idle and the osd detects nothing simply because pcsx2 THINKS they are sticks.

Using dpad in controller when they are masked as sticks = ghost input. Using dpad in controller without masking them as sticks = no ghost input.

Basically, if SDL detects sticks being used for digital buttons there will be ghost input, regardless of actual sticks being in use.

@simifor
Copy link
Author

simifor commented Jan 27, 2023

@refractionpcsx2 as explained here #7912 (comment) that MR doesn't fix the issue because drift isn't causing my issue (it happens with the dpad as well). Tested against current master f73b497 and the exact same issue as here #7881 (comment) still happens without the osd reporting anything.

@refractionpcsx2
Copy link
Member

okay, I reopened. I didn't physically close this, it was mentioned in the PR OP so it auto closes when I merge.

@Toastarrr
Copy link
Contributor

okay, I reopened. I didn't physically close this, it was mentioned in the PR OP so it auto closes when I merge.

Ah, my bad. I didn't know that would happen.

as explained here #7912 (comment) that MR doesn't fix the issue because drift isn't causing my issue (it happens with the dpad as well). Tested against current master f73b497 and the exact same issue as here #7881 (comment) still happens without the osd reporting anything.

Can you post a pic of your bindings and tell me what controller you're using? Does this still happen with other controllers or is it just one?

@simifor
Copy link
Author

simifor commented Jan 27, 2023

I'm using an 8bitdo pro 2, I have no other controller I can use right now.
PCSX2 Controller Settings
Note that this happens when using both the controller's stick, and the d-pad (when spoofed to act as a stick, which is why the bindings itself registered it as a stick in the image).

@Toastarrr
Copy link
Contributor

Toastarrr commented Jan 27, 2023

Using that setup, do you see any inputs show up on the OSD if you actually press something on the d-pad? What about the stick? I'm wondering if the OSD might not be checking the right button for input since they're swapped.

@simifor
Copy link
Author

simifor commented Jan 27, 2023

It detects dpad input, but only when I'm actually pressing it

@simifor
Copy link
Author

simifor commented Jan 27, 2023

Here's a comparison for the OSD, when I'm using the sticks as stick
Sly Cooper and the Thievius Raccoonus 2023-01-27_15:20:05

When I'm using dpad as sticks
Sly Cooper and the Thievius Raccoonus 2023-01-27_15:20:16

(I had to actively press them in order to get the osd output, otherwise it'd be empty, despite the menu options cycling on their own).

@Toastarrr
Copy link
Contributor

Toastarrr commented Jan 27, 2023

Thank you for the info. I was able to replicate ghost inputs again. The fact that it's displaying 0.00 here means the value is too precise to be shown, but greater than 0. Maybe there's some kind of rounding/float error happening here?
image

@simifor
Copy link
Author

simifor commented Jan 27, 2023

at least in my case, there's nothing shown, just like in the uploaded video, just "P1 |" when stick/dpad isn't held. So it does sound like there's a rounding error on your side.

@Toastarrr
Copy link
Contributor

There actually is a problem where the pressure is too precise to be displayed (1/255 = 0.003921568627451), but I'm currently trying to figure out what's actually causing perceived analog stick input to jump rapidly between 0 and the next smallest number.

I thought it might just be normal, but given what you said about disguising the d-pad as a stick, I wonder if there's actually a bug somewhere in the code for sticks.

@simifor
Copy link
Author

simifor commented Jan 27, 2023

Ok so more testing. using dpad spoofed as sticks.

I started pscx2 again and there was initially no menu shuffle, but after pressing up it started shuffling even after letting go (of course, nothing appeared in the osd after letting go). Restarting the game from this point caused the menu shuffle even without having tapped the dpad, but closing the game and opening it again had the menu NOT SHUFFLE until pressing the dpad.

In order to test more, I tried a few wother configurations, configuring ONLY dpad up + start still had the same issue, but configuring ONLY dpad down + start didn't. Then I tried to set the controller's dpad up as emulator's dpad down, and with that the menu shuffle'd downwards.

So thus far the ghost input's seems to happen when the emulator detects an UP from my dpad.

Edit:

So I tested the sticks one at a time, they both showed the same, the game has no menu shuffle, if I move the stick up the shuffle starts, but only when using UP. Dpad up, left stick up, and right stick up all cause the ghost input and apparently nothing else (down, left, right).

Also, if the stick is spoofed as dpad, the ghost input won't manifest.

  • If I reset (system→reset) the game after the ghost input begins, the ghost input persists.
  • If I save a state before the ghost input begins, then I press up (to start the ghost input) and load the state, the ghost input will persist.
  • If I save a state AFTER ghost input begins, and stop the game (system→shut down), and load the state, there will be no ghost input (until I press up).

Basically, up on dpad (spoofed as stick), or up on either of the sticks (unspoofed) will make the ghost inputs manifest and it persists until the game is shut down.

@simifor
Copy link
Author

simifor commented Jan 27, 2023

So, in an effort to summarize:

Ghost inputs (nothing pressed in the controller results to the game acting as if a button is being held) can happen with certain controller configurations in PCSX2. The following trigger the ghost input when mapped to the EMULATOR's DPAD(Possibly also happens with other buttons, currently untested):

  • DPAD UP, when the DPAD is configured to spoof* a stick.
  • Left stick UP.
  • Right stick UP.

*The controller has its own software that lets you swap the DPAD with the stick, making the controller present its DPAD as the left stick, and the left stick as the DPAD.

The ghost input won't trigger with following configurations:

  • DPAD isn't spoofed (so pcsx2 sees it as a dpad).
  • Left stick when it's spoofed as the DPAD.

The ghost input stops when:

  • The game is stopped from system → shut down

The ghost input isn't affected by:

  • Resetting the game (System → Reset)
  • Saving or loading states previous or after ghost input gets triggered.

@Mrlinkwii Mrlinkwii added the PAD label Feb 1, 2023
@Danhanado
Copy link

Getting similar issues here, in my case, i've got a custom arcade stick (so definitely not real drift) that defaults to acting as the left stick, trying to map these left stick inputs to the dpad results in the infinite ghost inputs, doesn't matter whether it it's inverted or only positive and negative. This only happens with SDL source as the same mappings using XInput source does not yield any issues

@skystar96
Copy link

I managed to solve the problem: before setting up the controller, I turned on the analog

@coornio
Copy link
Contributor

coornio commented Jun 30, 2023

Shot in the dark: have you tried adjusting the deadzone at all? While atypical, some games have no threshold themselves when it comes to filtering analog input in places like menus, and their catch is basically a "do X if input != 0". See the picture below, raise that percentage a tiny bit, check if your troubles go away.

image

@simifor
Copy link
Author

simifor commented Jul 26, 2023

I've tested again (f81d391 and 9d3cd57, both behaved the same as far as I could see) and have some good news. While the issue is technically still there, the game ignores the ghost inputs so they aren't an issue in practice. I've also noticed a few things: Analog Sensitivity (AS) seems to be the main culprit.

AS set to 115% (and anything higher), Analog Deadzone (AD) set to 99% has the hud printing info about them moving in really small movements (0.01), this happens even when using the digital dpad as the stick, it's detecting movements that aren't there.
AS set to 114%, AD set to 0% has the hud display nothing when idle, as expected.

Also, while I didn't test this much, when I set AS to 100%, I noticed that holding either the sticks or the dpad (set as the stick) the hud would briefly show 0.99 at random.

Should I close this as this is no longer an issue in practice, or should I leave it open in case someone wants to look at the rounding oddity?

@kamfretoz
Copy link
Contributor

Can't reproduce here, buttons been bind correctly and there's no ghosting. tested on Arch and PCSX2 v1.7.5095

Screenshot_20231010_221013

@stenzek
Copy link
Member

stenzek commented Oct 10, 2023

Tbh I suspect this is working as intended - DPad has both pressure and a bitmask indicating which buttons are pressed, and any non-zero pressure, even 1/255 will set the corresponding bit in the mask (real DS2 controllers are the same). Games tend to use the bitmask, not the pressure.

The only real way to solve this would be to have a "use analog stick as dpad in digital mode" option, like I do in DuckStation, and in that mode, make stick >= 0.5 to set the button bit. But that's a feature request, not a bug ;)

@KrossX
Copy link
Contributor

KrossX commented Oct 10, 2023

Or some deadzone and then you could still use the stick for pressure values... for some reason.

@Suni23
Copy link

Suni23 commented Apr 22, 2024

Trying to play Eternal Ring by mapping the D-pad and shoulder buttons to analog sticks, and I'm still having this issue as well. Increasing the deadzone does nothing.

@Yasand123
Copy link

I have this issue as well, I was also trying to remap Eternal Ring buttons to use the right analog sticks to control the camera and the left to control the movement.

@Suni23
Copy link

Suni23 commented May 4, 2024

I have this issue as well, I was also trying to remap Eternal Ring buttons to use the right analog sticks to control the camera and the left to control the movement.

I figured it out, you have to set your button/trigger deadzones, I believe I set mine to 20%

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

No branches or pull requests