9550 Commits

Author SHA1 Message Date
Giovanni Cascione
3d67e4bcc1 LIBRETRO: add empty audio buffer to use for GUI framerate control 2023-07-11 01:19:25 +02:00
Giovanni Cascione
d18ad98339 LIBRETRO: add framerate cap setting 2023-07-11 01:19:10 +02:00
Giovanni Cascione
7d846d9a82 LIBRETRO: switch thread in GUI on poll event only 2023-07-11 01:18:55 +02:00
Giovanni Cascione
f86ca443dd LIBRETRO: set auto frameskip based on frame time 2023-07-11 01:18:42 +02:00
Giovanni Cascione
968adcb49d LIBRETRO: drop min_auto_frameskip 2023-07-11 01:18:24 +02:00
Giovanni Cascione
e4f6f5d7f8 LIBRETRO: simplify timer 2023-07-11 01:18:05 +02:00
Giovanni Cascione
e2b5bc1f67 LIBRETRO: merge cons scr updates w timing inaccuracies setting 2023-07-11 01:17:49 +02:00
Giovanni Cascione
edfd3d0b10 LIBRETRO: add min_auto_frameskip reset 2023-07-11 01:17:20 +02:00
Le Philousophe
5a84a5fdc1 BACKENDS: OPENGL: Rework shader assets search
Determine in which archive the shader is located and load assets from
the same archive.
When using a FSNode, use the filesystem code to build the base path.
Use a Path object to store the base path to allow proper join of
components.
2023-07-09 21:41:58 +02:00
antoniou79
e9db16350e ANDROID: Don't use the long press haptic feedback for multitouch 2023-07-09 17:51:40 +03:00
Le Philousophe
e3877d2606 ANDROID: Move game at the top of screen when keyboard is shown 2023-07-09 11:48:27 +02:00
Le Philousophe
e62b59f16c ANDROID: Synchronize keyboard status between Java and C++
Without this, if keyboard is displayed by the user, the C++ side never
knows about it.
2023-07-09 11:48:27 +02:00
Le Philousophe
4c13924a38 BACKENDS: Let the backend define how screen should be placed 2023-07-09 11:48:27 +02:00
Lars Sundström
1b3c783b9e IOS7: Update current orientation before animation completes
The overided viewWillTransitionToSize instance method did update the
current orientation when animation to the new orientation completed.
However, that made the handling of safe areas on devices having such,
e.g. iPhones with the sensor bar on top, racy. The correct orientation
was set after the adjustViewFrameForSafeArea function was called.

Set the new orientation before the animation completes.
2023-07-08 18:49:54 +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
147d41b360 IOS7: Add screen orientation settings to backend menu tab
Add options to let the user configure the screen orientation when
in games and in launcher. The option can be set per game as well
to allow for some games to start in landscape mode while others
in landscape mode.

This commit implements the options in the backend menu tab. The
code is very much similar as the one implemented in the Android
backend.
2023-07-08 18:49:54 +02:00
Thierry Crozat
885ee122c7 IOS7: Factorize code to get the interface orientation 2023-07-08 18:49:54 +02:00
Le Philousophe
36418c7ebd ANDROID: Increase timeout to trigger middle click to 1.5s 2023-07-06 20:54:39 +02:00
Le Philousophe
c2ee0fb250 ANDROID: Notify user when a touch will trigger a right or middle click 2023-07-06 20:54:29 +02:00
Thierry Crozat
481f849c5a IOS7: Fix hiding keyboard in portrait mode when not in game 2023-07-04 23:14:49 +01:00
Le Philousophe
7f0d75bbfc ANDROID: Fix cursor position in touchpad mode while rotating
Without this, the cursor ends up in limbo and you need to scroll several
times to make it appear again.
2023-07-04 21:09:13 +02:00
Thierry Crozat
e73b277589 IOS7: Add missing file in module.mk
The iOSGraphics3dManager uses the OpenGL::FrameBuffer class, so the
corresponding code needs to be compiled for the ios7 backend.
2023-07-03 22:09:25 +01:00
Lars Sundström
06e231a649 IOS7: Show keyboard automatically when in game and portrait mode
Open the iOS system keyboard automatically when starting a game and
screen orientation is portrait. If orientation changes to portrait,
open the keyboard automatically only if game is running.
2023-07-03 21:50:32 +02:00
Lars Sundström
3ee048d922 IOS7: Update logic for touch events for Apple TV remote
The Apple TV remote sends touch events of type UITouchTypeIndirect
since it's not touches made on the screen. In iOS touchpads might
send UITouchTypeIndirect touch events as well as mouse move events.

So in iOS we want to block touches of type UITouchTypeIndirect
while in TV OS we want them to be handled.

Touchpad mode for touch events is also required for the Apple TV
remote to work properly. Make sure to disable the possibility to
disable touchpad mode in TV OS.
2023-07-03 21:50:32 +02:00
Lars Sundström
d8bc349b37 IOS7: Resize main frame depending on keyboard size and orientation
It's important that the main frame, displaying the OpenGL rendered
graphics, has the proper dimensions and depending on the device
orientation. It's also important that the frame is not covered by
the iOS keyboard.

This commit calculates the frame size depening on the orientation
and the keyboard status. The keyboard knows its parent view and
can resize it when the keyboard becomes visible or hidden.

