Kodi Community Forum

Full Version: Apple's official Game Controller Framework + API in iOS 7 and OS X 10.9?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Apple introduced an official Game Controller Framework + API from iOS 7 and OS X 10.9
http://www.mactrast.com/2013/06/apple-to...mavericks/
http://www.raywenderlich.com/66532/ios-7...r-tutorial

Would it be possible for you to add joystick / gamepad support of it in RetroPlayer?

You can find that developers documentation in the Apple Game Controller Programming Guide here
https://developer.apple.com/library/ios/...ction.html
https://developer.apple.com/library/ios/...efColl.pdf

This should enable native support for joysticks and gamepads under iOS and Mac OS X
interesting. gamepads have never been supported directly on OSX, so this may change things. I switch to OSX for my main development environment, so I'll keep an eye on this.
For reference, some very cool related work on APIs for input (peripheral) addons being worked on right by garbear here right now

211138 (thread)

(2014-12-18, 07:54)garbear Wrote: [ -> ]Now I have a little present for you Wink

As I mentioned before, I decided to move the platform-specific joystick code to binary add-ons. I created a new kind of add-on, "peripheral add-on", that can offer one or more types of peripherals. Currently, only joysticks can be offered. Next on my list, media readers like the Retrode will let you download ROMs from cartridges, launch games instantly by plugging them in, upload save games, etc. OFC we must "change one thing at a time". Media readers should only come after we've finished the API for joysticks.

The central repo for peripheral add-ons is now available at https://github.com/garbear/xbmc-peripheral-addons

The initial version supports 4 APIs: DirectInput, XInput (for windows), SDL v1 and the Linux Joystick API. The Joystick add-on is based on my work for RetroPlayer, so there's some SDL fixes between Gotham and Helix that need to be incorporated. Full list here: https://github.com/xbmc/xbmc/commits/Hel...ystick.cpp . The important change, SDLv1 -> SDLv2, is PR:5364

Windows and Linux build right now. I haven't finished implementing peripheral add-ons in Kodi yet. I'll try to finish by the weekend so that we can load the add-on and test it out.

The code is meant to be run both as an add-on and a standalone app, so until then, someone could easily test by replacing the addon.cpp entry point with a main.cpp and compiling as an executable. Logging will intelligently switch between stdout and Kodi's log system, depending on if the code is loaded as an add-on or run as an executable.

Feel free to play around with the joystick code so far. Joystick APIs and logging is included, the Key Mapper and persistent storage are still empty folders. Persistent storage for keymaps could include a local XML dump, frontend-provided storage like a central MySQL database, cloud storage, read-only remote databases (like the SDL Game Controller DB) and read-write remote DBs (to allow for "voting" on keymaps and data curation).
FYI, it looks like Apple earlier this month updated their official Game Controller Framework to be tvOS (Apple TV 4) and iOS 9 compatible, see:

https://developer.apple.com/library/prer...llers.html
https://developer.apple.com/library/prer...index.html
https://developer.apple.com/tvos/human-i...teraction/
https://forums.developer.apple.com/thread/17355

SteelSeries Nimbus is the reference game controller and the first official gamepad to support Apple TV with tvOS (ATV4) and iOS 9:

https://steelseries.com/gaming-controllers/nimbus
Bump for CPeripheralBusiOS class in RetroPlayer on iOS 246680 (thread)
(2016-02-10, 01:42)Montellese Wrote: [ -> ]OK after spending some time on bringing my android buildsystem back up to speed and setting up my ADT-1 for development again I have extended some of the JNI wrappers to access the android InputManager and more properties of the InputDevice class. Then I've implemented a CPeripheralBusAndroid class which is able to read all controllers. It however ignores everything except joysticks and gamepads as it actually lists virtual, GPIO and keyboard devices as well.

The controllers aren't shown in the Peripherals list yet but haven't had time to look into that yet.
Figured it out Cool