67 Commits

Author SHA1 Message Date
Le Philousophe
01ebece807 COMMON: Make getDefaultConfigFileName return a Path instead of a String 2023-12-24 13:19:25 +01:00
Thierry Crozat
bb8fa8b481 IOS7: Save state to a separate file when closing ScummVM
The state information was saved using ConfMan in the scummvm ini file,
but this could cause corruption of that ini file if the application
was killed while ConfMan was flushed (see bug #14623). To reduce the
risk of losing the config file, we now save the state to a separate
file.
2023-12-13 22:04:22 +00:00
Cameron Cawley
bcc9259382 BACKENDS: Report if the backend supports cursors with alpha channels 2023-10-29 02:02:11 +02:00
Lars Sundström
4dff5ab486 IOS7: Don't account suspended time in getMillis()
It was reported that in some games, e.g. COMI, if suspending the iOS
application by putting it to background and then some time later
resuming it again the music doesn't start playing. It was reproduced
in The Dig and most probably Full Throttle was affected.

The time it took for the music to play again after resuming turned
out to be related to the time the app was in background. The longer
the app was in background, the longer it took for the music to start
playing again.

The legacy implementation of getMillis in the iOS7 backend accounted
the time the application was suspended. The time was accumulated
every time the app moved to background and it was never reset.
The getMillis function used the accumulated value and substracted it
from the time difference from the current time.

This seems to have caused problems with the timer handler, causing
slots to not be executed in correct time. The Android backend do not
account for the time in background.
2023-10-25 22:05:04 +02:00
Lars Sundström
b2ba581917 IOS7: Remove old touch to mouse button translations
Remove the old translations from touch events to mouse button events.
These have been replaced with UIGestures.
2023-10-11 06:28:03 +02:00
Lars Sundström
8e9f54ad32 IOS7: Refactor touchpadModeEnabled to a TouchMode
Change the boolean parameter indicating if "touch mode" is enabled
or not to an enum which could contain several different touch modes.
2023-10-10 20:55:48 +02:00
Lars Sundström
f943fba3d0 IOS7: Enable kFeatureCpuNEON in IOS7 backend
Make use of the NEON optimisations in iOS and tvOS.
2023-09-03 22:26:37 +02:00
Thierry Crozat
ef7c881416 OSYSTEM: Add kFeatureTouchscreen to identify backends with a touchscreen 2023-08-22 23:37:11 +01:00
Lars Sundström
0d77f8a262 IOS7: Delete deprecated and unused event variables
These class member variables aren't used anymore.
2023-08-20 21:38:52 +01:00
Thierry Crozat
fc51e86b3d IOS7: Prevent sleep when a task is running 2023-08-06 23:07:35 +02:00
Thierry Crozat
a719b6301d IOS7: Register a default iconspath 2023-08-05 17:16:13 +02:00
Lars Sundström
34d7cd3769 IOS7: Implement setting of requested screen orientation
Implement function to trigger the device to set the screen
orientation according to the configration in the backend
options tab.

The implementation to trigger the setting is different for
devices running iOS prior version 16 and version 16+.
The screen orientation update is triggered when user has
applied the setting in the backen options tab, when the GUI
launcher is loaded and when starting a game.
The orientation is only changed if going from any portrait
mode to any landscape mode and the opposite.

Based on the setting, an UIInterfaceOrientationMask property
is set to hold the allowed interface orientations. If the
setting is "Portrait" the property will be set to
UIInterfaceOrientationMaskPortrait, allowing to only change
the orientation to normal or upside down portrait modes.
If the setting is "Landscape" the UIInterfaceOrientationMask
will be set to UIInterfaceOrientationMaskLandscape allowing
the device to rotate the screen orientation only to either
right or left landscape mode. If set to "Auto" all orientations
will be allowed.

When the device orientation changes, the system calls the
instance property method supportedInterfaceOrientations on the
root view controller or the topmost modal view controller that
fills the window. If the view controller supports the new
orientation, the system rotates the window and the view
controller. The system only calls this method if the view
controller's shouldAutorotate method returns YES, which is the
default value.

The event handler is refactored to receive the internal screen
orientation value instead of the enum value of the UIKit enum
UIInterfaceOrientation. The convertion from UIInterfaceOrientation
to ScreenOrientation is done in iPhoneView class instead when
sending the new orientation value to the event handler.
This also makes the convertion aligned with the screen orientation
settings in the function setSupportedScreenOrientation.
2023-07-08 18:49:54 +02:00
Lars Sundström
b324c70748 IOS7: Implement switching of 2D/3D graphics managers
Implement the same "hacky" way to switch between the 2D and 3D
iOSGraphicsManagers as the Android and SDL backends.

This commit enables 3D capable games to utilise the horse powers
in the GPU to render graohic. Older iPhones and iPads (iPhone 6,
iPad Mini v1) are able to run quite advanced games without any
stuttering if run in Release mode.
2023-07-03 21:50:32 +02:00
Lars Sundström
fb4f7d6de2 IOS7: Remove old IOS7 graphic handling
Delete the old graphic handling in the IOS7 backend which is not
used anymore after implementing iOSGraphicsManager.

The Accelerate framework is not used anymore. The OpenGLGraphics
manager handles the different color formats.
2023-07-03 21:50:32 +02:00
Lars Sundström
e0ae1a1d47 IOS7: Rework mouse movements to use iOSGraphicsManager
Previously the mouse position in the view was tracked using the
pointerPosition property. Scaling and relative mosue movements
were calculated in the view using screen properties stored in the
videoContext structure. Now when moving to iOSGraphicsManager all
that handling will be handled by the WindowedGraphicsManager,
which the iOSGraphicsManager inherit.

Rework the input code to send down pure x and y position values,
scaled according to the view content scale factor.

Remove code related to mouse movement that is no longer needed.
2023-07-03 21:50:32 +02:00
Lars Sundström
580d8424ca IOS7: Change OSystem_iOS7 to be a ModularGraphicsBackend
Remove all pure virtual functions in OSystem_iOS7 since they are
implemented by ModularGraphicsBackend.

This commit will break the graphics implementation in the ios7
backend and crash due to no OpenGL context created for the
graphicsManager to use.
2023-07-03 21:50:32 +02:00
Lars Sundström
d397938107 IOS7: Implement support for setting mouse pointer speed
Implement support to set the mouse pointer speed in settings.
The mouse pointer speed is applied to both mouse input and touch
input when in touchpad-mode.
2023-05-15 12:43:39 +02:00
Lars Sundström
a690552301 IOS7: Remove legacy gesture recognizers
These gesture recognizers were inherited from the iphone port. The
ios7 port use the UIGestureRecognizers to accomplish the same.
2023-05-05 22:35:03 +02:00
Lars Sundström
9bc623a8a4 IOS7: Implement port-specifc option widget
Include the newly added ios7_options implementation to the project.
Change the file type to .mm which is Objective C++ to be able to use
the @availble mechanism.

Implement virtual functions and fix build errors in initial code.
Also add help section for the tvOS port when building for tvOS.

Add ios7_options to POTFILES to get automatic translation on the
help section.
2023-05-05 22:35:03 +02:00
Lars Sundström
50b67d97c4 IOS7: Implement use of Timer Dispatch Sources to drive timeHandler
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
2023-05-02 08:02:12 +02:00
Thierry Crozat
59c6d6fe4b IOS7: Add check of size for log file to make sure it does not grow too much 2023-04-27 01:24:30 +01:00
Thierry Crozat
e8d87fb92a IOS7: Create log file in Document folder
Previously no log file was used as it attempted to create it in
a directory not accessible by the application. The commit also fixes
accessing the log file from the Options dialog (it needs the
sandboxed path and not the full path).
2023-04-27 01:24:30 +01:00
Thierry Crozat
a36dba4db9 IOS7: Cleanup code to access Document and app bundle paths 2023-04-27 01:24:30 +01:00
Thierry Crozat
a0e32ee370 IOS7: Remove support for non-sandboxed mode 2023-04-26 22:31:31 +01:00
Thierry Crozat
cbd2b736df BACKENDS: Add possibility to specify virtual drive in ChRootFilesystemFactory
It allows to get access to additional directories outside of the sandbox root.
This is used on iOS to access files in the app bundle.
2023-03-24 21:11:50 +01:00
Lars Sundström
5f54aedbb9 IOS7: Put iOS specific code within platform specific macros
iOS and tvOS shares a lot of code. However some there are parts that are
specific to iOS, for instance handling of UI device orientation and
certain types of gestures.

Currently there are also some limitations on the Apple TV that needs to
be flagged to the  engine. There is no support for virtual keyboard, no
clipboard support and no possibility to open URLs.

Put code specific for iOS within the ObjC platfrom macro TARGET_OS_IOS.
The code specific for tvOS are put within the macro TARGET_OS_TV.
2023-01-29 21:13:51 +00:00
Le Philousophe
4ab044a254 OPENGL: Merge both OpenGL contexts 2022-06-26 18:32:10 +02:00
Paweł Kołodziejski
ee11c85f85 IOS: Added support for GLAD 2022-03-06 21:44:19 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh
b11c5ace90 BACKENDS: JANITORIAL: Remove 'virtual' when override is specified 2021-11-14 14:31:41 +02:00
Cameron Cawley
5022489277 BACKENDS: Refactor the API for creating Mutexes 2021-11-12 20:19:45 +01:00
Thierry Crozat
abf782c670 COMMON: Remove kFeatureHiDPI from OSystem and use getHiDPIScreenFactor instead 2021-08-13 21:41:33 +01:00
Martin Gerhardy
a0c237f7b9 EVENTRECORDER: added new event for OSystem::getTimeAndDate 2021-07-09 19:23:21 +02:00
Thierry Crozat
dce06f179c IOS7: Render the GUI in HiDPI 2021-05-24 23:46:51 +01:00
Cameron Cawley
a1890ede9c BASE: Avoid calling PluginMan.getEngineFromMetaEngine where possible 2021-04-05 15:33:23 +01:00
Cameron Cawley
a38103fb23 IOS7: Remove scaler code 2021-03-15 16:48:40 +02:00
Cameron Cawley
0d4625d2d5 IOS7: Make use of ModularMutexBackend 2020-11-09 19:12:33 +00:00
Thierry Crozat
53bb50c906 IOS7: Do not overwrite user saves when saving state 2020-09-13 00:21:36 +01:00
Thierry Crozat
c50ffd74c6 IOS7: Properly restore state when the process has been terminated 2020-09-13 00:21:36 +01:00
Thierry Crozat
63627dc26d IOS7: Save state as a background task when entering background
This is better than using an hardcoded delay for two main reasons.
The first one is that the application can terminate as soon as it
has finished saving the state, and the second one is that it will
still work if saving the state takes longer than the delay that
was hardcoded.
2020-09-13 00:21:35 +01:00
Thierry Crozat
28e9910666 IOS7: Implement game state save/restore when switching tasks
This only works if the running engines can save the game at the
time when ScummVM goes to the background.
This should partially fix bug #7871.
2020-09-13 00:21:35 +01:00
Thierry Crozat
7c812a52f1 IOS7: Call pauseEngine() when suspending the application 2020-09-13 00:21:35 +01:00
Cameron Cawley
7745ffdac1 BACKENDS: Simplify EventsBaseBackend 2020-08-24 14:22:35 +02:00
Thierry Crozat
4efcecb986 IOS7: Log error messages to the system error log facility 2020-04-26 16:19:37 +01:00
Thierry Crozat
be6372df9c IOS7: Remove exit for normal application termination
With the kFeatureNoQuit being now used, it should not get
there anyway.
2020-04-26 16:19:37 +01:00
Thierry Crozat
8958fe0f7b IOS7: Add support for kFeatureNoQuit 2020-04-26 16:19:37 +01:00
Thierry Crozat
98b7095527 IOS7: Fix implementation of getMillis()
The documentation indicates that it should return the number of
milliseconds since the application started. It was however using
a different reference (last boot of the device minus the sleep time)
resulting in a much bigger value than expected.
2020-02-01 22:56:25 +00:00
sluicebox
e8f009e04f IOS: Call exit(0) when exiting to prevent hanging
Prevents the process from hanging on exit when using the
Quit button in launcher or a game's quit function
2019-09-10 13:02:28 +03:00
Thierry Crozat
c505a7b4bb IOS7: Implement opening a URL 2019-08-04 19:03:34 +01:00
Thierry Crozat
0ddcb9de7b IOS7: Implement copy to clipboard and paste from clipboard 2019-08-04 19:03:34 +01:00