mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.29k stars 117 forks source link

Mouse activity in a game crashes Pegasus on Retropie #916

Open moosehadley opened 2 years ago

moosehadley commented 2 years ago

Issue description

Using the trackpad on a Sony DualShock 4 in a game causes Pegasus to crash

Steps to reproduce the issue

  1. Pair a DualShock 4 controller via Bluetooth
  2. Launch a game that uses the "mouse" (eg. DuckHunt for NES)
  3. Use the Trackpad to play the game (eg. Aim and shoot ducks)
  4. Close the game to see that Pegasus has crashed

Alternative:

  1. Pair a DualShock 4 controller via Bluetooth
  2. Launch any game
  3. Touch the trackpad
  4. Close the game to see that Pegasus has crashed

What's the expected result?

What's the actual result?

Additional details

In most cases, the game continues to run. You may need to exit the game to see that Pegasus is no longer running.

It makes no difference if the game being played actually uses the cursor, simply touching the trackpad will crash Pegasus. Enabling/Disabling "Mouse Support" within Pegasus does not have any affect on the issue.

This occurs in both alpha15-55-gb2834d3c and alpha15-85-gfff1a5b2, I have not tested any other releases.

Raspberry Pi 4 Linux retropie 5.10.63-v7l+ #1496 SMP Wed Dec 1 15:58:56 GMT 2021 armv7l GNU/Linux

Nothing is produced in the log when the crash occurs, the following appears in the console /usr/bin/pegasus-fe: line 16: 12112 Segmentation fault "/opt/retropie/supplementary/pegasus-fe/pegasus-fe" "$@" lastrun.log

moosehadley commented 2 years ago

Workaround You completely disable the trackpad to prevent crashes from accidentally touching it by creating a udev rule that sets the permissions of /dev/input/event0 to 000. However, this will prevent you from playing games that require it.

Disable Trackpad: echo ACTION==\"add\", ATTRS{name}==\"Wireless Controller Touchpad\", RUN+=\"/bin/chmod 000 /dev/input/event0\" | sudo tee /etc/udev/rules.d/10-disable-dualshock-mouse.rules && sudo udevadm control --reload-rules && sudo udevadm trigger

Re-enable Trackpad: sudo rm /etc/udev/rules.d/10-disable-dualshock-mouse.rules && sudo udevadm control --reload-rules && sudo udevadm trigger

mmatyas commented 2 years ago

Interesting, thanks for the report! Do you see the segmentation fault message when you return from the game? Does dmesg tell anything related to the controller? I assume this might be related to SDL2, will see if an update resolves it.

moosehadley commented 2 years ago

Interesting, thanks for the report! Do you see the segmentation fault message when you return from the game? Does dmesg tell anything related to the controller? I assume this might be related to SDL2, will see if an update resolves it.

The segfault appears in the console as soon as you touch the trackpad, but you can't see it while the game is running. If you touch the trackpad while runcommand is showing the "Press a button to configure" screen, you can briefly see it before the game starts. As soon as you exit the game, the console is cleared to display an error message from PS.

error: list of process IDs must follow -p

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).

If you launch pegasus from an ssh session, you can see the segfault message in your ssh terminal until the game exits, then the console is cleared to show the same PS error.

Here's what dmesg has to say about the controller.

[   50.372850] sony 0005:054C:09CC.0001: unknown main item tag 0x0
[   50.384136] input: Wireless Controller Touchpad as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:09CC.0001/input/input1
[   50.384554] input: Wireless Controller Motion Sensors as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:09CC.0001/input/input2
[   50.385569] input: Wireless Controller as /devices/platform/soc/fe201000.serial/tty/ttyAMA0/hci0/hci0:11/0005:054C:09CC.0001/input/input0
[   50.385781] sony 0005:054C:09CC.0001: input,hidraw0: BLUETOOTH HID v81.00 Gamepad [Wireless Controller] on dc:a6:32:5d:0a:0b
sabrecheeky commented 2 years ago

Can confirm this issue also affects my usb touchscreen, and is still present on latest retropie binary build (alpha15-94-geb44f4a1-dirty) dated 16/12/21.

Pegasus segfaults as described by @moosehadley on line 16 if the touchscreen is touched during the emulation. The UI of both amiberry and ppsspp emulators use the touchscreen unfortunately, and, for me, one of pegasus's many advantages over the default emulationstation frontend is its touchscreen compatibility!