Commit graph

54 commits

Author SHA1 Message Date
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
e6232547d5 IOS7: Add iOSGraphicsManager class
The ios7 backend implements the graphic handling in the backend code.
iOS supports OpenGL through the OpenGL Framework since iOS 2.0. It's
marked as deprecated but is still shipped with the SDKs for iPhoneOS
and tvOS and will hopefully be so for some time.
The ios7 backend can therefore utilize the OpenGLGraphicsManager to
handle all graphics.

Implement an iOSGraphicsManager class that can be used in the ios7
backend. The iOSGraphicsManager will require some callback functions
in the ios7 backend. createOpenGLContext() will be called to ask the
backend to create an OpenGL context in which the graphic manager can
draw. The function returns the ID of the renderbuffer which shall be
used when creating the framebuffer object this differ iOS from other
platforms). A custom RenderBufferTarget class is added to address
this.

destroyOpenGLContext() will be called to make sure that the old GLES
context is not reused. notifyContextDestroy() does call the function
OpenGLContext.reset() but that will not destroy the context.

refreshScreen() will be called to ask the backend to present the
drawn graphics on the screen. getSystemHiDPIScreenFactor() is called
to get the screen scaling factor. getScreenWidth() and
getScreenHeight() are called to get the width and height of the
surface to draw on.

This commit adds the class but the ios7 backend doesn't make use of
it quite yet. To use it require the ios7 to be a child class of the
ModularGraphicsBackend. That change requires a lot of changes which
will be targeted in separate commits.

Update docportal and github ci worker to only disable the feature
opengl_classic_game since opengl and opengl_shaders are required to
compile the OpenGLGraphicsManager.
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
568b06940e IOS7: Add mouse input events
Add input events that can be used by mouse devices, e.g. mices and
touchpads. This event sends the raw input actions and doesn't care
about different controller modes such as click-and-drag.

Make the mouse controller utilize the new mouse input events.
2023-05-15 12:43:39 +02:00
Lars Sundström
5a0eccf337 IOS7: Rename mouse events to touch events
The current mouse events are handling events created from both touch
and mouse input. The events have lots of logic to deal with gestures
and different modes (touchpad mode, click-and-drag etc) which are not
applicable for hardware inputs.

Rename the current "mouse events" to "touch events" to clarify which
input that triggered an event. As this is the first commit in multi-
commit change, the mouse input need to use the "touch events" until
a new "mouse event" is implemented.
2023-05-15 12:43:39 +02:00
Lars Sundström
5817e72d0d IOS7: Implement Apple GCVirtualController
Apple introduced the GCVirtualController in iOS 15 which is a
software emulation of a real controller. The virtual controllers
can be configurable with different inputs. See more info at:
https://developer.apple.com/documentation/gamecontroller/gcvirtualcontroller

