IOS7: Implement use of Dispatch Sources to drive timeHandler - #4948
Merged
Conversation
Apple never required bitcode to be enabled and with Xcode 14 bitcode is deprecated. Set bitcode to disabled for iOS and tvOS projects. Else it will be default on and give a build error due to the libraries in scummvm-ios7-libs-v3 doesn't include bitcode.
The timeHandler was driven by calls to the pollEvent callback function. Each time pollEvent was called the timeHandler called the TimeManager handle function to advance in time and make sure scheduled tasks were triggered. This worked good for most game engines but some, e.g. the Hypno engine was using the TimeManager to schedule tasks without calling pollEvent since it was expecting nor handling events at the specific point in time. Since iOS have threads the timerHandler can be called from a separate thread and not rely on pollEvent. Implement timerHandler to use a Timer Dispatch Source which and make it operate on a background thread rather than the main thread. Read more on Dispatch Sources here: https://developer.apple.com/library/archive/documentation/General/ Conceptual/ConcurrencyProgrammingGuide/GCDWorkQueues/GCDWorkQueues.html
The delegate methods application:shouldRestoreApplicationState is replaced with application:shouldRestoreSecureApplicationState and the method application:shouldSaveApplicationState with application:shouldSaveSecureApplicationState. To support older versions of iOS, put them in a version check macro.
criezy
reviewed
Apr 27, 2023
sev-
approved these changes
Apr 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement use of Dispatch Sources to drive timeHandler. The timerHandler will run on a background thread and not block the UI.
Include two other minor fixes as well. The first disabling bitcode by default for iOS and tvOS, the using the correct delegate methods depending on iOS version.