Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Help with GameController framework
-
Hello all!
So I've tried to make use of MFi controllers with Pythonista, however I can't get it to trigger a
'GCControllerDidConnectNotification'
.
Thanks to @omz's previous help withNSNotificationCenter
I built a little script to make it easier to handle those things. If you take a look at it, it works just fine with the test case notification. However following code wont trigger for me when I connect a controller:from objc_util_ext import * from objc_util import * def cnotification(new_controller): print 'Connected' controller_framework = import_framework('GameController') observer_add('GCControllerDidConnectNotification',cnotification)
Also following returns an empty list, eben when I have a controller connected (which is also recognised by other apps which can use controllers):
controller = ObjCClass('GCController') print controller.controllers()
-
Unfortunately, I don't have an MFi controller to test with, so I can't really help very much.
I've just read the documentation a little bit, and as far as I understand it, you shouldn't really need to observe notifications etc. because the controller should be connected automatically (if it's been paired once) and then just appear in
GCController.controllers()
.It seems strange that this returns an empty array... Are you sure your controller is actually an MFi controller? I don't know a lot about these things, but I seem to remember that there were game controllers before they were officially supported, and they basically just emulated keyboards...
-
Thanks for your answer. The thing with my controller is, that I'm jailbroken and using a tweak called MFiWrapper, which creates an interface for my Dualshock4 controller to MFi. It should work in theory, as apps, such as GBA4iOS detect the controller. It would be pretty nifty if someone had a real MFi controller and could test this further.
Currently I suspect that I might not be able to correctly load data due to the framework being loaded at runtime, however due to the previously explained specialties, it could be anything :/