There are multiple scenarios where the frame size is changed.
 - When the keyboard is hidden/shown which can be automatically
   change depending on the device orientation
 - If the system demands the keyboard to get visible or hidden
 - When rotating the device
 - When suspending/resuming the application

There can also be combination of the scenarios above, e.g. if
suspending the application in landscape mode and resume it in
portrait mode.

A lot of effort has been put into testing different scenarios to
verify that the screen size becomes correct. However there might
be some scenario which has not been covered.
2023-07-03 21:50:32 +02:00
Lars Sundström
5d5564fceb IOS7: Hide word suggestion list in newer iOS versions
Since iOS 15 or 16 both auto correction and spelling check have to
be disabled to hide the word suggestion list above the keyboard.
2023-07-03 21:50:32 +02:00
Lars Sundström
598bc231ab IOS7: Cancel pending button if touch is moved within 250 ms
If not in "click-and-drag" mode, left mouse button down and up
events are sent on touches ended if the touch lasted less than
250 ms. If the touch lasted longer it was considered as a move
and no button events are sent.

This commit mimic that behaviour in touchpad mode when "click-
and-drag" mode is enabled. The left mouse button down event is
queued for 250 ms. If the touch is dragged within 250 ms it is
considered as a move and the queued mouse button down event is
cacelled. If no movement is made withing 250 ms the queued
mouse button event is processed.
2023-07-03 21:50:32 +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
6a74f7b32b IOS7: Implement iOSGraphics3dManager
Add a graphic manager rendering 3D graphics for engines supporting
3D games. The manager is implemented using the 3D graphic managers
for Android and SDL as models.

Most probably Android and iOS can share much more of the code, but
that will be a separate work to refactor.
The iOSGraphics3dManager handles resize since the screen dimension
changes on rotation.

Games not supporting arbitary resolutions, e.g. Grim, are rendered
on an intermediate framebuffer with the size requested by the
engine and then rendered to the backbuffer (a framebuffer bound to
the renderbuffer) and stretched to the screen resolution off the
device.

This commit just adds the manager. It will be utilised in next
commit.

Update gitlab ci worker and update documentation.
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
d36074773b IOS7: Add internal event for signalling screen changes
When the screen dimension changes, e.g. on rotation of the device,
the graphic manager has to be informed of the new dimension to be
able to resize the surfaces.

To quickly redraw the entire screen, Common::EVENT_SCREEN_CHANGED
event is passed to the event handler.
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
208aa43d5b IOS7: Render openGLContext
Implement callbacks to set up OpenGL context, destroy context, get
scale factor and screen sizes. Implement rendering of graphics drawn
by the iOS graphicsManager.

This commit will enable graphics to be shown again. Screen rotation
and mouse movements are still to be adapted.
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
Le Philousophe
adda0dc063 BACKENDS: OPENGL: Allow the backend to specify the render target
For now only backbuffer is used.
2023-07-03 21:50:32 +02:00
Le Philousophe
10714db6f0 BACKENDS: OPENGL: Make setSize a Framebuffer function 2023-07-03 21:50:32 +02:00
Le Philousophe
f337abae70 BACKENDS: SDL: Remove superfluous ifdef
This block is already dedicated to SDL_BACKEND
2023-07-03 21:50:32 +02:00
Le Philousophe
ce5427960c ANDROID: Remove leftover declaration 2023-07-01 17:52:30 +02:00
Le Philousophe
7d816c23db ANDROID: Reload keyboard on display configuration change
This ensures that keyboard is properly resized
2023-07-01 16:26:19 +02:00
Le Philousophe
d371b50d30 ANDROID: Add setting to to disable screen rotation 2023-07-01 16:26:19 +02:00
Le Philousophe
3a838c99f9 ANDROID: Various small fixes
- Comment and space fixes
- Remove outdated setting
2023-07-01 16:26:19 +02:00
Le Philousophe
1cffb9c86a ANDROID: Don't make GL calls when there is not context
This is forbidden by EGL specification
2023-06-26 15:25:27 +03:00
Le Philousophe
79da015e8f ANDROID: Various fixes to textures
- Don't create texture in constructor: it's called before the context is
  created
- Don't leak texture names when calling reinit()
- Fix allocBuffer return condition
- Don't call GL if there is no texture object
- Make sure all textures are released and inited
2023-06-26 15:25:27 +03:00
Le Philousophe
8e731782cc ANDROID: Fix ifdef
isRunningInMainThread is used by GLTHREADCHECK when ANDROID_DEBUG_GL is
defined
2023-06-26 15:25:27 +03:00
Cameron Cawley
33b09af3b2 ANDROID: Allow screen rotation 2023-06-26 15:25:27 +03:00
Le Philousophe
bc438d078a ANDROID: When resizing don't reset everything
Only reinitialize the needed bits.
EGLSurface needs to be reset to take the new size into account.
GLSurfaceView in AOSP does the same thing.
2023-06-26 15:25:27 +03:00
Le Philousophe
560793e571 ANDROID: Don't warp mouse when showing overlay in game 2023-06-26 15:25:27 +03:00
Le Philousophe
14d57b2b61 ANDROID: Don't use a framebuffer when it's not needed
This also fixes a bug in frame buffer placement in vertical aspect ratio
2023-06-26 15:25:27 +03:00
Le Philousophe
75b3be75b3 ANDROID: Don't improve score when bits is not enough 2023-06-26 15:25:27 +03:00