Commit graph

88 commits

Author SHA1 Message Date
Le Philousophe
5d58196643 ANDROID: Merge ScummVMEventsModern and ScummVMEventsBase
The split was done to allow to support versions before HONEYCOMB_MR1 but
we don't support these versions anymore.
2024-11-12 22:39:58 +01:00
antoniou79
f9251fc030 ANDROID: Improve multitap gesture handling for direct touch mode
More guards were added to hopefully link the mouse down and up events that should be executed in sequence, albeit delayed

Also a new case was added for a delayed mouse up event (in JE_MULTI) to avoid it being executed out of order / too soon.
2024-11-07 17:50:47 +02:00
Hubert Maier
4533e12280 JANITORIAL: BACKENDS: Fix typos 2024-09-16 02:13:34 +03:00
Le Philousophe
867cbfcd0d ANDROID: Create a dedicated define for Android backend
This allows other backends (SDL, libretro) to be used on Android without
hacks.
2024-09-02 20:53:57 +03:00
Le Philousophe
3a57523490 ANDROID: Avoid use-after-free when setting up touch mode
We set up touch mode in graphics managers constructor.
At this point, the _graphicsManager variable was pointed to the freshly
deleted old manager instead of being null.
When we are in this position, assume the cursor is at top left.
2024-06-22 20:23:49 +02:00
Hubert Maier
4ac44129fe JANITORIAL: Fix auxilliary typo in events.cpp 2024-05-18 13:52:31 +02:00
antoniou79
9f4a32f88b ANDROID: Remove hack for virtual keyboard arrow key repeats
This hack was simulating repeated key presses (EVENT_KEYDOWN, then EVENT_KEYUP) for the arrow keys like the ones a physical keyboard sends

The hack could potentially cause further issues like spamming the events queue with many unnecessary events, and sending the events too quickly for some engines to handle
(thus missing some of them). We're now making use of the allowKbdRepeats() for the Up/Down/Left/Right event actions in the gui-manager, which will handle the case of a key
being kept pressed, sending an initial EVENT_KEYDOWN event and then subsequent EVENT_KEYDOWN events with the kbdRepeat flag set, and finally a single EVENT_KEYUP in the end.
Android itself handles repeated key events similarily (instead of a kbdRepeat flag, it updates a counter for the key repeats, which we translate to a simple flag).

This (and the hack that this replaces) affect things like moving the selection in the GUI lists (like the added games list) upwards or downwards continuously
while keeping the respective arrow key from the Android virtual keyboard pressed down.
2023-08-29 04:30:00 +03:00
antoniou79
b347be081c ANDROID: Support two finger touch mouse wheel 2023-08-11 16:52:06 +03:00
antoniou79
ba815489f8 ANDROID: Add delay for jump move and mouse down in direct multitouch
This fixes right click and hold behavior to choose a verb action from the "verb coin" in tony tough

Previously, in direct touch mode, the action selected would refer to the previous item that was under the cursor
before the jump to the new touch point.
2023-08-11 16:52:06 +03:00
antoniou79
fbf91a4b28 ANDROID: Add another delay (move to button down) for direct touch mode
Some engines seems to also expect such a delay (tested with Curse of Monkey Island and Tony Tough).

Without this added delay, direct touch mode would work ok in the launcher and GMM GUI but in-game there would be issues.
In Curse of Monkey Island, early difficult selection screen, it was not possible to select the difficulty with a simple tap (direct touch mode).
And in gameplay proper, a simple tap would move the cursor to the touched position but Guybrush would walk to the last position of the cursor (before it jumped to the new one)
Tony Tough had similar issues with its menu.
2023-08-08 10:56:53 +03:00
antoniou79
7959c431aa ANDROID: Make virtual keyboard arrow keys similar to physical
Basically treats the arrow keys from the virtual keyboard in a special manner

