2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Subforum for discussion and help with ScummVM's iPhone port

Moderator: ScummVM Team

Post Reply
basis
Posts: 9
Joined: Sat May 27, 2017 2:28 pm

2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by basis »

Hello,
I downloaded the official pre-built 2.1.0 IPA and signed and installed on ipadOS 13.1.3. The bluetooth keyboard works with the game filter on the SCUMMVM menu, but does not work in game. I also tried this with the smart connector keyboard from Apple.

I know there was some custom code that I had used in the past in the xcode build, but I’m trying to get away from that and just use the base IPA.

Any thoughts on how to make this work?

Thanks!

gmajor
Posts: 3
Joined: Tue Nov 05, 2019 2:30 am

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by gmajor »

You need to put your device in portrait mode in order for the external keyboard to work. This is a long standing issue that I hoped would be fixed in the 2.1.0 release but unfortunately it's not.

User avatar
criezy
ScummVM Developer
Posts: 741
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by criezy »

And I see we even have a bug report for that one, but somehow I missed it when doing some work on the keyboard handling earlier this year and checking the reported bugs. I will try to take a look this weekend.

basis
Posts: 9
Joined: Sat May 27, 2017 2:28 pm

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by basis »

thanks - please let me know when to test. I found the old code that worked for me when I manually added to a local code base. Is this only required for smart keyboard on iPad pro vs standard bluetooth? Maybe this is two separate fixes.

viewtopic.php?t=14524

User avatar
criezy
ScummVM Developer
Posts: 741
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by criezy »

I had a look this weekend and the good news is that we actually somewhat already fixed this (and I somehow forgot that we had :-P ). It would be complicated to enable by default the external keyboard in landscape mode, but you can now (in version 2.1.0) enable it using the pinch in gesture. I have tested this with my bluetooth keyboard and King's Quest 1, and this works well (at least for the arrow keys and the parser input).

To give a bit more details, the issue is that when we enable text input, if there is no external keyboard connected this shows the virtual keyboard. And there is unfortunately no public API on iOS to detect the presence of an external keyboard so that we could enable text input in landscape mode if there is one, and not enable it when there is none. The code in the thread you linked to has actually already been added to ScummVM, but it broke the experience when no external keyboard is connected as then the virtual keyboard was always visible in landscape mode. So further changes have been made to disable by default text input in landscape mode and add gestures to enable/disable text input (the pinch in/out gestures) so that this can be done manually. We could implement a number of horrible hacks to try to detect the presence of an external keyboard despite the lack of public API, but the current situation seems good enough for me.

Note that when an external keyboard is connected, enabling text input will not show the virtual keyboard, but will still show the input assistant bar (with the copy and paste buttons). Fortunately this is small enough to not get in the way. There is some code to remove that bar as well, but the code is not included by default as it breaks the build with older iOS versions. The code for that is on lines 55-57 in ios7_keyboard.mm. If you really want to hide this bar when the keyboard is enabled, you can uncomment those lines and compile ScummVM.

basis
Posts: 9
Joined: Sat May 27, 2017 2:28 pm

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by basis »

Thanks! I confirmed that the pinch works well with an iPad Pro 12.9” with the smart connector keyboard. The little bar is annoying, but at least the keyboard works with the pre-compiled IPAs (I’m trying to avoid using xcode). Maybe in a future version we can get a checkbox in the settings to disable this for newer devices (not sure if this breaks the compatibility or not).

Thanks again!

gmajor
Posts: 3
Joined: Tue Nov 05, 2019 2:30 am

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by gmajor »

Awesome! I didn't know about the pinch gesture trick. Thanks!

basis
Posts: 9
Joined: Sat May 27, 2017 2:28 pm

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by basis »

I know this is an old thread, but I'll ask here. I tested with the new Magic Keyboard and with removing the commentary as indicated, and the pinch and keyboard works in landscape mode just fine (v 2.2.0git). However, two improvements I would like to see:

1) There are no hardware Function keys on the Magic Keyboard (or most portable bluetooth keyboards). Is there any way to set control (or option, or cmd) + the number to invoke a function key? For example, control + 1 would be F1.

I was messing around in ios7_keyboard.mm and as a test changed KEYCODE_F1 to KEYCODE_LEFTBRACKET, but only the [ was picked up in the SCI text parser engine. KEYCODE_LEFTBRACKET = 91, // [ is defined in the common/keyboard.h.

I'm not enough of a developer to know what to change here for multiple keypresses. This would (of course) be just for my use - not put in the main build source.

- (void) fn1Key {
[softKeyboard handleKeyPress:Common::KEYCODE_F1];
}

2) Is there any way to add a keyboard shortcut for a right click? Ideally, updating the codebase to allow the secondary click since iPadOS 13.4 as right click would be the best choice, but having a quick button such as "]" would be a good compromise (again - just for my use!).

Thanks!

User avatar
criezy
ScummVM Developer
Posts: 741
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by criezy »

I actually added a bar with function keys (as well as a few other keys) to the virtual keyboard, and initially it was shown also when using a bluetooth keyboard (the virtual keyboard itself was not visible, but this additional bar was visible at the bottom of the screen). But there were some complaints so I made an additional change to hide it when using a bluetooth keyboard. Maybe an option to have this bar even when using an external keyboard would be useful.

Also since the 2.1.1 release a lot of improvements have been done to the key mapper functionalities in ScummVM. I have not had time to start looking at those yet and make the necessary changes so that it works properly on the iOS port. But from what I have seen it might provide the functionalities you want for your two points.

basis
Posts: 9
Joined: Sat May 27, 2017 2:28 pm

Re: 2.1.0 IPA ipadOS Bluetooth Keyboard Doesn’t Work

Post by basis »

Hello. Yes, I was playing around with the virtual function keys a bit. The problem is that it covers the bottom of the screen - it doesn't resize the display, so it sort of gets in the way. I'd much rather have a keyboard hotkey set (such as CTRL+1 for F1) as it's only one extra keystroke - that and I don't have to lift my hands off the keyboard to the screen. Some of the Sierra games F3 allows you to retype last command would be really nice to have. The right click on the physical mouse or trackpad would be a game changer for scummvm on iPad.

Let me know if there's any bounty options or whatnot - be happy to give back to the project for upgrades and such. Thanks!

Post Reply