Commit Graph

726 Commits

Author SHA1 Message Date
sonninnos ee11b79738
Improve playlist thumbnail cycling (#17897)
* Improve playlist thumbnail cycling

* GLUI: Thumbnail cycling fixes
2025-05-13 22:14:49 +03:00
pstef d6cc1847bf Finish converting to SOCKET type in _WIN32 code
fixes c048a21
2025-04-12 10:45:08 +00:00
pstef c048a21aa4 Use platform-specific checks for invalid descriptors
Check network fd/socket validity using INVALID_SOCKET on Windows
(requiring conditional winsock2.h include) and < 0 otherwise.
Fixes -Wsign-compare warning.
2025-04-10 21:10:45 +00: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
pstef 626ef6ce4b Remove unused variable
It would be used only once in this context, so just remove it.
2025-03-27 18:33:55 +00:00
sonninnos b62cc87e84
Turbo Fire overhaul (#17633) 2025-02-27 20:15:22 -08:00
Joe Osborn c413bcc626
Threaded emscripten fixes (#17614)
* Actually read CLI args in emscripten

* Fix fetchfs manifest parsing, increase download chunk size

The chunk size should probably be made a parameter in the future.  The
larger chunk size trades longer hitches for fewer hitches.

* Add exec command driver and API functions for emscripten.

Under WASMFS, stdin/stdout can't be customized the way they can with
the JS FS implementation.  Also, this approach frees up stdin/stdout
and simplifies interaction with the command interface for web embedders.

* fixup upload paths, show use of new emscripten cmd interface

* Add JS library function names to EXPORTS as well as EXPORTED_FUNCTIONS for older emsdk versions
2025-02-24 09:25:05 -08:00
Eric Warmenhoven 84eb4f32e0
Small adjustment to coordinating mouse inputs (#17622) 2025-02-23 04:25:29 -08: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 7a7c4df2a1 Settings cleanups 2025-02-10 17:12:02 +01:00
neil4 05f75b83c1
Overlays: Improve Analog Recentering (#17505)
- Use closest point on zone perimeter if first touch is outside zone
2025-02-02 01:27:18 +01:00
Mathieu Poliquin 66e23fca79
New feature: Override player input with machine learning models (#17407)
* Add dummy game ai subsystem

* First working prototype of a machine learning model that can override player input

* Update README.md

* Update README.md

* Fix loading path on Windows

* Change ai override to player 2

* Added quick menu show game ai option

* Implemented Quick Menu entry for Game AI options

* Redirect debug logs to retroarch log system + properly support player override

* Added support to use framebuffer as input to the AI

* Added pixel format parameter to API

* Fix game name

* code clean-up of game_ai.cpp

* Update README.md - Windows Build

* Update README.md

* Update README.md

* Update README.md

* Update config.params.sh

turn off GAME_AI feature by default

* Fix compile error in menu_displaylist.c

* Add missing #define in menu_cbs_title.c

* Added new game_ai entry in griffin_cpp

* Remove GAME_AI entry in  msg_hash_us.c

* Fix compile error in menu_displaylist.h

* Removed GAME AI references from README.md

* Fixes coding style + add GameAI lib API header

* Convert comment to legacy + remove unused code

* Additional coding style fixes to game_ai.cpp

* Fix identation issues in game_ai.cpp

* Removed some debug code in game_ai.cpp

* Add game_ai_lib in deps

* Replace assert with retro_assert

* Update Makefile.common

* Converting game_ai from cpp to c. First step.

* Convert game_ai from CPP to C. STEP 2: add C function calls

* Convert game_ai from CPP to C. Final Step

* Added shutdown function for game ai lib

* Update game_ai_lib README

* Fix crash when loading/unloading multiple games
2025-01-21 13:05:43 +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 9bff7168e8 (input_driver.c) Style nits 2025-01-18 03:11:24 +01:00
sonninnos aefadc04c7
Analog to Digital refactor (#17429) 2025-01-18 02:19:01 +01:00
LibretroAdmin 984d591573 Silence some warnings 2025-01-18 01:48:33 +01:00
LibretroAdmin 047e04ed3e Standardize local len variable naming conventions 2025-01-15 15:00:12 +01:00
neil4 6412f4feef
Overlay: Add Analog Recentering Zone (#17339) 2025-01-04 03:19:02 +01:00
neil4 2ffe9fe15c
Overlay lightgun fixes (#17340)
- Fix the "Allow Off-Screen" setting not working since #17308
- Prevent offscreen shot from disabling the lightgun with some cores
- Fullscreen pointer coordinates no longer needed
2025-01-04 03:18:38 +01:00
Eric Warmenhoven 7161069cfc
overlay: reinitializing was causing the wrong overlay to show (#17331) 2025-01-02 07:24:57 +01:00
LibretroAdmin ae7951445a Remove unused variables 2024-12-31 11:49: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
LibretroAdmin 18c85b5ccd Cleanups -
* Less string copies
* Some general cleanups
* Add extra param to runloop_message_queue_push so we can pass size_t
of the message
* Consistent conventions for local variable usage for certain things
2024-12-27 15:13:45 +01: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
sonninnos dc7e8e1811
Prevent stuck Game Focus dupe keyboard event (#17273) 2024-12-20 09:38:01 -08:00
libretroadmin 17fc55c762 fill_pathname_parent_dir_name - small cleanups 2024-12-19 21:05:43 +01:00
Eric Warmenhoven 7e49b3d3d3 overlay: fix crash on null pointer 2024-12-16 15:59:32 +01:00
redenvelope2000 7be52caff8
Update input_driver.c to improve the classic toggle turbo function (#17252)
Changed the logic of the classic toggle turbo mode code such that the pressing order of the turbo button and the button to enable/disable does not matter.
2024-12-15 09:23:59 -08:00
Eric Warmenhoven 48f156fefe
Fix uninitialized variable (#17256) 2024-12-13 09:55:38 -08:00
Eric Warmenhoven cf986c0424
overlay: don't rely on menu entry, it can be misleading (#17247) 2024-12-10 22:32:15 -08:00
Eric Warmenhoven f83841df38
probably fix crash setting overlay (#17243) 2024-12-09 20:47:29 -08:00
Eric Warmenhoven 99c2676efa
Add option to load overlay based on system name (#17233) 2024-12-07 23:58:33 -08:00
libretroadmin 2809421d4e Revert "static variables are initialized to '0' automatically as per C rules"
This reverts commit 2a0984b6e4.
2024-11-19 03:03:13 +01:00
libretroadmin 2a0984b6e4 static variables are initialized to '0' automatically as per C rules 2024-11-18 15:33:34 +01:00
sonninnos c27075d9d6
Ignore other hotkeys with menu toggle (#17165) 2024-11-06 00:19:00 -08:00
Joe Osborn fbf2c70e0d
replay format extended to support external tools (#17042)
- replays now start each frame with the number of key events (8 bit
unsigned int, then key events) and the number of input events (16 bit
unsigned int, then the input events)
- this makes it possible to parse replay files without any core
loaded, and makes replays more portable if cores change their polling
strategies
- external tools can now parse replay files
- old (vsn 0) replays will still play back, but new (vsn 1) replays
will not play on old RA
- replay files grow faster now, with each input poll now taking 8
bytes instead of 2
2024-10-04 12:47:34 -07:00
Viačasłaŭ 3019b926c2
Fix typos (#17068) 2024-10-01 17:36:33 -07:00
Joe Osborn abe7d01e74
Report replay frame number for active_replay stdout api (#17039)
This changes the replay movie's frame_ptr (a 20-bit number used to
point to a log of file offsets) into a frame counter, which is masked
against the 20-bit pattern for use in the file offset log but also
functions as a time index into the replay.  Right now that is reported
in `GET_CONFIG_PARAM active_replay` but in the future it could be used
to show how far into the replay we are during playback or how long the
replay is during recording.
2024-09-27 14:37:31 -07:00
zoltanvb 4e063934fd
Add option to disable analog stick menu navigation (#16743)
Two new settings added to Settings / Input / Menu Control:
- disable left analog stick in menu navigation
- disable right analog stick in menu navigation

Since the corresponding logic is already a distinct logic flow in
input driver, no change was necessary to analog-to-digital settings
or the like.
2024-09-10 18:13:31 -07:00
libretroadmin e675ea7e29 Variable cleanups - add TODO/FIXME notes for spurious variable sizes 2024-09-09 15:22:08 +02:00
Eric Warmenhoven fdf2faaf59
macOS: Don't include video/input drivers when compiling with SDL2 (#16865) 2024-08-10 17:56:03 -07:00
zoltanvb e5e7e66199
Add sensor function placeholders for all joypad drivers. (#16812)
In some cases, set_sensor_state and get_sensor_input are
more related to the joypad driver, e.g. in desktop platforms
where sensors are associated rather with the joypad.

If input driver supports the sensors, it is still preferred.
Placeholder inserted for all input drivers, no functionality
added yet.
2024-07-24 15:13:16 -07:00
libretroadmin 3c45d78a95 Buildfix 2024-07-20 19:49:31 +02:00
libretroadmin afc9cb509a CXX_BUILDFIX buildfixes 2024-07-20 19:42:45 +02:00
libretroadmin e543aa25ae Silence some warnings 2024-07-20 15:46:26 +02:00
zoltanvb 7db9a2de60 Test input driver and sensor test screen
A new input driver (test_input), similar to test joypad driver.
Takes its inputs from a json file provided in options. Supports
keyboard input and sensor input (accelerometer, gyroscope,
illuminance).

Remote Retropad extended with a sensor test screen.
2024-07-06 13:55:55 -05:00