RetroArch/input/drivers_joypad
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
..
wiiu Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
android_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
ctr_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
dinput_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
dinput_joypad.h
dinput_joypad_excl.h
dinput_joypad_inl.h Less passing around of settings_t pointer 2025-02-09 18:56:50 +01:00
dos_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
gx_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
hid_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
linuxraw_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
mfi_joypad.m Syntax style nits 2024-12-23 05:44:40 +01:00
parport_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
ps2_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
ps3_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
ps4_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
psp_joypad.c Support for analog L2/R2 values when a DS3 controller is used with PS Vita. (#17261) 2024-12-15 09:24:13 -08:00
qnx_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
rwebpad_joypad.c Enable pthreads on Emscripten (#17586) 2025-02-20 00:59:25 +01:00
sdl_dingux_joypad.c Less passing around of settings_t pointer 2025-02-09 18:56:50 +01:00
sdl_joypad.c Syntax style nits 2024-12-23 05:44:40 +01:00
switch_joypad.c Syntax style nits 2024-12-23 05:44:40 +01:00
test_joypad.c Style nits 2025-02-12 10:17:35 +01:00
udev_joypad.c Standardize len variables - argument should always be named 'len', 2025-01-13 21:53:49 +01:00
wiiu_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
xdk_joypad.c Add sensor function placeholders for all joypad drivers. (#16812) 2024-07-24 15:13:16 -07:00
xinput_hybrid_joypad.c Fix typos (#17068) 2024-10-01 17:36:33 -07:00
xinput_joypad.c Fix typos (#17068) 2024-10-01 17:36:33 -07:00
xinput_joypad.h (Winraw) Use flags 2024-09-09 19:06:43 +02:00
xinput_joypad_inl.h Fix typos (#17068) 2024-10-01 17:36:33 -07:00