DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.18k stars 39 forks source link

App rapidly scrolling through menu potions without input #257

Closed matthewh626 closed 1 year ago

matthewh626 commented 1 year ago

Please fill out following when reporting a new bug:

Describe the bug
GUI app is rapidly scrolling through menu options with no input from the user

To Reproduce
Steps to reproduce the behavior: error is occurring once the application launches, can bee seen; on the dropdown list for runners in the version list in the game list and possibly more locations

Expected behavior
The app only more the selection based on user input

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context
tried uninstalling and reinstalling to no avail, system is not reporting any pending updates no other app experiencing issues

Terminal output

ProtonUp-Qt 2.8.0 by DavidoTek. Build Info: Official AppImage by DavidoTek.
Python 3.8.2 (default, Mar 13 2020, 10:14:16) [GCC 9.3.0], PySide 6.2.4
Platform: Nobara Linux 37 (KDE Plasma) Linux-6.3.7-200.fsync.fc37.x86_64-x86_64-with-glibc2.29
Loading locale en / en_GB
Loaded ctmod GE-Proton
Loaded ctmod Wine-GE
Loaded ctmod Boxtron
Loaded ctmod D8VK (nightly)
Loaded ctmod Kron4ek Wine-Builds Vanilla
Loaded ctmod Lutris-Wine
Loaded ctmod Luxtorpeda
Loaded ctmod NorthStar Proton (TitanFall 2)
Loaded ctmod Proton Tkg
Loaded ctmod Proton Tkg (Wine Master)
Loaded ctmod Roberta
Loaded ctmod Steam-Play-None
cat: /etc/lsb-release: No such file or directory
Loaded ctmod SteamTinkerLaunch
cat: /etc/lsb-release: No such file or directory
Loaded ctmod SteamTinkerLaunch-git
Loaded ctmod vkd3d-lutris
Loaded ctmod vkd3d-proton
Loaded ctmod Wine Tkg (Valve Wine)
Loaded ctmod Wine Tkg (Vanilla Wine)
Loaded ctmod DXVK
Loaded ctmod DXVK Async
Loaded ctmod DXVK (nightly)
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
sonic2kk commented 1 year ago

This part of the output looks particularly interesting:

QCoreApplication::postEvent: Unexpected null receiver

This does not seem normal, but I am not sure what could be causing it. Maybe something is wrong with Qt here.

postEvent is used for gamepad support I believe, such as in press_virtual_key in pupgui2. Do you have a gamepad connected, by any chance?

matthewh626 commented 1 year ago

oh i do it hadn't occurred to me because i leave it plugged all the time let me try that

EDIT: it was that, im leaving it open in case controller incompatibility is something you want to address when looking around i found that people has a similar problem wile on steam deck, actually my brother has one let me check on his

EDIT 2: it does not affect the deck the same way (behaves as expected)

sonic2kk commented 1 year ago

My Steam Deck works as expected last time I tried, very interesting...

it was that, im leaving it open in case controller incompatibility is something you want to address

Thanks, it is something that should probably be addressed. I couldn't replicate with my Switch Pro Controller (plugged in, and in regular and virtual gamepad mode with joycond). My Steam Controller also seems to work fine. However, I am using Wayland, and likely for that reason, controller support does not work for me in general (never tried on Steam Deck...). @DavidoTek would be better positioned to comment on potential issues with controllers.

Out of curiosity, what controller are you using that causes the issue, and do you have any others you could try with?

matthewh626 commented 1 year ago

im using a bog standard usb aftermarket xbox controller from game stop, the only thing that looks like a model number is B8-070 on the sticker on the back

EDIT: i tried an aftermarket usb switch pro controller and it doesnt spaz out, but it doesnt really respond sencably either it mostly ignores it unless out spin the control stick or use the d-pad(which seems to work fine)

sonic2kk commented 1 year ago

With your non-working controller, if you use Steam can you check if this happens with and without Steam running? Notably check to ensure your controller is recognised by Steam and can be wrapped by Steam Input (i.e. in Big Picture Mode and in a game).

Sometimes Steam can to weird things to controllers, though there is probably a deeper issue here if s Switch Pro Controller works for you. It doesn't for me but I would chalk that up to Qt and Wayland.

sonic2kk commented 1 year ago

I had a look at QCoreApplication.postEvent, and it seems the Receiver that is null is the first argument, which is QApplication.focusWidget(). I am guessing that if the error is yelling that it's null then on the Python side it's None. Maybe in press_virtual_key we could check if QApplication.focusWidget() is truthy.

