Retroplayer on Android
#16
(2016-02-10, 22:36)Hedda Wrote: Cool! Could the team please consider doing the same for Apple's official Game Controller Framework + API in iOS 7 and OS X 10.9 or later?

http://forum.kodi.tv/showthread.php?tid=204398
I don't own and I also don't want to own any apple devices so somebody else will have to step up and do the work.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#17
Figured out how to setup the input device callbacks which are now forwarded to CPeripheralBusAndroid so no polling needed on android.

Now the next step is to revive the joystick input logic and forward the input evens appropriately.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#18
i still don't get why this has to be done in core and all other handling is done in the add-on.
Reply
#19
(2016-02-11, 08:16)ironic_monkey Wrote: i still don't get why this has to be done in core and all other handling is done in the add-on.

I don't know how familiar you are with the android NDK and API.
There are two parts to implementing this for android (and probably any other platform / API):
  • Getting and maintaining the list of connected peripheral joysticks. On android this can either be done by polling InputManager.getInputDeviceIds() and then using the IDs to retrieve the input device objects through InputManager.getInputDevice() or by implementing and registering an InputDeviceListener. I've done both (because I couldn't get the InputDeviceListener to work at first so both work but obviously the listener is the nicer approach. And exposing the JNI environment isn't something I'd like to do because you can take down the whole app if you mess something up with the JNI environment. The problem is that to access these methods from android's Java API you need to make JNI calls and for that you need to have access to the JNI environment. So we'd have to explicitly write an android specific API for binary add-ons to call the methods mentioned above. For the InputDeviceListener approach it gets even more complicated. You need a Java implementation of the listener which then forwards the calls to native implementations through JNI. Registering the listener only seems to be possible in a Java thread that has been setup as a Looper. The main activity's thread is setup as a Looper thread by default so I just used that to register the implementation of the listener. Doing this from a binary add-on would require yet more android specific API definitions. Either way you'd require the Java wrapper implementation of the listener so this would not be doable purely in a binary add-on.
  • Getting and processing the input events. In a native android application AFAIK you can only have a single input event handler and you need to register it with your app's main activity. We obviously have an input event handler to also be able to handle touch and keyboard input so we automatically also receive any joystick input events in that handler. We'd again have to write an android specific API to somehow forward specific events to a binary addon method implementation. We already do the "forward this specific event to this handler" but this is all in the android platform specific code and we turn the events into general Kodi events before passing them on to the input pump which injects the events into Kodi's input handling thread.

So theoretically it would be doable in a binary addon but we'd have to write quite a few android specific API methods which are of no use to any other binary addon type and we'd run the risk of exposing stuff like the JNI environment which have to be treated very carefully.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#20
makes sense. i naively thought this would be exposed through the ndk.
Reply
#21
Well input events are, haven't checked for the input manager and listener stuff but it's still bound to the main activity.
NVidia seems to have some kind of native controller support library (for Shield TV) but haven't had the time to look into it yet.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#22
After a few more hours and stealing a lot of code from the peripheral addon stuff I have the buttions (A, B, X, Y, Back, Menu, Left Shoulder, Right Shoulder, Left Stick, Right Stick) working. Now to the D-Pad :-)
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#23
OK I got everything working and now I just need to clean up all the commits etc.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#24
nice!
Reply
#25
cool. anything else blocking the controller input PR? once this is in, I can start rebasing the rest of retroplayer so we can get it running on android
Reply
#26
What's the status on iOS? Does it compile but is missing specific joystick support? Unfortunately I won't be able to help out on that.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#27
as long as iOS compiles, we can add support for the gamepad controller framework later
Reply
#28
is there a build for android or do i have to compile it myself ??

little bit confused Smile
Reply
#29
I don't plan to backport the android support from the first half of retroplayer, based on 17 alpha, to the branch I've been releasing, based on 15.2. If someone else does the backport we'll see android in the near future, otherwise we'll have to wait til I've rebased the second half on 17 alpha. (this will take at least a month or two)
Reply
#30
Looking forward to have your PR8807 integrated in Kodi. First half in Kodi is better than nothing Wink
Keep up the good work!
Philips TV with Kodi 20.2 with IPTV --- Orbsmart 500 Android 21 alpha/beta as Online-radio/TV in the kitchen
Reply

Logout Mark Read Team Forum Stats Members Help
Retroplayer on Android0