libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.31k stars 1.83k forks source link

[IOS10+]iCade controllers and hardware keyboards are not handled #6197

Open yo6snap opened 6 years ago

yo6snap commented 6 years ago

Description

iCade controllers and hardware keyboards are not handled on iOS10+. This issue is the consequence of this thread end.

Expected behavior

The same as iOS 9 and prior.

Actual behavior

iCade controllers and hardware keyboards are ignored.

Steps to reproduce the bug

Pair a bluetooth keyboard with an iDevice/IOS10+. Launch RetroArch. Ensure option "Menu>Input>Keyboard Gamepad Mapping Enable" is set to OFF. Stroke arrow keys to navigate thru RetroArch menu. Nothing happens.

Version/Commit

Environment information

yo6snap commented 6 years ago

Analysis

I worked on this issue at development level. With Xcode debugger I tracked hardware events. I specially focused on HID events. On a true iPad Air 2/IOS 11 the -(void)handleKeyUIEvent:(UIEvent *)event Apple private method is called when a key is pressed or released on an hardware keyboard. This behavior is the same as iOS 9.

Technically speaking, it is possible to have this feature on IOS 11. On IOS 10+, it has been intentionally removed with the preprocessor directive HAVE_APPLE_STORE. I've just removed this one from RetroArch building process.

How to play with an iCade Controller or an hardware keyboard on IOS 11

Follow the compilations instruction here. Before building RetroArch unzip and copy the following file project.pbxproj.zip to pkg/apple/RetroArch_iOS10.xcodeproj package. (If you use Finder, right click and display contents of the package)

Enjoy!

Question for RetroArch developers (@twinaphex ?)

Is it planned to submit RetroArch to the Apple Store ? If no, why this feature has been disabled ?

Regular way to implement this feature (Apple Store guidelines compliant)

In order to implement this feature with UIKIT, it is possible to use:

  1. a transparent UITextField
  2. override NSArray<UIKeyCommand *> *keyCommands property of UIResponder subclass

It works well for RetroArch UI menu or in game menus. A big problem comes with regular UIKIT: It doesn't give us the "key releasing" informations. So you can't detect properly player key combos.

Someone got an iso-functional Apple Store compliant technical solution ?

yoshisuga commented 6 years ago

I mentioned this before but the way to do it is to create another view with a UITextField and use the text field delegate method to pass along inputs to RetroArch.

This however would only work for iCade controllers because they output key down and key up events. Hardware keyboards are a lost cause until Apple would open up the keyboard api a bit more for iOS.

Sent from my iPhone

On Jan 28, 2018, at 4:40 PM, Andrés notifications@github.com wrote:

It's not likely that it's gonna be submitted, the port is largely unmantained because jailbreaking has become increasingly more difficult.

At some point I think an APPLE_STORE release was planned but I don't think that's gonna happen.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Mr-se7enX commented 6 years ago

@yo6snap, thank you very much for solving this issue. I tested iCade, Keyboard and MFi mode, they all work perfectly fine. For iCade mode turn "keyboard Gamepad Mapping Enable" ON. Then choose SNES30 8bitdo from "keyboard Gamepad Mapping Type" to have SELECT and START buttons working too. Both 8-bitty and SNES30 8bitdo types have SELECT and START buttons working. For Keyboard mode turn "keyboard Gamepad Mapping Enable" OFF. To have full control on menu turn "Unified Menu Controls" ON. I have a little tiny issue regarding hotkey. My keyboard gamepad and hotkey have common letters. So I would like to have all hotkeys to "nul". I can edit that manually by changing the values from config file, but I would like it to be changed from ipa build.

inactive123 commented 6 years ago

As for an Apple App Store release, even though RetroArch is not an emulator and it's an agnostic backend/frontend program, most people out there associate us with it, so it would be an uphill struggle to convince Apple/MS to let us be on their stores. And even in the event we could appear on them, cores have to be statically linked to the program, so you wouldn't see any emulator cores anyway, maybe only stuff like NXEngine, Doom, Craft, Lutro, Lutris and stuff like that.

yo6snap commented 6 years ago

@yoshisuga: Do you know the second algorithm I mentioned before? I don't know if it is used in another projects. I found thekeyCommands property in official Apple documentation.

@Mr-se7enX: You're welcome! I hope you will enjoy playing with your iCade controller. Do you have the associated iCade cabinet ?

Mr-se7enX commented 6 years ago

@yo6snap: I have iON iCade cabinet. And all the buttons work fine.

yo6snap commented 6 years ago

Do you retrieve oldschool feeling with this controller?

If you want your settings in next IPA, post a clean config file here. Next, tell me exactly items of the config file you want. I will try to create a pull request...

Mr-se7enX commented 6 years ago

@yo6snap. Do you retrieve oldschool feeling with this controller? kind of. Do I recommend it? I would say no. The design of the cabinet not really comfortable. check some reviews about it on Youtube. Regarding the hotkey configuration. I tried to clear the input but RetroArch crashes right away. I'm able to clear the input for User Bind but not for Hotkey bind.

yo6snap commented 6 years ago

@Mr-se7enX

My keyboard gamepad and hotkey have common letters. So I would like to have all hotkeys to "nul".

In my own opinion, I consider default keys assigned as a good thing (like joypad autoconfig files fashion). Instead of assign "nul" you may consider which keys are conflicting ? In order to solve your problem, can you give an exhausted list of these conflicts ? If yes, we can propose an another RetroArch config file with a good hotkeys default mapping.

Mr-se7enX commented 6 years ago

@yo6snap. I figured out how to change hotkeys to blank. I changed the input values of this file ''config.def.keybinds.h".

georaldc commented 5 months ago

Now that retroarch is available on the ios app store, is it still possible to support something like an ion icade with modern versions of ios? I tried it with an old ipad air (that uses ios 15.7.2) and while the ipad still picks up the icade, I couldn't seem to get retroarch to recognize it at all.

vjvalenti2 commented 5 months ago

@georaldc I just tried enabling Keyboard Controller mapping and set Keyboard Controller Mapping Type to SNES30 8bitdo and my old iCade worked just fine with my iphone 15. That should work with your iPad Air as well.

georaldc commented 5 months ago

@georaldc I just tried enabling Keyboard Controller mapping and set Keyboard Controller Mapping Type to SNES30 8bitdo and my old iCade worked just fine with my iphone 15. That should work with your iPad Air as well.

I tried it with those settings and the icade doesn't register any inputs with retroarch. Interestingly, like you reported, this seems to work fine on my iphone 15 as well.

Edit: Nevermind. I updated to the latest available system update, reinstalled retroarch and now the icade works on the ipad.