1493 Commits

Author SHA1 Message Date
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
Viačasłaŭ
6bfe3fcb43
(Win32) Unrevert TTS fallback (#17643)
Originally implemented in 274d47f
2025-03-01 01:04:29 -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 cacd5a9a234f3c9abc8d352f6fea19117e2e1a00.
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
ef4512dd02
macOS: ensure bundled assets get extracted properly (#17444) 2025-01-20 21:38:29 +01:00
Apteryks
52320dfaa8
* platform: Honor the LIBRETRO_CHEATS_DIRECTORY environment variable. (#17440)
* frontend/drivers/platform_unix.c
(libretro_cheats_directory): New variable.
(frontend_unix_get_env): Set DEFAULT_DIR_CHEATS to the value of
the LIBRETRO_CHEATS_DIRECTORY environment variable, if available.
* frontend/drivers/platform_win32.c: Likewise.
* configuration.c (config_load_file)
<libretro_cheats_directory>: New variable. Use the values of
the LIBRETRO_CHEATS_DIRECTORY environment variables instead of their
corresponding configured values, when set.
* docs/retroarch.6: Document it.
* retroarch.c (retroarch_print_help): Extend help text.
2025-01-20 15:08:45 +01:00
LibretroAdmin
4020326f58 Style nits 2025-01-20 04:37:27 +01:00
Apteryks
274cd419fa
Honor the LIBRETRO_DATABASE_DIRECTORY environment variable. (#17431)
* Partially revert a change made in 69ceb95ddc.

The change caused the 'libretro_directory' config option to always
revert to the default value, which was not intended behavior.

Reported-by: Michael Cook

* platform: Honor the LIBRETRO_DATABASE_DIRECTORY environment variable.

This is a follow-up to commit 69ceb95ddc.

* frontend/drivers/platform_unix.c
(libretro_database_directory): New variable.
(frontend_unix_get_env): Set DEFAULT_DIR_DATABASE to the value of
the LIBRETRO_DATABASE_DIRECTORY environment variable, if available.
* frontend/drivers/platform_win32.c: Likewise.
* configuration.c (config_load_file)
<libretro_database_directory>: New variable. Use the values of
the LIBRETRO_DATABASE_DIRECTORY environment variables instead of their
corresponding configured values, when set.
* docs/retroarch.6: Document.
* retroarch.c (retroarch_print_help): List supported environment
variables, and cross-reference the man page.
2025-01-19 15:25:28 +01:00
Apteryks
69ceb95ddc
Add libretro assets directory search path, and have environment variables override configured values (#17054)
* platform_win32: Fix sizeof for DEFAULT_DIR_PLAYLIST.

* frontend/drivers/platform_win32.c (frontend_win32_env_get): Check
the size of correct destination array.

* frontend: Honor the LIBRETRO_ASSETS_DIRECTORY environment variable.

This builds on 763fcd8267 ("unix, win32: Allow set the default
libretro_directory via environment variable") to also allow specifying
the assets directory via an environment variable.

* frontend/drivers/platform_unix.c (frontend_unix_get_env)
<libretro_assets_directory> New variable. Use it to set
DEFAULT_DIR_ASSETS, when available.
* frontend/drivers/platform_win32.c (frontend_win32_env_get): Likewise.

* platform: Honor the LIBRETRO_DIRECTORY environment variable.

Until now, and unlike the defaut core directory, the default
core *info* directory would be hard-coded relative to the installation
directory. Honor the LIBRETRO_DIRECTORY environment variable the same
instead.

* frontend/drivers/platform_unix.c (frontend_unix_get_env): Set
DEFAULT_DIR_CORE_INFO default to the value of the LIBRETRO_DIRECTORY
environment variable, if available.
* frontend/drivers/platform_win32.c (frontend_win32_env_get): Likewise.

* platform: Honor the LIBRETRO_AUTOCONFIG_DIRECTORY environment variable.

* frontend/drivers/platform_unix.c
(libretro_autoconfig_directory): New variable.
(frontend_unix_get_env): Set DEFAULT_DIR_AUTOCONFIG to the value of
the LIBRETRO_AUTOCONFIG_DIRECTORY environment variable, if available.
* frontend/drivers/platform_win32.c: Likewise.

* platform: Honor the LIBRETRO_VIDEO_FILTER_DIRECTORY environment variable.

* frontend/drivers/platform_unix.c
(libretro_video_filter_directory): New variable.
(frontend_unix_get_env): Set DEFAULT_DIR_VIDEO_FILTER to the value of
the LIBRETRO_VIDEO_FILTER_DIRECTORY environment variable, if available.
* frontend/drivers/platform_win32.c: Likewise.

* platform: Honor the LIBRETRO_VIDEO_SHADER_DIRECTORY environment variable.

* frontend/drivers/platform_unix.c
(libretro_video_shader_directory): New variable.
(frontend_unix_get_env): Set DEFAULT_DIR_SHADER to the value of
the LIBRETRO_VIDEO_SHADER_DIRECTORY environment variable, if available.
* frontend/drivers/platform_win32.c: Likewise.

* platform: Honor the LIBRETRO_SYSTEM_DIRECTORY environment variable.

* frontend/drivers/platform_unix.c
(libretro_system_directory): New variable.
(frontend_unix_get_env): Set DEFAULT_DIR_SYSTEM to the value of
the LIBRETRO_SYSTEM_DIRECTORY environment variable, if available.
* frontend/drivers/platform_win32.c: Likewise.

* configuration: Have environment variables override configuration.

Because the configuration file is systematically written when
RetroArch terminates, persisting any previous default/configured
value, setting the LIBRETRO_DIRECTORY, LIBRETRO_ASSETS_DIRECTORY, etc.
environment variables would not have an effect unless the
retroarch.cfg configuration file was cleared.

This seems to go against the common expectation that environment
variables are set by users to *override* the default behavior or
configuration of an application.

* configuration.c (config_load_file) <libretro_directory>
<libretro_assets_directory, libretro_autoconfig_directory>
<libretro_system_directory, libretro_video_filter_directory>
<libretro_video_shader_directory>: New variables. Use the values of
the LIBRETRO_DIRECTORY, LIBRETRO_ASSETS_DIRECTORY,
LIBRETRO_AUTOCONFIG_DIRECTORY, LIBRETRO_SYSTEM_DIRECTORY,
LIBRETRO_VIDEO_FILTER_DIRECTORY and LIBRETRO_VIDEO_SHADER_DIRECTORY
environment variables instead of their corresponding configured
values, when set.
* docs/retroarch.6: Document the environment variables honored and
their behavior.
2025-01-17 20:04:23 +01:00
LibretroAdmin
b211adaaca Function argument name standardization 2025-01-17 19:55:32 +01:00
Eric Warmenhoven
2471082ced
macos: fix some sandbox handling for app store (#17424)
* minor safety check

* macos: fix some sandbox handling for app store
2025-01-17 19:54:54 +01:00
LibretroAdmin
839b7654db More standardization of local len variables 2025-01-07 03:20:39 +01:00
Viačasłaŭ
b124fe6e65
Fix build with GCC 14 (#17282) 2024-12-24 23:51:48 -08:00
libretroadmin
de8f979cb7 less string copies 2024-12-24 05:10:09 +01:00
libretroadmin
442b9bc3da Syntax style nits 2024-12-23 05:44:40 +01:00
Eric Warmenhoven
d642e38423
apple: extract bundled assets.zip based on bundle version (#17231) 2024-12-03 23:37:01 -08:00
libretroadmin
2809421d4e Revert "static variables are initialized to '0' automatically as per C rules"
This reverts commit 2a0984b6e47b5f714ce4a360afeaadafdb634c36.
2024-11-19 03:03:13 +01:00
libretroadmin
82e4504968 Revert "(pt. 2) static variables are initialized to '0' automatically as per C rules"
This reverts commit 47410df7a3d2480dd8fc7fb97cf00319ce5e9344.
2024-11-19 03:03:05 +01:00
libretroadmin
47410df7a3 (pt. 2) static variables are initialized to '0' automatically as per C rules 2024-11-18 15:59:46 +01:00
libretroadmin
2a0984b6e4 static variables are initialized to '0' automatically as per C rules 2024-11-18 15:33:34 +01:00
Eric Warmenhoven
7ae8597765
macOS: Create App Store build (#17074) 2024-10-04 12:46:51 -07:00
Viačasłaŭ
3019b926c2
Fix typos (#17068) 2024-10-01 17:36:33 -07:00
libretroadmin
73e5d955c3 Downgrade some more variables to NAME_MAX_LENGTH 2024-09-09 16:01:29 +02:00
libretroadmin
b8391e233f * PATH_MAX_LENGTH redefined from 4096 to 2048
* Massive reduction in heap space allocation, going from settings struct
264kb to 119Kb
* Use NAME_MAX_LENGTH for base paths/names, etc
* Use DIR_MAX_LENGTH for directory sizes
2024-09-09 05:47:32 +02:00
Francisco Javier Trujillo Mata
fe4a15b15c
Fix pthread support (#16970)
* enabled pthread usage

* unload modules before loading back
2024-09-06 15:45:15 -07:00
kwyxz
d4920e76a9
restore Haiku build (#16872) 2024-08-11 13:12:19 -07:00
mahoneyt944
ef17034121
Fix sigterm (#16854) 2024-08-08 05:38:24 -07:00
Viačasłaŭ
204d9ff1b2
(Win32) Fix path to executable (#16852) 2024-08-06 17:02:36 -07:00
libretroadmin
3fc7024df9 (cheevos) Cleanups - only use snprintf for formatting 2024-06-16 22:20:15 +02:00
Thiago Seus
17fc346a36 Accessibility: change the is_screen_reader_enabled function name to lower case and match with the function name in Java code 2024-06-08 12:01:53 -05:00
Thiago Seus
216f55c7b2 Accessibility: Refactor Android is_narrator_running to align with the rest of RetroArch accessibility API 2024-06-08 12:01:53 -05:00
Thiago Seus
b4ed4b58d6 Accessibility: add first Android version 2024-06-02 14:49:19 -05:00
Eric Warmenhoven
a537af010e iOS/tvOS: better way of reporting available memory 2024-05-27 08:16:42 +02:00
Eric Warmenhoven
79b71179a5 macOS/iOS/tvOS: enable text-to-speech using AVSpeechSynthesizer.
Fixes #16532.
2024-05-22 13:29:48 -07:00
Tomáš Kelemen (vudiq)
8dafa0ce0d add cast to void** to fix build with gcc14 2024-05-22 04:48:56 -07:00
Eric Warmenhoven
ee8d8b1689 iOS/tvOS: Post Apple App Store fixes
- both: default VRR true
- tvOS: default overlay off
- tvOS: default directory fix
- both: default language fix
- tvOS: jit support fix
2024-05-17 14:38:35 -07:00
Eric Warmenhoven
0415ed2f95
apple: Use C function from CoreFoundation instead of ObjC from Foundation (#16476) 2024-04-29 18:30:56 -07:00
Eric Warmenhoven
e7f726bd19
iOS: import roms from iCloud (#16478) 2024-04-29 18:30:15 -07:00