mgba-emu / mgba

mGBA Game Boy Advance Emulator
https://mgba.io/
Mozilla Public License 2.0
5.73k stars 794 forks source link

Steam Deck Gyro support (WarioWare Twisted) #2531

Closed aldelaro5 closed 2 years ago

aldelaro5 commented 2 years ago

This is mostly to document the lack of this and the other related issues with it.

Currently, mgba supports binding the gyro to 2 axises which typically would be one stick on a controller. This is fine if the hardware has no gyro, but is very inaccurate because the coordinate system used doesn't match what an actual gyro would do. This means that even using steam input on the deck to bind the gyro to a stick and then the stick to mgba's gyro, it's not going to work well (from my testing, it can partially work, but it's overall not really playable).

The solutions other emulators like citra does is they support DSU which is a protocol made to pass the sensor data via a server. There is support for this on the deck and it makes the gyro essentially perfect on citra. Endrift however did not wanted to add support to DSU and would rather want a direct access to the sensors.

That's essentially where we are. There is currently no way to play twisted using the hardware gyro. I know it can work because I actually been emulating gold on citra and the gyro is perfect.

sofakng commented 2 years ago

Thanks for the creating the issue and providing the information. I found it by looking for a way to play WarioWare Twisted on my Steam Deck as well.

Would it be possible for mGBA to add direct support for the Steam Deck gyro?

Is it possible to configure RetroArch to use the gyro?

ROMaster2 commented 2 years ago

Native support would be great, but you also can accomplish this through editing the controller settings through Steam. Set the gyro as an analog stick and bind it to tilt/gyro in mGBA.

aldelaro5 commented 2 years ago

Native support would be great, but you also can accomplish this through editing the controller settings through Steam. Set the gyro as an analog stick and bind it to tilt/gyro in mGBA.

Nope, I brought attention to this issue specifically because this doesn't work well. The issue is although it technically allows to use the gyro, it behaves improperly because the coordinates system makes it not work. It's even more odd on a stick itself, the gyro is BARELY better.

endrift commented 2 years ago

I still need to test exactly how well this works on the Deck, but it should work now. I'll give instructions for using it once I've tested it a bit better.

endrift commented 2 years ago

I have no idea how to actually use the gyro with games on the Steam Deck. It's just shaking wildly. None of these settings names mean anything to me.

endrift commented 2 years ago

It helps if I actually push the code.

Okay, so it controls like shit, but it works. You'll need to map both the gyro "X" and "Y" to be axis 3, which is left/right on the right joystick. Then you'll need to tweak the sensitivity...a lot.

sofakng commented 2 years ago

@endrift Thanks so much for working on this! What is this mapping? (the physical joystick to a gyro?)

I'm wondering if this is even possible without mGBA enabling game-specific hardware. If I understand correctly, the WarioWare Twisted cartridge contained a gyroscope. There was nothing in the GBA that supported this and I don't think the GBA would even be aware of the gyro.

I think the original request was to map the Steam Controller gyroscope (I think SDL supports this?) to the cartridge gyroscope.

endrift commented 2 years ago

Yes, this lets you directly map a gamepad axis value to the gyroscope value. Steam Input lets you (very confusingly) map a gyro to right joystick, axes 3 and 4, so using this you can use axis 3 to map lateral rotation to the in-game gyroscope (which only measures roll or yaw, depending on your perspective--in Steam Deck parlance it's yaw).

Keiggo commented 1 year ago

@endrift sorry to dredge this back up but I have absolutely no idea how to map the cartridge gyro X and Y controls! I can only find a controller map within mGBA. I assume I'm just being an idiot but can you point me in the right direction please?

spudpiggy commented 1 year ago

click the game pak sensors button

endrift commented 1 year ago

That works for some cases, but here you're going to want to set both of them to IIRC axis 3 to bypass the interpolation, or you'll need to edit the config file manually to set gyroAxisZ (I think that's the config var name--I'd need to double check)

sofakng commented 11 months ago

What's the current status of this?

I see there was a commit to a different repo (rtomasa) with seemingly additional changes but that repo itself is a fork of the libretro mgba core?

Just wondering what's the current best way to play WarioWare Twisted with the gyro on the Steam Deck :)

endrift commented 11 months ago

You will need to set up the gyroscope in Steam Input to map to the right stick, then go into the game pak sensor view (under Tools), then press the "set X" button under gyroscope, move the right stick left or right, then the "set Y" button and do the same. It should work after that.

Yes I need to add a better way to do this.