It translates them to KEYCODE_UP(/DOWN/LEFT/RIGHT) and if held down sents consecutive KEYUP / KEYDOWN events
instead of the previous behavior of setting the kbdRepeat flag and just sending repeated KEYDOWN events and one final KEYUP.
Previous behavior would result in poor navigation on lists when the arror keys were held down. The new system works better.
2023-08-07 17:31:02 +03:00
antoniou79
95f1ca2847 ANDROID: Fix double tap and right click hold for direct mouse mode
Also re-work slightly the system for handling the delayed mouse up touch event
2023-08-07 17:31:02 +03:00
Le Philousophe
a58bac8ccb ANDROID: Avoid calling native code from UI thread
This can lead to race conditions.
When synchronizing virtual keyboard state, just set a variable in UI
thread.
The variable will be read in worker thread during event polling, this
will ensure that graphics code is configured at a proper time.
2023-07-14 11:22:06 +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
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
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
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
Antoniou Athanasios
12c5b7bb2b ANDROID: Improve support for gamepads and joysticks
Detect motion on DPAD (HATs), and on right stick as separately from the left stick

Also detect left and right trigger presses (when available)
2023-04-04 22:16:24 +03:00
antoniou79
64797234e6 ANDROID: Add Control tab for mouse pointer speed
and joystick deadzone. By supporting kFeatureKbdMouseSpeed and kFeatureJoystickDeadzone and registering default values

Both of these config settings (kbdmouse_speed, joystick_deadzone) factor in virtual mouse movement.

Helps handle virtual mouse pointer speed when controlled with DPAD or is too fast for the user
2023-04-02 21:55:56 +03:00
antoniou79
d813908b54 ANDROID: Support physical mouse wheel up-down
Tested and works with physical mouse but does not work with Android Studio emulated device
2023-04-02 00:50:00 +03:00
antoniou79
7d6a1fcbaa ANDROID: Treat DPAD keypresses as JOYSTICK_DPAD
Mapped by default to virtual mouse movement
2023-03-31 23:13:16 +03:00
Antoniou Athanasios
8ce6a32ac2 ANDROID: Clean up log code and use Backends::Log 2023-03-26 12:05:12 +03:00
antoniou79
057709fffb ANDROID: Basic support for some TV remotes
And some fixes for DPAD handling

More fixes for DPAD will be coming. We currently don't handle DPAD Center, and also do not handle the case where DPAD is HATs (motion events)
2023-03-25 00:03:47 +02:00
antoniou79
d6b2f6850a ANDROID: Revert "ANDROID: Support FireTV remote"
This reverts commit 16f626401e

It was accidentally pushed, while not being ready yet.
2023-03-22 22:19:58 +02:00
Antoniou Athanasios
16f626401e ANDROID: Support FireTV remote 2023-03-22 21:46:48 +02:00
Le Philousophe
a465718c24 ANDROID: Fix comment
For coherence sake
2023-01-20 14:14:03 +01:00
Rudis Muiznieks
930028522e ANDROID: Simplify Joystick axis scaling
The scaling of Joystick axis values has been moved to the Java event
handler.
2022-12-19 00:36:51 +00:00
Rudis Muiznieks
c33a65e32b ANDROID: Map Joystick inputs to Joystick events
Previously joystick motion inputs were being translated to direct mouse
movement events. This changes those into Joystick AXIS events instead.
Also updates joystick button inputs into joystick button events instead
of mouse clicks and key presses.
2022-12-19 00:36:51 +00:00
Rudis Muiznieks
fb9416eacb ANDROID: Map gamepad inputs to joystick events
Previously most buttons were being ignored and A and B were mapped to
mouse clicks. This maps A and B and several more buttons to Joypad
button presses instead.
2022-12-19 00:36:51 +00:00
Hubert Maier
a10cbd3199
BACKENDS: Correct spelling mistake
occured -> occurred
2022-10-27 15:56:04 +02:00
Le Philousophe
57e27dcf12 ANDROID: Let user customize its preferred touch modes
There are 3 settings: in menus, in 2D games, in 3D games
2022-06-14 00:08:04 +03:00
antoniou79
62c2e13650 ANDROID: Set relMouse for touch scroll events
Needed for Myst 3 mouse look, probably other games too