A simple gamepad configuration with a dPad and A and B buttons
is added. The user can enable/disable the virtual game controller
swiping two fingers right to left, or through the port-specific
option dialog.
2023-05-05 22:35:03 +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
a0e32ee370 IOS7: Remove support for non-sandboxed mode 2023-04-26 22:31:31 +01:00
Thierry Crozat
4413600f2a IOS7: Fix missing override keyword 2023-04-26 08:29:59 +02:00
Eugene Sandulenko
986076bb13
IOS7: Report the scummvm.log file location 2023-03-27 00:24:46 +02:00
Thierry Crozat
4dff8f6220 IOS7: Support detecting, adding, and starting games from bundle 2023-03-24 21:11:50 +01:00
elasota
3db67a33ac GRAPHICS: Add support for pixels with masks and inverted pixels 2023-02-19 23:51:09 +01:00
Le Philousophe
87bad2cc7d COMMON: Allow games to use overlay for something else than GUI
This can be used for subtitles without changing the mouse coordinates.
2022-11-12 19:12:05 +01:00
Lars Sundström
e7759ac0ef IOS7: Implement getHardwareInputSet to get connected devices
Trigger EVENT_INPUT_CHANGED when devices connects to make the ScummVM
engine update the hardware input set.
2022-08-08 21:08:56 +01:00
Le Philousophe
4ab044a254 OPENGL: Merge both OpenGL contexts 2022-06-26 18:32:10 +02: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
2649f022de IOS7: Implement getHiDPIScreenFactor 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
Cameron Cawley
cdc00c41be IOS7: Remove unneeded use of Graphics::ColorMasks 2021-06-24 11:55:54 +02:00
Martin Gerhardy
5af1192580 BACKENDS: fixed segfault in EventRecorder with buffer out of bounds writes
==3124361== Invalid write of size 8
==3124361==    at 0x483F803: memmove (vg_replace_strmem.c:1270)
==3124361==    by 0x4DBF61: SurfaceSdlGraphicsManager::grabOverlay(void*, int) const (surfacesdl-graphics.cpp:1753)
==3124361==    by 0x482051: ModularGraphicsBackend::grabOverlay(void*, int) (modular-backend.cpp:215)
==3124361==    by 0x434EE1: GUI::ThemeEngine::clearAll() (ThemeEngine.cpp:376)
==3124361==    by 0x40128E: GUI::EventRecorder::preDrawOverlayGui() (EventRecorder.cpp:558)
==3124361==    by 0x481DB2: ModularGraphicsBackend::updateScreen() (modular-backend.cpp:173)
==3124361==    by 0x559967: Graphics::Screen::updateScreen() (screen.cpp:62)
==3124361==    by 0x55991C: Graphics::Screen::update() (screen.cpp:56)
==3124361==    by 0x38AFC7: TwinE::TwineScreen::update() (twine.cpp:126)
==3124361==    by 0x3B8759: TwinE::Screens::adjustPalette(unsigned char, unsigned char, unsigned char, unsigned int const*, int) (screens.cpp:150)
==3124361==    by 0x3B8A89: TwinE::Screens::fadeToPal(unsigned int const*) (screens.cpp:207)
==3124361==    by 0x3B8403: TwinE::Screens::loadImage(int, int, bool) (screens.cpp:80)
==3124361==  Address 0x31453050 is 16 bytes after a block of size 512,000 alloc'd
==3124361==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==3124361==    by 0x55B38C: Graphics::Surface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (surface.cpp:75)
==3124361==    by 0x551111: Graphics::ManagedSurface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (managed_surface.cpp:153)
==3124361==    by 0x4352D5: GUI::ThemeEngine::setGraphicsMode(GUI::ThemeEngine::GraphicsMode) (ThemeEngine.cpp:453)
==3124361==    by 0x434A52: GUI::ThemeEngine::init() (ThemeEngine.cpp:324)
==3124361==    by 0x43501B: GUI::ThemeEngine::refresh() (ThemeEngine.cpp:394)
==3124361==    by 0x405780: GUI::GuiManager::screenChange() (gui-manager.cpp:603)
==3124361==    by 0x405C6B: GUI::GuiManager::processEvent(Common::Event const&, GUI::Dialog*) (gui-manager.cpp:677)
==3124361==    by 0x404EBA: GUI::GuiManager::runLoop() (gui-manager.cpp:429)
==3124361==    by 0x3FD847: GUI::Dialog::runModal() (dialog.cpp:77)
==3124361==    by 0x36D747: launcherDialog() (main.cpp:106)
==3124361==    by 0x36FF92: scummvm_main (main.cpp:552)

It looks like the _videoMode.overlayHeight in SurfaceSdlGraphicsManager::grabOverlay and ThemeEngine::_backBuffer::h are somehow out of sync after
starting the game in a different resolution as the gui was started with. So the overlayHeight is updated - but the backbuffer (Surface) is not resized.

This is with event recorder being active - right after starting the game and switching the resolution.
2021-06-19 14:34:52 +02:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02: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
3fc7fc285e IOS7: Add override keyword for OSystem_iOS7 functions 2020-10-11 02:24:31 +01:00
Thierry Crozat
271713cf69 IOS7: Fix reimplementation of OSystem::setGraphicsMode
The signature of the function changed during the ResidualVM merge,
but the iOS7 backend was not updated and still used the old signature.
2020-10-11 02:18:05 +01:00
Cameron Cawley
31be074893 BACKENDS: Add a function to return if the overlay is visible 2020-09-15 00:09:11 +02:00
Thierry Crozat
c50ffd74c6 IOS7: Properly restore state when the process has been terminated 2020-09-13 00:21:36 +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
aryanrawlani28
a647812bfb iOS: Use U32 for clipboards. 2020-08-30 14:43:41 +02: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
b8390fa161 GRAPHICS: Add interface for horizontal shake 2019-11-19 00:20:40 +01:00
Thierry Crozat
468c0f0743 IOS7: Implement isConnectionLimited 2019-08-04 19:03:34 +01:00
Thierry Crozat
cd7bf2b09f IOS7: Implement getSystemLanguage 2019-08-04 19:03:34 +01: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
Thierry Crozat
4795f2b68a IOS: Implement kFeatureVirtualKeyboard to show/hide the keyboard 2019-02-16 17:20:57 +00:00
Colin Snover
d43732ac47 IOS: Replace strdup with Common::String 2018-08-18 16:30:05 +02:00
Adrian Frühwirth
cee4d6b853 JANITORIAL: Fix trailing whitespace 2018-05-24 15:30:55 +02:00
Colin Snover
bda253b1ac BACKENDS: Constify PaletteManager::grabPalette implementations 2017-10-15 13:47:19 -05:00
Thierry Crozat
4a9446490a IOS: Disable idle timer while an engine is running 2016-10-20 22:38:14 +01:00
Vincent Bénony
587d5d5703 IOS: Fixes savegame deletion on sandboxed iOS devices 2016-02-26 09:50:39 +01:00
Johannes Schickel
f8ef5e2476 IOS7: Make includes match our style. 2016-01-07 12:44:48 +01:00