Commit Graph

1268 Commits

Author SHA1 Message Date
libretroadmin c6d72062e2 remove dead code 2025-07-17 08:02:06 +02:00
libretroadmin 2dbb9f62d8 * Change some variable naming conventions
* Make return control paths less dependent on variables
2025-07-11 02:15:12 +02:00
sonninnos b2ca569521 Logging unification cleanups 2025-07-10 05:59:06 +03:00
sonninnos 0785dd7548 Unused variable cleanups 2025-06-15 05:08:24 +03:00
j0ki 482b8241b8
udev_input.c: restore linux terminal in udev_input_free
Linux terminal settings were lost after restarting via menu.
This was caused by udev_input_init calling linux_terminal_disable_input multiple times.

New code follows the restore pattern of linuxraw_input.c
2025-06-06 02:18:20 +02:00
sonninnos a1a50afc9e Dinput: Ignore first mouse click on focus 2025-05-27 23:47:06 +03:00
sonninnos b3fd3e15ed WinRaw: Prevent stuck mouse buttons on unfocus 2025-05-27 22:43:15 +03:00
BinBashBanana 2d3c18e48d Emscripten improvements pt. 4 2025-05-08 11:01:43 -07:00
zoltanvb 1678e25af0 Extend X11 input driver with XInput2 extensions for multi-mouse
Add multi-mouse support for X11, by using XInput2 extensions. Only
master pointers are considered as mice.

