schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
743 stars 61 forks source link

Add support for gyroscope/accelerometer #511

Open svabos opened 2 weeks ago

svabos commented 2 weeks ago

I'm experiencing constant crash on andorid even after pure reinstall. Retroarch version: 1.19.1 ; Dosbox-pure version: 0.9.9

When loading a dosbox-pure core and going into it's menu "controller mapper", then trying to change preset from default "generic keyboard" the retroarch just crashes. That doesn't happen on PC version of retroarch/dosbox-pure

Bonus: is there a way to map a phone's gyroscope as mouse movement in core controller mapper

schellingb commented 2 weeks ago

I think this was fixed in 1c7ad4f. It should get released soon, I don't know when yet though. Some big changes since the last release.

Controlling something with a gyroscope sounds like a neat idea, do you know any other core that supports that? I'm not sure if it's available at all to a libretro core...

svabos commented 2 weeks ago

Controlling something with a gyroscope sounds like a neat idea, do you know any other core that supports that? I'm not sure if it's available at all to a libretro core...

yes, a mGBA core has it and works on android phone. I just tested it and can confirm that it works with game "WarioWare: Twisted!" Other than that, gyro control is highly requested feature on numerous cores but I haven't seen it anywhere else. Also, as I know, in mGBA there's no function to control gyro sensitivity so it's very sensitive to use

and since we are on the subject, it would be great that the gyro could be used in parallel with analogue joypads to control various mouse speed movement. For example for joypads to control very fast mouse movement and with gyro very slow, so you can jump from one part of the screen to another fast with joypad, and then fine tune position with low sensitivity gyro movements

schellingb commented 2 weeks ago

Ok, looks like there's this part in the libretro code interface

/* Id values for SENSOR types. */
#define RETRO_SENSOR_ACCELEROMETER_X 0
#define RETRO_SENSOR_ACCELEROMETER_Y 1
#define RETRO_SENSOR_ACCELEROMETER_Z 2
#define RETRO_SENSOR_GYROSCOPE_X 3
#define RETRO_SENSOR_GYROSCOPE_Y 4
#define RETRO_SENSOR_GYROSCOPE_Z 5
#define RETRO_SENSOR_ILLUMINANCE 6

typedef bool (RETRO_CALLCONV *retro_set_sensor_state_t)(unsigned port,
      enum retro_sensor_action action, unsigned rate);

typedef float (RETRO_CALLCONV *retro_sensor_get_input_t)(unsigned port, unsigned id);

struct retro_sensor_interface
{
   retro_set_sensor_state_t set_sensor_state;
   retro_sensor_get_input_t get_sensor_input;
};

It wouldn't be easy to add support for it in DOSBox Pure. But maybe some day :-)

svabos commented 2 weeks ago

It wouldn't be easy to add support for it in DOSBox Pure. But maybe some day :-)

Please do add it! It's the only hope for playing mouse games on andorid. Touchscreen is just pain to use...

schellingb commented 2 weeks ago

Problem I can see is that it would need a lot of special options. There are 6 axis available (gyro XYZ and accel XYZ). How to set which one does what? How to set speed? Would it be enough to just control the mouse? Or would one also want to control other inputs. I.e. joysticks. Or generic keys...

tails101 commented 21 hours ago

I wonder if it could be used for a wheel ,for cars or maybe flight simulator.