Commit Graph

117 Commits

Author SHA1 Message Date
BinBashBanana c2d7366ea1 Rewrite RWebAudio driver 2025-05-21 18:05:05 -07:00
BinBashBanana 2d3c18e48d Emscripten improvements pt. 4 2025-05-08 11:01:43 -07:00
Joseph C. Osborn 55f9f92eaf Fixes an uninitialized variable in extra wasmfs/fetchfs feature
Under some optimizations, this would lead to games using fetchfs
backend just crashing due to calling wasmfs functions on a garbage pointer.
2025-04-24 10:14:16 -07:00
BinBashBanana 05cefc9a4d AudioWorklet driver, misc. emscripten fixes 2025-03-28 19:41:40 -07:00
Joseph C. Osborn 525e1cff49 Slightly more informative printf 2025-03-12 15:11:23 -07:00
Joseph C. Osborn 52e2ee9272 add abort in case only one of manifest/base dir defined 2025-03-12 15:10:49 -07:00
Joseph C. Osborn d4d3aee457 Strip newline from base_url, use wasmfs_create_file instead of open
Also style fixes
2025-03-12 15:06:29 -07:00
Joseph C. Osborn 809e5d78be create a single fetchfs backend instead of 1 per file
symlinking manifest entries and using a baseurl gives us a way to
create just a single fetchfs backend (and a single thread) since
emscripten upstream is not willing to integrate manifest support to
fetchfs directly.

