mgba-emu / mgba

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

[Feature request] Solar sensor emulation via ambient light sensor on the Steam Deck #2524

Open mowmibatman opened 2 years ago

mowmibatman commented 2 years ago

Kindly please consider making mgba able to set the current solar sensor level for Boktai games based on data from the ambient light sensor on devices equipped with it, like the Steam Deck. This is already a working feature in My Boy! for Android.

endrift commented 2 years ago

Solar sensor is already emulated, but no devices mGBA runs on have an (accessible) ambient light sensor. I would need to look into how to query it on the Deck to hook into mGBA.

mowmibatman commented 2 years ago

Thank you for your instant reply. I am well aware of manual solar sensor emulation. Thank you for considering the feature.

As for devices with an accessible ambient light sensor, it is known to be accessible on some Asus and Dell notebooks. This might not be helpful for Deck compatibility, but technically the feature could be supported on those laptops. https://github.com/mikhail-m1/illuminanced

shenef commented 2 years ago

By default SDL seems to expose only the Accelerometer and Gyroscope but the SDL documentation mentions that "Additional sensors may be available, using platform dependent semantics.". So if we are lucky the Light Sensor is exposed in the same way. Unfortunately i don't have access to a Steam Deck to test it. https://wiki.libsdl.org/SDL_SensorType

endrift commented 2 years ago

I've figured out a way to access the light sensor, via sysfs, but it's not a very friendly one. Using Linux iio APIs might be better, but I don't know them

dogtopus commented 2 years ago

Also, in addition to IIO, a nice to have would be allowing the user to map the solar sensor to an HID axis, so it would allow DIY USB/Bluetooth solar sensors that only allow UV like the original one. This is already the case for tilt and gyro sensors but not for solar sensor.

whitt-e commented 1 year ago

I would also love this if it ever ends up being possible!