New behavior put behind HAVE_XI2 and configure script extended with
necessary detection.
2025-04-13 12:16:53 +02:00
pstef 66aa1424f0 Define WIN32_LEAN_AND_MEAN to avoid collision with winsock2 2025-04-12 10:45:08 +00:00
LibretroAdmin 82d8b9630a
Merge pull request #17750 from BinBashBanana/master 2025-04-10 03:35:45 -07:00
LibretroAdmin 4bf8855fda
Merge pull request #17754 from zoltanvb/udev_to_linuxraw_fallback
Save fallback to linuxraw driver in case of first boot.
2025-04-09 13:26:34 -07:00
zoltanvb 3bbbeca957 Save fallback to linuxraw driver in case of first boot.
When no devices can be detected and it is the initial boot, make
sure the driver is set to linuxraw, if supported.
2025-04-01 21:55:14 +02:00
nfore b9beaa8564 Fix overlay lightgun, mouse & pointer
- Ensure other touchscreen input is blocked when overlay buttons pressed
- Limit physical+overlay mouse input to iOS for now
- Reset overlay mouse deltas when there is no touch input
- Disable touch mouse in android_input.c for now. Too buggy
2025-03-29 08:56:35 -05:00
LibretroAdmin 76598f1016
Merge pull request #17745 from pstef/silence-warnings
Silence warnings
2025-03-29 03:12:00 -07:00
BinBashBanana 05cefc9a4d AudioWorklet driver, misc. emscripten fixes 2025-03-28 19:41:40 -07:00
pstef a25a4d29a8 Silence a -Waddress warning 2025-03-28 09:48:21 +00:00
zoltanvb 5b2904930b Extend keyboard input for linuxraw input driver
The keyboard support for linuxraw driver was a bit spotty. Extended
with missing keyboard query, callback, and a few fixes against
over-indexing the status array.
2025-03-27 15:04:19 +01:00
pstef ac38cfe8da Silence -Waddress
This is a continuation of c9149895f5
2025-03-25 20:06:33 +00:00
LibretroAdmin 4b368ae008
Merge pull request #17664 from BinBashBanana/master 2025-03-08 20:24:15 -08:00
zoltanvb 176247d3bc Remove special handling of pause key 2025-03-06 17:55:37 +01:00
BinBashBanana f6eb1ed5c5 Threaded emscripten improvements 2025-03-05 10:39:43 -08:00
zoltanvb 27b67c1340 Fix keyboard_mapping_blocked usage (game focus) 2025-03-05 06:23:53 +01:00
Eric Warmenhoven e26b3bca4e
allow mouse input while mouse overlay is active (#17615) 2025-02-21 12:33:27 -08:00
Joe Osborn 56014a27d6
Enable pthreads on Emscripten (#17586)
* workerized RA

* Workerized (non-async) web player, using OPFS

This patch eliminates the need for asyncify and uses modern filesystem
APIs instead of the deprecated, unmaintained BrowserFS.

This is a WIP patch because it won't fully work until these two
Emscripten PRs land and are released:

https://github.com/emscripten-core/emscripten/pull/23518
https://github.com/emscripten-core/emscripten/pull/23021

The former fixes an offscreen canvas context recreation bug, and the
latter adds an equivalent to BrowserFS's XHR filesystem (but without
the hazardous running-XHR-on-the-main-thread problem).

The biggest issue is that local storage of users who were using the
old version of the webplayer will be gone when they switch to the new
webplayer.  I don't have a good story for converting the old BrowserFS
IDBFS contents into the new OPFS filesystem (the move is worth doing
because OPFS supports seeking and reading only bits of a file, and
because BrowserFS is dead).

I've kept around the old libretro webplayer under
pkg/emscripten/libretro-classic, and with these make flags you can
build a non-workerized RA that uses asyncify to sleep as before:

make -f Makefile.emscripten libretro=$CORE HAVE_WORKER=0 HAVE_WASMFS=0 PTHREAD=0 HAVE_AL=1

I also moved the default directory for core content on emscripten to
not be a subdirectory of the local filesystem mount, because it's
confusing to have a subdirectory that's lazily fetched and not
mirrored to the local storage.  I think it won't impact existing users
of the classic web player because they already have a retroarch.cfg in
place.

* Get fetchfs working without manifest support

* makefile fixes

* fix scaling, remove zip dependency

* Support asset/cheats/etc downloaders for emscripten

- Add http transfer support for emscripten
  - At the task_http level, not the net_http level --- so no netplay
    or webdav.
- Change default paths to be more like other platforms
- Gives us smaller bundles and a faster boot time
- Had to work around a task queue bug on Emscripten
  - I made the smallest possible change to do it, but it may be better
    to fix in rthread.c

* Load an emscripten file_packager package on first run

If no ozone assets are present, load a libretro_minimal package
created using Emscripten's built-in file packager.

* updated readme, removed indexer from wasmfs libretro-web

* Put back zip dependency, load asset bundle into opfs on first run

* fix upload path

* Remove unused function

* easy testing setup for two multithreaded conditions

1. make PROXY_TO_PTHREAD=1 (slower)
2. make PROXY_TO_PTHREAD=0 (bad audio, because doesn't sleep in
openal.c)

* Remove condition on sleep in openal

also make input_driver check existence of drv->axis, drv->button
before calling them.

* Fix resizing under EGL

* Don't force config file path on emscripten

* Add time.h include to netplay, default HAVE_NETPLAYDISCOVERY to 0

* Remove nearly all proxied joypad calls under emscripten

* Fix file uploads under firefox

* Fix safari API uses, but Safari still hangs in OPFS filesystem mount

I think this can be fixed by moving the backend creation off the main
thread.

* Move filesystem init into emscripten C entry point

* Setup filesystems off of main thread

* re-set default player to async

Also improve Safari compatibility under proxy-to-pthread condition

* Safari upload file fixes

* Remove some excess prints

* Fix typo
2025-02-20 00:59:25 +01:00
Eric Warmenhoven 6ec4ffb2fa
apple, mouse overlay: fix relative mouse deltas (#17602)
makes sure that relative mouse movement deltas are based on last poll,
not last state check; checking state should not reset state
2025-02-20 00:59:14 +01:00
LibretroAdmin f6006ae6ca Style nits 2025-02-12 10:17:35 +01:00
LibretroAdmin 4faed7a84f Less passing around of settings_t pointer 2025-02-09 18:56:50 +01:00
Eric Warmenhoven 4c8da979a5
fix a couple minor warnings (#17526) 2025-02-06 20:22:36 +01:00
LibretroAdmin 2870a0a8ad
Revert "Workerized emscripten retroarch (WIP) (#17484)" (#17492)
This reverts commit cacd5a9a23.
2025-01-30 21:35:58 +01:00
Joe Osborn cacd5a9a23
Workerized emscripten retroarch (WIP) (#17484)
* workerized RA

* Workerized (non-async) web player, using OPFS

This patch eliminates the need for asyncify and uses modern filesystem
APIs instead of the deprecated, unmaintained BrowserFS.

This is a WIP patch because it won't fully work until these two
Emscripten PRs land and are released:

https://github.com/emscripten-core/emscripten/pull/23518
https://github.com/emscripten-core/emscripten/pull/23021

The former fixes an offscreen canvas context recreation bug, and the
latter adds an equivalent to BrowserFS's XHR filesystem (but without
the hazardous running-XHR-on-the-main-thread problem).

The biggest issue is that local storage of users who were using the
old version of the webplayer will be gone when they switch to the new
webplayer.  I don't have a good story for converting the old BrowserFS
IDBFS contents into the new OPFS filesystem (the move is worth doing
because OPFS supports seeking and reading only bits of a file, and
because BrowserFS is dead).

I've kept around the old libretro webplayer under
pkg/emscripten/libretro-classic, and with these make flags you can
build a non-workerized RA that uses asyncify to sleep as before:

make -f Makefile.emscripten libretro=$CORE HAVE_WORKER=0 HAVE_WASMFS=0 PTHREAD=0 HAVE_AL=1

I also moved the default directory for core content on emscripten to
not be a subdirectory of the local filesystem mount, because it's
confusing to have a subdirectory that's lazily fetched and not
mirrored to the local storage.  I think it won't impact existing users
of the classic web player because they already have a retroarch.cfg in
place.

* Get fetchfs working without manifest support

* makefile fixes
2025-01-30 19:58:18 +01:00
BinBashBanana ed1810de86
Emscripten improvements (#17422) 2025-01-29 05:29:16 +01:00
Eric Warmenhoven 04cdf0aa4d
apple: acceleration should include gravity (#17467) 2025-01-24 18:05:32 +01:00
Eric Warmenhoven f1e3b83d26
macos: reset keyboard state when focus is lost (#17453) 2025-01-21 22:31:24 +01:00
LibretroAdmin cde82f532c * Naming convention changes for variable names/function arguments
* Try to fit lines within ANSI 80-char limit
2025-01-19 20:19:14 +01:00
LibretroAdmin 984d591573 Silence some warnings 2025-01-18 01:48:33 +01:00
LibretroAdmin 47d888364d Standardize len variables - argument should always be named 'len',
while local len variables should have '_' prefix
2025-01-13 21:53:49 +01:00
sonninnos 17e9aabd25
WINRAW: Invert mouse order (#17376) 2025-01-10 12:21:33 +01:00
zoltanvb ab3b175848
Restore missed absolute mouse conversion. (#17343) 2025-01-05 03:50:47 +01:00
zoltanvb 401e169865
Pointer sanitization, rwebinput driver (#17327) 2025-01-01 23:14:42 +01:00
Ignacio Sanchez Gines b5a62fcdf8
Add lightgun support to cocoa input driver (#17318) 2025-01-01 23:11:08 +01:00
zoltanvb b66263a034
Adapt the sanitized pointer handling, discussed at libretro#17196 : (#17312)
Cocoa driver specific changes:

- make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
- enable pointer offscreen query
2024-12-30 23:50:02 +01:00
zoltanvb fe1575bc54
Input sanitization, wayland enhancement and overlay (#17308)
Adapt the sanitized pointer handling, discussed at #17196 :

Overlay "driver" specific changes:

- make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
- enable pointer offscreen query
- report -0x8000 for lightgun if pointer is at the edge
- align lightgun offscreen reporting and button ID conversion with other drivers

Android driver specific changes:

- make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
- remove extra "inside" checks, general simplification
- enable pointer offscreen reporting
- report same value for all ports when querying mouse and lightgun
- fill missing lightgun support, with fixed button map

Udev and X11 driver specific changes:

- simulate max. 3 touches instead of 1 using different mouse buttons

Wayland driver specific changes:

- integrate touch input better to the overall handling (enabling overlay usage with mouse)
- simulate max. 3 touches instead of 1 using different mouse buttons
2024-12-29 18:57:27 +01:00
zoltanvb ac6b30471b
Pointer sanitization - sdl (#17286) 2024-12-25 17:55:13 -06:00
zoltanvb e5fde4dd09
Pointer sanitization - winraw, dinput, sdl (partial) (#17283)
Adapt the sanitized pointer handling, discussed at libretro#17196 :

winraw and dinput driver specific changes:

    make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
    remove extra "inside" checks, general simplification
    enable pointer offscreen reporting
    use common functions for edge detection and lightgun button ID conversion

sdl driver specific changes:

    pointer handling aligned with the other input drivers, as above
    added TODO for lightgun part - no suitable test env at the moment where SDL input can be used
2024-12-25 08:18:17 -08:00
libretroadmin 44238e909f Consistent viewport naming conventions 2024-12-24 22:50:51 +01:00
zoltanvb 6a85844b41
Pointer sanitization - x11, udev (#17281)
Adapt the sanitized pointer handling, discussed at #17196 :

X11 driver specific changes:

    make sure pointer position is always within [-0x7fff,0x7fff] by using the confined wrapper
    remove extra "inside" checks, general simplification
    enable pointer offscreen reporting

Udev driver specific changes:

    remove custom calculation and use common viewport translation
    unify pointer query instead of separate _x and _y
    enable pointer offscreen reporting

Other changes:

    more tuning of pointer conversion in video_driver.c for edges
    lightgun button ID conversion moved to input_driver.c
2024-12-24 07:08:58 -08:00
zoltanvb 072d949346
Pointer handling sanitization - wayland and libretro.h changes (#17277)
Adapt the sanitized pointer handling, discussed at #17196:

Wayland driver specific changes:
- make sure pointer position is always within [-0x7fff,0x7fff]
  by using the confined wrapper
- enable lightgun to report -0x8000 if pointer is really offscreen
- remove extra "inside" checks
- report same pointer/lightgun coordinates for all ports
- simplify pointer and lightgun handling

Other changes:
- unify "offscreen" condition through input_driver.c
- slight tuning of pointer conversion in video_driver.c
- update libretro.h with explanation and pointer offscreen value
- small fixes on remote retropad test screen
2024-12-21 13:28:27 -08:00
zoltanvb 30a656738b
Introduce video_driver_translate_coord_viewport_wrap clamping variant. (#17196)
Add another version of the coordinate translation that will not
report -0x8000 for offscreen values, but instead map the position
to the respective edge (0x7fff/-0x7fff). Not yet in use.

Udev driver updated to use the wrapper, as all other input drivers do.
2024-12-19 13:30:43 -08:00
Jesse Talavera d682917e44
Add Linux support for illuminance sensors (#17208)
* First crack at light sensor support for Linux

* Add light-sensor support to most Linux input drivers

* Fix a compiler error

- Whoops, forgot to declare `sdl`

* Refactor linux_illuminance_sensor_t

- Allow the poll rate to be specified
- Poll the sensor on a separate thread
- Open a file handle each time we poll the sensor, since sysfs doesn't update the contents of an existing handle

* Set the `done` flag when closing the light sensor

- Whoops

* Avoid a division by zero when updating the poll rate of an existing sensor

* Don't try to open illuminance sensors from ".", "..", or hidden files

* Never mind

* Fix some silly mistakes

* Skip hidden files, ".", and ".."

* Cancel the sensor poll thread mid-sleep when closing it

- POSIX says it's fine

* Add to CHANGES.md

* Address feedback given on PR

* Use libretro-common's file system instead of stdio
2024-12-17 05:49:39 -08:00