Retroarch embedders could use this to get assets or other resources
lazily or chunk-by-chunk for large files.
2025-03-10 15:04:38 -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
Joe Osborn fa6d622031
Cancel bootup main loop before starting regular mainloop (#17638) 2025-02-27 20:14:57 -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
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 ef7b9830db (cheat_manager) No more dependency on configuration.h 2025-02-10 16:48:56 +01:00
LibretroAdmin ddd7ff2d33 get rid of some settings_t pointer passing 2025-02-10 15:47:18 +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
libretroadmin 3fc7024df9 (cheevos) Cleanups - only use snprintf for formatting 2024-06-16 22:20:15 +02: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
nfore 9ca5c5e623 Revive/rewrite Keyboard Overlay and OSK Toggle
Add keyboard overlay preset, keyboard submenu, and osk_toggle hotkey. Use overlay caching for osk_toggle.

For now, keyboard menu has only preset path, auto-scale toggle, and opacity.

Related fixes:
- input_keyboard_event: Don't check hotkey binds when device is RETRO_DEVICE_POINTER
- Add input_keymaps_translate_rk_to_ascii() for correct character input to input_keyboard_event
- input_overlay_poll: Delay clearing INPUT_OVERLAY_BLOCKED flag until there is no overlay input (Avoids stray input after osk_toggle)
- Send keyboard events for modifiers before other keys (for correct modifier+key input if hitboxes overlap)
2023-07-09 04:42:49 +02:00
libretroadmin 51d238875e Get rid of obsolete HAVE_VIDEO_LAYOUT - obsolete spec, was only
ever implemented for OpenGL2 driver, lots of code debt, best to
instead just keep improving the overlay system instead which is
already available for most video drivers
2023-02-23 21:03:41 +01:00
libretroadmin 8f1af4a2e6 (Frontend) Style nits/cleanups 2022-12-15 14:34:22 +01:00
LibretroAdmin d30f16dc79 Remove cursor directory/cursor manager list - Views obsoleted
this
2022-10-25 15:21:47 +02:00
LibretroAdmin b2634ea588 * Create fill_pathname_join_special - and specify fill_pathname_join
as deprecated.
* Use fill_pathname_join_special in the vast majority of cases where
we can ensure out_path is a new empty string
* Get rid of some extension concatenation with strlcat where encountered
* Some general cleanups with NULL termination of strings that get immediately
passed to strlcpy/strlcpy-adjacent functions
2022-08-04 14:19:38 +02:00
Nikos Chantziaras 430baf7c21
Add Linux GameMode support (#13339)
This can fix a lot of performance issues, like audio crackling and frame
time spikes. This requires the GameMode package to be installed. See:

https://github.com/FeralInteractive/gamemode

This commit adds a "Game Mode" bool option to the "Power
Management" and "Latency" settings sections, and it can be toggled
on/off without restarting RA.

The actual toggling of game mode happens in a new frontend platform
interface function. Perhaps this will become useful for other platforms
that provide some equivalent of Linux GameMode.

Since the GameMode ABI is fixed, and the API comes as a single,
header-only file with no actual deps, we simply bundle the header
(deps/feralgamemode/gamemode_client.h.) That way, all Linux builds will
have support for GameMode regardless of whether the GameMode development
package is installed or not.
2021-12-14 14:07:42 +01:00
twinaphex 406c8bee7b Silenc some warnings 2021-08-09 21:24:03 +02:00
twinaphex 4c51e31b9d (Platform) Cleanups + add missing function pointer bind for Darwin 2021-01-16 16:14:03 +01:00
jdgleaver be1c7b8e4c (.gitlab-ci.yml) Add Emscripten target 2021-01-06 14:42:06 +00:00
David Guillen Fandos a442696b71 First attempt at adding proper brightness
Supports Switch and OGA
2020-11-26 19:22:05 +01:00
David Guillen Fandos f5693f15e7 Make get_lakka_version available in all builds
This simplifies a bit the code, for some new lakka patches to come.
2020-11-23 18:44:24 +01:00
twinaphex 3ac75c043e Jdgleaver improvements 2020-11-20 03:55:55 +01:00
twinaphex 9ee1e33e09 Only attempt to call dir_check_defaults once per runtime session
when calling the frontend environment get callback - we want to
look at the 'default' directories, and then if they don't yet exist,
auto-create them so we can store files in them.
2020-11-19 07:10:22 +01:00
twinaphex 4ec216dc0b Get rid of file_path_str 2020-08-22 01:06:10 +02:00
twinaphex 855351de9e Reorder g_defaults, alignment 2020-08-16 04:38:02 +02:00
twinaphex 6b466c6013 Cleanups 2020-07-09 07:46:40 +02:00
twinaphex e20151a048 Get rid of video_info struct for swap_buffers too 2020-03-06 22:29:51 +01:00
twinaphex 2d274f1369 Move accessibility features to platform frontend driver 2020-02-14 00:17:55 +01:00
twinaphex 96018412c0 Cleanups 2020-02-01 03:27:58 +01: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
twinaphex ca3a80091a Cleanup runloop_iterate
NOTE/CHECK: Hopefully wiiu is unaffected by the change
in sleeping
2019-08-11 19:39:48 +02:00
Toad King 618da66073 emscripten: add hack to prevent ERRNO_CODES from being optimized away 2019-08-07 22:07:09 -05:00
twinaphex ee3208ac39 Integrate video_driver.c into retroarch.c 2019-06-17 15:10:22 +02:00
Huw Pascoe 685aabb094 video_layout config 2019-05-11 09:58:46 +01:00
Brad Parker aa588dec35 set default language on first startup according to OS setting (initial *nix implementation) 2019-04-15 23:14:49 -04:00
jdgleaver 2c65068be0 More 'Log to File' Additions:
- Add optional timestamped log files

- Handle errors if log file cannot be opened

- Android: flush log file immediately

- 3DS: log to file tested and fully working

- Default log paths added for all platforms
2019-03-25 17:22:59 +00:00
Brad Parker e22148fed4 show cpu model name in log, implemented for x86/64 on windows/linux so far 2019-02-23 16:50:42 -05:00
twinaphex 85708b7ef8 (Emscripten) Buildfixes 2019-02-03 17:15:18 +01:00
Brad Parker aa083d1e4c android: add configurable setting for Sustained Performance Mode 2018-06-19 02:50:33 -04:00