writerson / imame4all

Automatically exported from code.google.com/p/imame4all
0 stars 0 forks source link

mouse support for android (non nvidia shield) #333

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I first want to thank you for making an amazing port, it's by far the best 
Android release of mame that I've tried.

I have an Android development board (a Firefly-RK3288) which runs mame4droid 
(using 1.9.2). This board supports both mouse and keyboard via USB, however 
when running mame4droid the mouse merely acts as a touch pointer, and doesn't 
work in the games as a mouse/spinner. I've tried enabling the nvidia shield 
extensions yet the mouse is still not enabled/used (it just acts like an 
Android touch/pointer).

After looking at the code I can see that the nvidia shield mouse extensions 
appear to be specific to the nvidia shield sdk (no surprise). Can you tell me 
what would be needed to add similar support for mice on other platforms (such 
as the Firefly-RK3288)? Note that there's nothing special about the mouse on 
the Firefly-RK3288, it's merely a USB mouse that appears as a touch pointer in 
Android.

I'm an experienced C/C++ programmer so I don't mind doing the work, yet I need 
some guidance as I have little Android/Java experience.

Thanks!

~ G2M

Here's the link to the board:
http://wiki.t-firefly.com/index.php/Firefly-RK3288/en

Original issue reported on code.google.com by game2m...@gmail.com on 5 Jun 2015 at 7:30

GoogleCodeExporter commented 9 years ago
You cant. Regular android has not relative mouse input api.

 If you really want to add mouse input you should root your device and read event from /dev/input queues. That's why I'm using nvidia extensions and I haven't added mouse support for regular android devices. 

Original comment by seleuco....@gmail.com on 6 Jun 2015 at 6:37

GoogleCodeExporter commented 9 years ago
The board comes with root access enabled, so it should have /dev/input 
accessible.

Where in the code would I need to add the reading of /dev/input?

Thanks!

~ G2M

Original comment by game2m...@gmail.com on 6 Jun 2015 at 11:28

GoogleCodeExporter commented 9 years ago
Not sure. You should encapsulate in a class. Tou should take a look on nvidia 
extensions. Maybe you can make factory which encapsulate boths implementations 
and replace direct nvidia mouse input. 

Original comment by seleuco....@gmail.com on 6 Jun 2015 at 5:54

GoogleCodeExporter commented 9 years ago
Is there any way to do this in the mame code and not the java/android code? The 
mame code should be able to open /dev/input, no?

Original comment by game2m...@gmail.com on 7 Jun 2015 at 12:54

GoogleCodeExporter commented 9 years ago
I think so, but you should do some kind of event injection and deal with jni. 

Anyway, take a look at this source code.  

https://github.com/moonlight-stream/moonlight-android/tree/master/app/src/main/j
ava/com/limelight/binding/input/evdev

Original comment by seleuco....@gmail.com on 7 Jun 2015 at 2:06

GoogleCodeExporter commented 9 years ago
Will do, thanks for the tip!

~ G2M

Original comment by game2m...@gmail.com on 8 Jun 2015 at 12:01