flyinghead / flycast

Flycast is a multiplatform Sega Dreamcast, Naomi, Naomi 2 and Atomiswave emulator
GNU General Public License v2.0
1.42k stars 170 forks source link

D-Pad Drift with Razer Kishi #338

Closed internetakias closed 3 years ago

internetakias commented 3 years ago

Platform / OS / Hardware: Android 11

Github hash: 3589e941

Hardware: Xiaomi Mi 10T Pro with Razer Kishi controller

Description of the Issue

While using the Razer Kishi in Flycast there's moments where the d-pad starts drifting on its own and it seems to be related to diagonal movements on the left analogue stick. I've only tested Sonic Adventure so far but the drift carries into Flycast's UI and unmapping the d-pad fixes the problem so it's an emulator issue rather than a game one. It's also not a hardware issue since this does not happen in other emulators and games.

Debugging Steps Tested

internetakias commented 3 years ago

If I unmap the left control stick but keep the d-pad mapped and hold down in some direction (both regular directions and diagonals) the camera in Sonic Adventure will still move a bit as if I'm using the d-pad, even though the stick isn't mapped to anything. I tested my controller with an app called Gamepad Tester and holding down the control stick doesn't have any effect on the d-pad (see pic, AXIS X and AXIS Y are the control stick, the d-pad is AXIS HAT_X and AXIS HAT_Y instead) so I think the problem is with Flycast. IMG_20210905_103157

flyinghead commented 3 years ago

Can you post the .cfg mapping file for your controller? it should be in the mappings folder.

internetakias commented 3 years ago

Here they are https://gist.github.com/internetakias/ea8f8b1f9366339f598f6514f3c594fd

https://gist.github.com/internetakias/d4777966dc8a71f88201c922f50f9afe

These are the default unmodified configs Flycast creates on its own. The right stick is mapped to the wrong axis for some reason and there's no way to remap it to the correct one, only unmap it.

internetakias commented 3 years ago

Here's my configs. I've remapped everything manually. D-pad issue happens with both configs though: https://gist.github.com/internetakias/bf7eb46686eb39f756a5f028a0622d17 https://gist.github.com/internetakias/0f7974e92ded925325763869be20e6a6

internetakias commented 3 years ago

Probably worth mentioning that the libretro core has no input issues with the Kishi, though I'm assuming that's because input is handled by retroarch and not the emulator.

flyinghead commented 3 years ago

I just pushed a fix on the net-rollback branch. I was able to reproduce the issue with a different gamepad (Xbox One) and it shouldn't happen anymore with this fix.

I would appreciate some feedback.

Edit: There is still an issue when remapping axes and it affects Android in particular. But the default mapping for axes should be better.

internetakias commented 3 years ago

Yeah, the d-pad issue is gone now, thanks. And yeah I noticed the axes remapping issue as well. In particular, every axes seems to map to Gas unless I move the sticks in a very particular way. Hope there's a way to fix that.

flyinghead commented 3 years ago

The axis mapping issue on Android should be fixed in the latest net-rollback build. There's been other significant changes in this area so feedback is welcome.

internetakias commented 3 years ago

Mapping seems to work fine except the triggers don't register as analog anymore, (they register as L2/R2 instead of GAS/BREAK and no matter how I press them the result is the same.)

internetakias commented 3 years ago

Found a way. If I hold down the trigger before pressing Map and let go once the dialogue comes up the triggers register as GAS+/BREAK+. Though, I also noticed a weird thing where if you map the trigger using this trick to one of the Thumbstick directions, Gas or Break+ will become mapped to it but Gas or Break- will also become mapped to the opposite direction but only if it's unmapped. For example, if I map the left trigger using this trick to Thumbstick Up, Thumbstick Up becomes Gas+ and Thumbstick Down becomes Gas-, even though I was only mapping Thumbstick Up.

flyinghead commented 3 years ago

This is an unfortunate consequence of mapping buttons and axes at the same time: on some controllers, triggers act as both buttons and axis. This is the case for DualShock 3 and 4 at least. The trick you used (pressing the trigger before mapping and releasing it once the dialog appears) works great for DS 3 also so it's good to know.

Now that you need to map half axes instead of full axes, Flycast will automatically map the opposite half axis if it's not mapped yet. However this shouldn't happen for triggers since they are half axes and have no opposite. I'll fix that but for now you can just unmap the trigger- axes. They are ignored anyway.

flyinghead commented 3 years ago

Assuming fixed. Reopen as needed.