It probably won't make the controller work but it may stop the rapid scrolling behaviour. My controllers don't work (Steam Controller (tested with Steam's driver and SC-Controller) and Switch Pro Controller) and I'd put that down to Wayland rather than ProtonUp-Qt, so this approach would need tested by someone other than me :sweat_smile:

DavidoTek commented 1 year ago

though there is probably a deeper issue here if s Switch Pro Controller works for you.

Hmm, that kinda sounds like joystick drift/a stuck input on your controller to me... Though small drift should be ignored by our code (if event.state > -100 and event.state < 100:)

I had a look at QCoreApplication.postEvent, and it seems the Receiver that is null is the first argument, which is QApplication.focusWidget(). Maybe in press_virtual_key we could check if QApplication.focusWidget() is truthy.

Ah, that makes sense. I wonder how it's scrolling if nothing is focussed. Interesting

sonic2kk commented 1 year ago

In addition to my comment asking to test with/without Steam, you should also check Gamepad Tester with/without Steam to see what input comes back. This should help a little in determining if the issue lies with the controller and/or Steam Input wrapping.

matthewh626 commented 1 year ago

ok so ive tested it out with steam open and steam closed, its fine with steam closed but it still spazzes with steam open, the gamepad tester shows that the highest stick value with no input is axis 2 with 0.011 so idk if that is high enough to trigger menu movement.

EDIT: the gamepad tester values didnt change with steam open or closed

sonic2kk commented 1 year ago

its fine with steam closed but it still spazzes with steam open

Very interesting, it seems like however Steam is wrapping your controller is doing it weirdly. Controller weirdness with Steam open/closed is something I have experienced when playing around with emulators though that is usually around button mapping and not phantom inputs.

If you're not using the Steam Beta it might be interesting to try it in case it has some extra SDL controller mappings, though since a release just came out I don't expect that to have much impact.

Since the values on Gamepad Tester didn't change with Steam opened or closed, I would guess 0.011 is fine. What might be happening is Steam Input sees it as enough to trigger movement, but whatever the regular system driver is does not.

Maybe this is a silly question but has this controller caused you issues in any games? Does it exhibit any strange behaviour in Steam Big Picture?

matthewh626 commented 1 year ago

i havent been having issues with the controller when playing games (played through hi-fi rush the other week) i dont use big picture mode very ofter but it doesnt have any issues either and the beta didnt help,

I did a bit more fiddling around and it seems like there is little to no deadzone for the (left stick down) input for the app, if i watch the gamepad tester and apply a tiny bit of pressure untill the axis 2 input goes to 0 its stops but it seems that the app is even more sensitive than the gamepad tester because i could get the app to react before the tester even though it was displaying 5 decimal places

sonic2kk commented 1 year ago

I was trying to troubleshoot to see if I could figure out what was up here, but as it turns out on my system, inputs.get_gamepad() hangs. Tried with my Steam Controller (with/without SC-Controller and with/without Steam opened), and my Switch Pro Controller (with/without virtual gamepad mode, with/without Steam opened) and couldn't make any progress. With a regular Python 3.11 install, python3 -c "import inputs; inputs.get_gamepad()" causes a hang as well. This is likely (almost certainly) an upstream bug, potentially related to https://github.com/zeth/inputs/issues/7, but I'm not familiar enough with inputs to comment. It may also be related to Wayland, as this library likely predates any efforts for Wayland controller support.

Having said all that, the issue with the controller does seem to be related in some way to the deadzone. Maybe the value for the axis needs to be adjusted. I am not sure what "units" the 100 and -100 axis values refer to, it is possible they're too low though.

DavidoTek commented 1 year ago

[...] inputs.get_gamepad() hangs zeth/inputs # 7

Yes, inputs.get_gamepad() is blocking. That was causing an issue when closing the app a while ago: https://github.com/DavidoTek/ProtonUp-Qt/issues/42 Sadly, there isn't any real alternative. It shouldn't be a problem though as it is running in a separate thread.

I am not sure what "units" the 100 and -100 axis values refer to, it is possible they're too low though.

Values are between -32768 and 32767. I guess we could increase them if that causes a problem. Even a slight movement on my gamepad causes them to be above 2000.

DavidoTek commented 1 year ago

Can you run following command in a Terminal and share the output with us? @matthewh626 It will print values when moving the joystick and should return to zero if it is in the middle.

flatpak run --command=python3 net.davidotek.pupgui2 -c "import inputs; [[print(e.code, e.state) for e in inputs.get_gamepad()] for i in range(1000)]"

matthewh626 commented 1 year ago

its a bit of a waterfall of text but, here is what i got; (all just snippets because its just a constant flow) steam open not touching controller:

EDIT: redid the steam closed moving stick test, as it matched the non moving tests (probably a copy/paste mistake with the outputs)

ABS_X -95 SYN_REPORT 0 ABS_X -97 SYN_REPORT 0 ABS_X -99 ABS_RY -111 SYN_REPORT 0 ABS_RY -109 SYN_REPORT 0 ABS_Y 588 SYN_REPORT 0 ABS_Y 585 ABS_RY -111 SYN_REPORT 0 ABS_Y 587 ABS_RY -113 SYN_REPORT 0 ABS_RY -110 SYN_REPORT 0 ABS_X -95 SYN_REPORT 0 ABS_X -92 ABS_RY -112

Steam closed no input:

SYN_REPORT 0 ABS_X -97 SYN_REPORT 0 ABS_X -99 ABS_RY -111 SYN_REPORT 0 ABS_X -95 ABS_RY -109 SYN_REPORT 0 ABS_X -92 ABS_RY -111 SYN_REPORT 0 ABS_X -95 ABS_RY -113 SYN_REPORT 0 ABS_X -97 ABS_RY -110 SYN_REPORT 0 ABS_X -99 ABS_RY -112 SYN_REPORT 0 ABS_RY -109 SYN_REPORT 0 ABS_RY -111 SYN_REPORT 0

steam closed moving stick:

SYN_REPORT 0 ABS_Y 1332 SYN_REPORT 0 ABS_RY -248 SYN_REPORT 0 ABS_Y -8144 ABS_RY -250 SYN_REPORT 0 ABS_X 18020 ABS_Y -32768 SYN_REPORT 0 ABS_X -862 SYN_REPORT 0 ABS_X -2647 SYN_REPORT 0 ABS_X -15562 SYN_REPORT 0 ABS_X -27616 ABS_Y -30958 SYN_REPORT 0 ABS_X -29779 SYN_REPORT 0 ABS_X -22828 ABS_Y 1368 SYN_REPORT 0 ABS_X -12202 ABS_Y 14562 SYN_REPORT 0 ABS_X -2668 ABS_Y 26298 SYN_REPORT 0 ABS_X -421 ABS_Y 32767 SYN_REPORT 0 ABS_X 595 SYN_REPORT 0 ABS_X 3128 SYN_REPORT 0 ABS_X 11594 SYN_REPORT 0 ABS_X 19023 SYN_REPORT 0 ABS_X 25262 SYN_REPORT 0 ABS_RY -247 SYN_REPORT 0 ABS_X 31331 ABS_Y 27954 ABS_RY -245 SYN_REPORT 0 ABS_RY -247 SYN_REPORT 0 ABS_X 32767 ABS_Y 21618 ABS_RY -249 SYN_REPORT 0 ABS_Y 14418 SYN_REPORT 0 ABS_Y 5778 SYN_REPORT 0 ABS_RY -246 SYN_REPORT 0 ABS_Y 1008 SYN_REPORT 0 ABS_RY -248 SYN_REPORT 0 ABS_Y -9912 ABS_RY -250 SYN_REPORT 0 ABS_RX 210 SYN_REPORT 0 ABS_X 31076 ABS_RX 207 SYN_REPORT 0 ABS_RX 209 SYN_REPORT 0 ABS_Y -32768 SYN_REPORT 0 ABS_X -17662 SYN_REPORT 0 ABS_X -28561 SYN_REPORT 0

steam open moving stick:

SYN_REPORT 0 ABS_RY -299 SYN_REPORT 0 ABS_Y -32768 ABS_RY -301 SYN_REPORT 0 ABS_RY -298 SYN_REPORT 0 ABS_X -20602 ABS_RY -296 SYN_REPORT 0 ABS_X -28729 SYN_REPORT 0 ABS_X -32768 ABS_Y -28595 SYN_REPORT 0 ABS_Y -17035 SYN_REPORT 0 ABS_X -31963 SYN_REPORT 0 ABS_RX 206 ABS_RY -284 SYN_REPORT 0 ABS_Y 3978 ABS_RX 204 ABS_RY -281 SYN_REPORT 0 ABS_RX 207 ABS_RY -283 SYN_REPORT 0 ABS_X 2040 ABS_Y 15750 ABS_RX 209 SYN_REPORT 0 ABS_RY -280 SYN_REPORT 0

PS: "moving stick" is doing full circles, with the left stick only

sonic2kk commented 1 year ago

ABS_RY having values around -100 with no input, if I'm reading the response correctly, may indicate that the tolerance in the code is too low, and is detecting input erroneously, probably down input since it's -100, which matches the issue description. Interesting!

DavidoTek commented 1 year ago

ABS_RY having values around -100 with no input, if I'm reading the response correctly, may indicate that the tolerance in the code is too low, and is detecting input erroneously, probably down input since it's -100, which matches the issue description. Interesting!

Yes, that seems to be the issue.

I think we can merge #259. That should solve the issue for matthewh626 and maybe others. I think a deadzone of 1800 (5.5%) seems like a good choice.