Commit Graph

1508 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
pstef 620e440ab1 Silence an incompatible-pointer-types warning 2025-04-10 21:10:45 +00:00
pstef bcdb644bce Silence a discarded-qualifiers warning
waitUntilDeviceIsReady() should take a const char pointer as a
parameter, because it doesn't use it for writing. Since the function
prototype asks for a char pointer, cast it here.
2025-04-10 21:10:45 +00:00
LibretroAdmin 82d8b9630a
Merge pull request #17750 from BinBashBanana/master 2025-04-10 03:35:45 -07:00
LibretroAdmin 634a0a9654
Merge pull request #17753 from pstef/ctr-nogriffin
Fix non-griffin build for 3DS and make it the default
2025-04-09 13:25:30 -07:00
LibretroAdmin b5424e7448
Merge pull request #17783 from pstef/switch-performance-profiles 2025-04-08 18:44:20 -07:00
Ryunam fbd05aa185
Fix very minor build warning (#17781) 2025-04-08 20:24:51 +03:00
pstef e523a6c0be Relocate Switch CPU profile definitions
Move SWITCH_CPU_* array definitions from header to platform_switch.c.
Use extern declarations in the header. Add NULL/0 terminators to the
arrays and update size calculation and loops to use the terminators
where the number of elements can't be calculated.

The motivation for this change is to remove code duplication and silence
warnings about unused arrays in translation units that only used a
subset of them.
2025-04-08 17:12:03 +00:00
pstef 70aaa0a55c Fix non-griffin build for 3DS and make it the default
While here:
* remove input_overlay and task_overlay from linking blacklist
* move -Werror to CC invocation since C++ refuses to use it
* copy the quiet build mode from the main Makefile and make it the
  default
* temporarily define DEPRECATED for gpu_old.h to allow succesful build
* replace the call to command_event() with one to retroarch_main_quit()
  in a failure case
* add missing uncompr.o in Makefile.common for HAVE_BUILTINZLIB
2025-04-06 18:35:41 +00:00
odditude42 b8b11a6187
Excludes msvc compilation of Win11/MSYS2-specific registry-reading code to resolve (#17769)
MSVC2010 build issues.
2025-04-04 13:12:48 +03:00
odditude42 9de225ed45
Moved declarations to fix MSVC2010 builds (C89 compliance) (#17768) 2025-04-04 01:42:02 +03:00
BinBashBanana 05cefc9a4d AudioWorklet driver, misc. emscripten fixes 2025-03-28 19:41:40 -07:00
odditude42 c23e6ff017 Updated platform_win32.c to properly detect OS version info on Win11.
Removed .vscode config files which were still cached in the index
  prior to the directory being added to .gitignore.
2025-03-28 19:25:25 -04: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
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 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
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 2a0984b6e4.
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 47410df7a3.
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