This should be followed up by similar update of relMouse for the cases of mouse look using a hardware mouse, a joystick, trackball, pen etc. We should also check if we need to do this for the cases of moving the mouse while holding down a button and for multitouch events that emulate that (eg. hold two fingers down and move).
2021-12-26 22:22:15 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Le Philousophe
e7b6cff4dd ANDROID: The virtual controls now generate fake joystick events
This allows to use the keymapper and not have hardcoded keyboard events
2021-11-29 00:04:45 +01:00
Le Philousophe
d6f37a161b ANDROID: Remove again updateEventScale
It was removed in android in #1695 but not in android3d in ResidualVM.
2021-11-29 00:04:45 +01:00
Le Philousophe
5d56c1cdf0 ANDROID: Merge 3D graphics backend
Move each graphic part in backends/graphics and backends/graphics3d
2021-11-29 00:04:45 +01:00
Matthew Duggan
fc6ab2b3e0 ANDROID: Revert Compilation fix due to Point field changes
This reverts commit e3151e69aa.

The Rect change that needed this change has now been reverted, so revert this
too.
2021-07-07 20:45:52 +09:00
Paul Gilbert
e3151e69aa ANDROID: Compilation fix due to Point field changes 2021-07-04 20:45:15 -07:00
Cameron Cawley
c1702a0953 ANDROID: Add an on-screen menu button 2021-06-19 14:37:35 +02:00
antoniou
987becc529 ANDROID: Fix physical mouse behavior and allow multitouch hold and drag
Also added various comments to document behavior.

Minor JE_MULTI event (Fix concerned bad brackets code in the events.cpp for JE_MULTI (multiple fingers held down)
) fix and comments for mouse behavior
Allow onHover to catch the mouse events instead of OnTrackBallEvent()
Also the "system back" button is ignored for the Trackball too because we treat it as mouse in isMouse(e) check
Add multitouch handler class. Handling and early filtering of multitouch events is moved in the new class.
2021-01-10 22:10:29 +02:00
antoniou
411407abf8 ANDROID: Restore check for Alt modifier in key events
And add checks for Meta, Caps, NumLock, Scroll lock modifiers too
2020-11-25 16:41:47 +02:00
antoniou
64eb1c0afe ANDROID: A tentative handling of handling joystick control
Basically as a virtual mouse
2020-10-25 02:30:32 +03:00
Cameron Cawley
f59091c1e4 ANDROID: Use the input enums from the system headers 2020-10-09 07:57:08 +03:00
antoniou
bf54ea041b ANDROID: Fix for buggy backspace behavior in TYPE_NULL inputType
Code taken from https://stackoverflow.com/a/19980975
2020-10-01 00:06:20 +03:00
Cameron Cawley
cf068bcc08 ALL: Remove direct use of OSystem::createMutex() 2020-08-21 09:39:00 +02:00
Cameron Cawley
27e8467b28 ANDROID: Add support for additional mouse buttons 2020-04-07 13:55:30 +03:00
Cameron Cawley
fffb25a47a
ANDROID: Add basic keymapper support (#2026)
* ANDROID: Remove hard-coded key mappings

* ANDROID: Add default key bindings
2020-02-26 10:23:47 +02:00
Cameron Cawley
c9824ad206 ANDROID: Improve handling of system keys
- Unrecognised system keys are treated as regular keys.
- Key down events are always sent when pressing the Menu or Back buttons.
2020-01-20 21:36:05 +00:00
Cameron Cawley
24b9e9f390 ANDROID: Remove old and broken keymapper code
This isn't needed after commit 665e472.
2020-01-20 13:54:41 +00:00
Thanasis Antoniou
d105041d80 ANDROID: Long press for back button has an alternate (menu button) function 2019-12-14 15:04:43 +02:00