Fixes bugs #4147, #13910
The Apple IIgs version is unaffected and will require a separate fix.
That version only had one speed, so it does not contain the script that
synchronizes clock speed with game speed. We add this feature, and will
also need to implement this synchronization.
Because it turns out that using shortcut keys was just one source of
screen corruption that had to be fixed. The other would happen if the
menu was activated during screen transitions. But that seems far too
technical to include in the note.
Perhaps this will finally fix the screen corruption bug I've been seeing
occasionally in Mac Indy 3? That seemed to happen because the screen was
changing while the game was paused, after the Window manager had made a
copy of the current screen.
As part of fixing a graphical glitch in Mac Indiana Jones and the Last
Crusade, eliminate the menu timer from the Mac window manager. It's just
too unpredictable and error prone for my taste.
At least for Indy 3, it led to strange effects with verb buttons being
depressed but not popping back out. For Loom, it made it possible to
move the practice box while the game was paused. While that's not
necessarily bad, I really don't want to have to worry about what else
may happen.
The AGIMOUSE protocol is for three mouse variables to be set by the
interpreter in response to opcode 171. This code updated two of the
three variables when processing events, causing the variables to
unexpectedly change in the middle of a game cycle, such as when
displaying a message box.
Fixes phantom clicks in "DG: The AGIMouse Adventure"
The user can specify a custom soundfont to be used with fluidsynth.
There was previously a hack for the iOS7 backend to get the path to
the document folder where the user can put files in a sandboxed
environment. This hack was removed in commit:
cac0664757
The problem however occurred when creating a FSNode from the full
system path because FSNode uses makeFileNodePath, which already
prepends the root. So the full path is added twice which causes the
fileNode.exists() to fail.
Create the FSNode from the path to the soundfont and check if the
file exist. If so then return the full path.
Cherry-pick of: addbdc13c5
Git conflict manually fixed
Use the helper function to create an array of UIKeyCommands for the
END, HOME, PAGE UP, PAGE DOWN and the ESC keys. Add a generic handler
function that decides which action for which key.
This allows the application to register key presses of these keys,
however some of them requires iOS 13.4 or later.
Cherry-pick of: 633b7ea201
Use the helper function to create an array of UIKeyCommands for the
Fn keys. Add a generic handler function that decides which action
for which key.
This allows the application to register key presses of the Fn keys,
however only supoorted in iOS 13.4 and later.
Cherry-pick of: 7a251f010f
Use the helper function to create an array of UIKeyCommands for the
number keys. Add a generic handler function that decides which action
for which key.
Since not all keyboards have the function keys, Fn1-Fn12, e.g. the
Apple Magic Keyboard for iPads, map these keys to the number keys
when pressed together with the CMD modifier key. Fn11 and Fn12
requires CMD + Shift as modifier keys.
Cherry-pick of: 5c8315abbd
Use the helper function to create an array of UIKeyCommands for the
roman letter keys. Since most of the games supports input of roman
letters, overload these keys. Keys with other characters than these
are not overloaded and will therefore trigger the call to the
delegate function:
"textField:shouldChangeCharactersInRange:replacementString:"
and will therefore still be passed to the IOS7 event handler.
However no modifier flags will be passed for those and they will not
support repeated presses.
Add a generic handler function that decides which action
for which key.
Cherry-pick of: 1a5d247070
Use the helper function to create an array of UIKeyCommands for the
arrow keys. Add a generic handler function that decides which action
for which key.
Since not all keyboards have the PAGE UP/DOWN nor HOME/END keys,
e.g. the Apple Magic Keyboard for iPads, map these keys to the arrow
keys when pressed together with the CMD modifier key.
Cherry-pick of: 77ecc595a3
Currently the key inputs are sent to the IOS7 event handler on calls
to the delegate function:
"textField:shouldChangeCharactersInRange:replacementString:"
So when typing on either the software keyboard or a connected HW
keyboard the input is handled by the hidden textfield that is in
focus. The delegate is called on each key input and the character
typed is passed to the IOS7 event handler.
Doing as above has the drawback that if they user holds down a key,
common in games when shooting or moving, the key event is only sent
once. The delegate function is only called once per distinct key
press.
By implementing the keyCommands function and create UIKeyCommands
for a set of keys, the system will call a defined callback function.
This also enables repeatedly calls as long as the key is held down.
Modifier keys can also be configured to create UIKeyCommands to
trigger custom actions. This way we can overload the key functions
when they are pressed at the same time as a modifier key.
Add helper funtions that can be used to create UIKeyCommands for
a set of keys. Keys are represented by their input, e.g. the key
for the character 'c' is defined as a string with only one char,
the 'c', while special keys are represeented by strings defined
by the OS.
Register UIKeyCommands for all types of modifier keys and add a
function that can convert system modifier flags to flags used by
ScummVM.
Cherry-pick of: 7a1ebc05c9
Prepare the backend to send key modifier flags in the key events.
No modifier flags are sent at this point but will be added in
upcoming commits.
Cherry-pick of: b66dca78ae
Add a convenience function to check if the application is running
in macOS. Use this method to change the default visibility of on-
screen control buttons and function bar.
Neither of these are needed when running on macOS since both mouse
and keyboard are available. Also the mouse pointer in ScummVM does
not access the on-screen control buttons.
However this requires function keys and key combinations like e.g.
Alt+X to work to be able to save and quit games.
These will be added in future commits.
Cherry-pick of: 3d1fa1c1dd
Applications running on iOS are usually full screen. On newer iPads
and when running iOS applications on macOS the application window
size can be changed.
When running the iOS application on macOS using "Designed for iPad"
option, the window can be changed, also to full screen. The function
"safeAreaInsetsDidChange" is then called. Update the screen size
using the view window property instead of checking the UIScreen
window bounds since these never changes.
If forcing the application to run in full screen setting the option
UIRequiresFullScreen to TRUE, it seems to trigger ScummVM to run
in portrait mode instead of landscape mode when running the app in
macOS using "Designed for iPad" on Apple silicon macs.
The UI doesn't require full screen since the application handles
resolution changes nice.
Cherry-pick of: 2eb03dbc04
It is possible to run iOS applications on macOS on Mac computers
running on Apple Silicon. This was possible before moving to the
ModularGraphicsBackend implementation in the iOS7 port with just
a little tweaking.
After the move to ModularGraphicsBackend, the ScummVM application
crashed on launch. There were two reasons for crashing;
1. dlsym() was called with the special handle RTLD_SELF to search
for the address binding of the GLES2 load symbol. Using RTLD_SELF
the search for the symbol is limited to the shared object issuing
the call to dlsym() and those shared objjects which were loaded
after it. When running an iOS app in macOS it seems that the app
is running inside a wrapper, which means that the objects resides
in a different level. Changing the search level to RTLD_DEFAULT
changes the search to also include all objects loaded at program
start-up.
2. As for the native macOS application, XCode also adds the
argument -NSDocumentRevisionsDebugMode YES if XCode option
"Allow debugging when using document Versions Browser" is on.
Make sure not to parse that argument also when building the
IPHONE target.
Cherry-pick of: 9d63f3901c
It was not possible to change the mouse mode between "Direct mouse"
and "Touchpad emulation" if a hardware keyboard was connected when
using the on-screen control button.
Fix this by checking if a hardware keyboard is connected.
Cherry-pick of: 19d173ea1b