Commit Graph

215 Commits

Author SHA1 Message Date
BinBashBanana 2d3c18e48d Emscripten improvements pt. 4 2025-05-08 11:01:43 -07:00
BinBashBanana f5a056b086 Fix safari file uploads 2025-04-03 10:24:06 -07:00
BinBashBanana 393e1b4b98 Fixes for #17750 2025-03-30 13:15:50 -07:00
BinBashBanana 05cefc9a4d AudioWorklet driver, misc. emscripten fixes 2025-03-28 19:41:40 -07:00
BinBashBanana c672730259 address issues 2025-03-06 15:38:40 -08:00
BinBashBanana f6eb1ed5c5 Threaded emscripten improvements 2025-03-05 10:39:43 -08:00
Joe Osborn f2a86f34d1
Remove unnecessary rigmarole around importing the script as a blob (#17642) 2025-03-01 17:34:05 -08:00
Joseph C. Osborn c29cd046d0 Fixes asset paths/double bundle path for web player 2025-02-28 18:44:31 +01: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
Joe Osborn 9005e1b9fe
Use correct key into message data to get last asset fetch time (#17607) 2025-02-21 07:40:49 +01: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
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
zoltanvb e71a1620b0
Update core list based on what is compiled for 1.20.0 stable version. (#17404) 2025-01-12 17:34:01 +01:00
zoltanvb 864ad02177
Quickfix: asset size has exceeded 4x30 MB, so now there are 5 chunks. (#17334) 2025-01-02 19:31:35 +01:00
Joey Parrish b36d8da5d3
docs: Add missing command to emscripten docs (#17097) 2024-10-14 04:21:18 -07:00
Dionoid c04bbd6d65
Added M2000 to core selection dropdown (#16479) 2024-04-29 18:29:39 -07:00
Joe Osborn 46402732ba
update emscripten web testing docs (#15925) 2023-11-18 16:28:12 -08:00
Joe Osborn 0f4166a59f
Use ZipFS for web player asset bundle (#15924)
* wip

* fix mount path

* Fix path for zip bundle

* fix case where idbfs sets up correctly and filesystem initializes too early

* Use partfiles to keep each zip small

* use bufferview slices instead of resize to support firefox
2023-11-17 11:25:45 -08:00
Joe Osborn 862bebf687
(Emscripten) Modularize the JavaScript and clean up the web build (#15688)
* Increase emscripten stack size and decrease path size to fix emscripten builds broken since de45fc2

* use modularize flags for better-behaved javascript output

* makefile and loader changes

* use specialHTMLTargets to support modular access to canvas

* bind key events to canvas, not document

This way focus means focus and we can have multiple RA instances in
one page.

* Work around an emscripten bug in strict mode

* (Emscripten) Use console.error() for error messages

* increase asyncify stack size

* Fix `-lm` flag-related compile warnings in emscripten

---------

Co-authored-by: Rob Loach <robloach@gmail.com>
2023-11-02 13:25:50 -07:00
LibretroAdmin 6378a3aea2
Update index.html (Emscripten) - Remove banner 2023-07-17 15:46:22 +02:00
Vlad Cuciureanu 2adca0f33c Fix typo in Emscripten README.md 2023-07-11 01:03:29 +02:00
Antoine Boucher 513cd25cb3
Update README.md (#15231) 2023-04-27 01:44:52 +02:00
Joe Osborn a1903eee15
Emscripten pthread tweaks (#15033)
* add more documentation to emscripten, pthread support, and flag to not show asset warnings

* typo in docs

---------

Co-authored-by: thelamer <ryankuba@gmail.com>
2023-02-27 19:56:12 +01:00
Joe Osborn e1afca5392
add command and stdin_cmd features to emscripten RA. update libretro.js to show how commands could be sent over emscripten stdin. (#15017)
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
2023-02-24 22:06:04 +01:00
Vladimir Serbinenko 96ddb301b6 Fix x1 name in emscripten 2022-03-16 18:08:20 +01:00
Vladimir Serbinenko 4d2178fafc Add missing emscripten cores 2022-03-15 17:44:00 +01:00
Philippe Simons 8a8c2da042
emscripten: add jumpnbump core (#13720) 2022-03-09 15:31:31 +01:00
Vladimir Serbinenko 2c289a6212
Add FreeChaf to emscripten (#13529) 2022-01-24 16:30:35 +01:00
Vladimir Serbinenko c9a72fadab
EMSCRIPTEN: Add wasm4 and jaxe (#13483) 2022-01-12 22:35:10 +01:00
Ryan Kuba 1fc6f759c5
tweak to ensure that current versions of emsdk do not break the web player (#13310) 2021-12-03 16:20:12 +01:00
Neil Barkhina 8590e0e3fe
Fixed web player bug with filesystem and runtime 2021-08-22 20:08:05 -04:00
mahoneyt944 647e39afaa
add mame2003 / mame2003-plus 2021-07-04 18:23:38 -04:00
Jean-André Santoni 56e40e8204 Add lutro to web.libretro.com 2021-05-02 13:04:20 +07:00
Brad 54a166a360
Allows hosting in a subfolder instead of only root
Paths starting with slashes look in the root of a site, and these asset folders should generally be beside this .js + index.html...
This simple change was all that was needed to allow hosting in a subfolder of a site, and is not a breaking change unless someone has the asset folders elsewhere, which would be a breaking change on their part anyway.
2021-02-14 19:47:01 -06:00
Autechre 7450f049e7
Update index.html 2021-01-09 17:05:35 +01:00
twinaphex 1c9f60f98d (Emscripten) Add Mr.Boom 2020-08-02 22:25:55 +02:00
Toad King 14c67fde7f emscripten: recreate input event listeners properly
There's a new (undocumented -_-) API for removing event listeners in emscripten
now, so use that when recreating input listeners. Fixes mouse events breaking
when loading cores.
2020-01-18 12:51:21 -06:00
Michael Lelli 8a64df5763 fix fullscreen button in packaged emscripten build 2020-01-06 21:36:44 -06:00
Michael Lelli 1630affbdd fix file permissions on `indexer` script for emscripten 2020-01-03 16:41:52 -06:00
Toad King 776568a429 fix images not loading in menu in emscripten
add changes to work with latest emscripten SDK
2020-01-02 21:29:25 -06:00
Stevoisiak f4f339c4d5
Remove unnecessary escape character
http://eslint.org/docs/rules/no-useless-escape
2019-12-31 12:13:40 -05:00
Toad King 15e8be4074 changes to support upgraded emscripten SDK 2019-12-14 20:24:41 -06:00
Ömercan Kömür 0420d7f06c Update index.html (#9329) 2019-08-19 16:28:22 +02:00
Ömercan Kömür b314ea8632 Update index.html 2019-08-19 01:23:59 +03:00
Ömercan Kömür d487dd8d08
Revert "Steps for web.libretro" 2019-08-18 22:53:55 +03:00
Ömercan Kömür 1bde4043a5 Steps for web.libretro 2019-08-17 19:25:18 +03:00
Stephanie Gawroriski ca4fa56929
Add SquirrelJME to the live web core list. 2019-06-29 12:25:41 -04:00
twinaphex 36575e5d69 Update emscripten 2019-06-08 16:01:39 +02:00