AM2R-Community-Developers / AM2R-Community-Updates

Source code for AM2R 1.5.2+, free of copyrighted assets and trademarks.
https://www.reddit.com/r/AM2R/
Other
138 stars 27 forks source link

[VM] Controller button layout is always shown #50

Open Miepee opened 3 years ago

Miepee commented 3 years ago

Describe the bug The controller button layout is always shown, even though no controller is plugged in.

To Reproduce Start the game, go to somewhere where button layout is shown.

Expected behavior Only keyboard button layout should be shown, since no controller is plugged in.

Platform (please complete the following information):

Game Version: 1.5.2

Notes: Someone try to repro this in a windows VM as well

Lojemiru commented 3 years ago

a) I recall an issue where you said your computer may have thought your graphics tablet was a controller - is this that one?

b) There might be an option you enabled to show button prompts even with keyboard. I need to double-check that before hunting this one down.

Miepee commented 3 years ago

a) I recall an issue where you said your computer may have thought your graphics tablet was a controller - is this that one?

It's not that my graphics tablet was plugged in, the VM created a virtual graphics tablet. Which happened on Windows Virtualbox with a mint 20.04 VM as well as on QEMU/Virt-manager with Fedora 33 But on QEMU/Virt-manager with an Ubuntu 14.04, Ubuntu 16.04, and OpenSUSE Leap 15.0 VM the "Only-display-controller-layout" issue still happens, but without a "graphics tablet" being plugged in.

Miepee commented 3 years ago

Not only is this a VM specific issue, it's also Linux VM specific. Tested it on a fresh Windows 10 VM on QEMU as well as on VirtualBox, it doesn't happen there.

FirEmerald commented 3 years ago

Certain gamepad API's can treat the keyboard and mouse as a gamepad - may be worth checking what the "name" of the controller is and then blacklisting it somehow.

Miepee commented 3 years ago

Checked it. On QEMU, device is called "QEMU QEMU USB Tablet" and is located at (/dev/input/js0) It only has one stick (it's x and y position relate to the mouse cursor) and 3 buttons (for LMB, RMB and MMB). EDIT: Pressing the "joystick" buttons or moving the "joystick" doesn't seem to affect the game though. Would need to test how it's called on VirtualBox, but I'd imagine it being called something similar.

Miepee commented 3 years ago

Finally checked this in VirtualBox now. There are actually two devices here. One, called "VirtualBox USB Tablet" which is located at /dev/input/js0 and another, called "VirtualBox mouse integration", which is lcoated at /dev/input/js1. JS0 is weird, because even though it has 5 buttons and a stick with an x and y axis, I cannot manipulate these in any way. JS1 on the other hand has one button and a stick with an x and y axis. The axis correspond to the mouse, but the button again doesn't seem to be manipulatable.

Further testing shows, that this might actually be a problem on how AM2R reacts to USB tablets. On windows, when tablets are plugged in, it doesn't react at all, while on linux, it reacts when I press my Tablet's buttons. However contrary to VM behaviour, it only shows these briefly, and not constantly. So a potential fix could just be, to blacklist USB tablets?

Miepee commented 3 years ago

And after even further testing, I found something that would potentially make this happen on real hardware as well. After getting the KDE controller plugin to work, I managed to see how the tablet actually reacts on this machine. It's called "GAOMON Gaomon Tablet Pad" and is located at /dev/input/js0. It has 12 Buttons(?) and one stick (my tablet only has 6 Buttons if you include the ones from the pen). I can only trigger buttons 4-7 and only one button can be active at a time. The interesting thing is though, that the joystick does not correspond to the mouse input. Instead, it's always at (0,0). I'm not sure if this is behaviour is due to my specific tablet, or if it's for all of them, but the inactivity of the joystick is probably the reason why it doesn't work on real hardware. Holding down any button on the tablet gets me the behaviour that this bug describes. Blacklisting usb tablets may potentially also fix other VM input related issues, like #49 .