Commit graph

2368 commits

Author SHA1 Message Date
刘皓
94e0f99643
Allow ViewportElement to compile with -fno-rtti 2025-05-15 13:34:09 -04:00
刘皓
53f42adb89
Add an x86 version of the libretro Alpine Linux autobuild 2025-05-14 23:11:10 -04:00
刘皓
e3cbed2fb3
Remove unused next_func_ptr field of binding_base 2025-05-14 21:16:50 -04:00
刘皓
1f136cd6ff
Fix Graphics.play_movie volume being ignored 2025-05-14 21:08:33 -04:00
刘皓
e803e8e9e0
Pin libretro GNU/Linux autobuilds to Ubuntu 16.04 Xenial Xerus
The libretro buildbot uses Xenial for its GNU/Linux images, but with GCC
9 instead of the default GCC 5 that's available in the Xenial
repositories. I've changed our libretro autobuilds to do the same.

Pinning an old distribution for the libretro GNU/Linux autobuilds allows
for compatibility with devices with old versions of glibc, like some
Linux-based handheld console OSes.
2025-05-14 19:10:47 -04:00
刘皓
042d6f3e9d
Use Meson to configure Boost subprojects instead of CMake
Boost's CMake files try to access the Internet for absolutely no reason.
2025-05-14 16:55:35 -04:00
刘皓
d5f4d6777a
Merge branch 'misc-fixes' into libretro 2025-05-14 12:59:24 -04:00
刘皓
8cf251bd5d
Set a C++ standard for embedtool 2025-05-14 12:59:17 -04:00
刘皓
215e880aa6
Make RTP paths in mkxp.json consistent with other paths in libretro builds 2025-05-14 10:10:46 -04:00
刘皓
7af5179232
Remove exceptions from src/util/iniconfig.cpp
The libretro Emscripten build really doesn't like exceptions, and
neither does the PlayStation 4 homebrew toolchain. I'll have to get rid
of all exceptions elsewhere as well.
2025-05-14 09:55:37 -04:00
刘皓
28fb36af98
Capitalize /Dist, /Game, /Save and /System in libretro builds for consistency 2025-05-13 17:53:59 -04:00
刘皓
36075a5add
Load RTPs from mkxp.json as well in libretro builds 2025-05-13 17:26:30 -04:00
刘皓
714c583b9f
Allow RTPs to be loaded from archives as well in libretro builds 2025-05-13 16:17:04 -04:00
刘皓
75b953d4c8
Implement loading RTPs from the libretro system directory 2025-05-13 12:28:17 -04:00
刘皓
d62d6aef3e
Remove WASI_DEBUG macro 2025-05-12 13:50:48 -04:00
刘皓
67e61917a7
Apply big-endian fixes to binding-sandbox/wasi.cpp as well 2025-05-12 12:39:08 -04:00
刘皓
f57568e051
Allow some libretro core options to be changed during execution 2025-05-11 18:54:56 -04:00
刘皓
3fda80275d
Implement core options in libretro builds 2025-05-11 17:04:33 -04:00
刘皓
7347afed21
Revert "Make sure sandbox stack grows upwards in big-endian libretro builds"
This reverts commit 58e6f71ef3.

The original behaviour was the correct one. The stack should always grow
downwards.
2025-05-10 23:37:39 -04:00
刘皓
87eea255c5
Remove void pointer arithmetic in src/display/bitmap.cpp 2025-05-10 23:27:30 -04:00
刘皓
68b2067a45
Remove void pointer arithmetic in binding-sandbox/binding-base.h 2025-05-10 20:44:46 -04:00
刘皓
2a8370a8ee
Fix typo in bitmap.cpp 2025-05-10 20:09:56 -04:00
刘皓
58e6f71ef3
Make sure sandbox stack grows upwards in big-endian libretro builds 2025-05-10 19:23:43 -04:00
刘皓
3ba12e5672
Fix handling of big-endian platforms in libretro builds
In big-endian libretro builds, the WebAssembly memory is reversed, so no
byte-swapping is required to read from/write to WebAssembly memory
(which is little-endian).

However, that means the ways to get and set values in WebAssembly memory
are endianness-dependent, so I've added the correct such ways for
big-endian platforms.
2025-05-10 18:55:14 -04:00
刘皓
09ed08c087
Fix edge case in memory reallocation algorithm in wasm-rt.cpp 2025-05-10 11:09:20 -04:00
刘皓
fc744ab6c6
Refactor locking of all tracks in AudioPrivate::bgmTracks into a custom lock guard 2025-05-10 10:48:57 -04:00
刘皓
3bceb56bd3
Merge branch 'misc-fixes' into libretro 2025-05-10 10:48:49 -04:00
刘皓
95f0f08c87
Fix memory leak in Input::getClipboardText() 2025-05-10 10:47:48 -04:00
刘皓
215046d8b4
Only use extern in embedtool.cpp if language is C++
In C, variables defined as `const` have external linkage.

In C++, variables defined as `const` have internal linkage, and we need
to define them as `extern const` for them to have external linkage like
in C.

However, in C, defining a variable as `extern const` throws a compiler
error, so we need to add `extern` only for C++ files.
2025-05-10 10:47:19 -04:00
刘皓
dafe038bb4
Merge branch 'misc-fixes' into libretro 2025-05-10 10:07:48 -04:00
刘皓
54d915860f
Fix some bugs in the ME watch thread
* BGM track streams should be locked while `extPaused` is being modified
* All BGM track streams should be locked in the `BgmFadingOut` phase
  since we need to query the states of all tracks in the middle of the
  loop
* BGM tracks should have `extPaused` set to false if the ME ends in the
  middle of the `BgmFadingOut` phase
2025-05-10 09:59:56 -04:00
刘皓
c5747f17c5
Fix minor issues in binding-sandbox/binding-base.h and binding-sandbox/binding-util.h 2025-05-10 09:25:43 -04:00
刘皓
8ec189e3d2
Remove always-false static_assert from binding-sandbox/binding-base.h
This is causing compilation errors with some compilers.
2025-05-09 23:28:17 -04:00
刘皓
b8d785b7e1
Implement growing VM memory in libretro builds
The binding coroutines in libretro builds are constructed on the VM
stack, so reallocating the VM memory would corrupt the memory of any
currently existing coroutines.

I've changed it so that the coroutines are no longer constructed on the
VM stack so that they're unaffected by VM memory reallocations, and
added a "slot" mechanism for storing variables on the VM stack. (Any
Ruby `VALUE`s used by a coroutine have to be stored on the VM stack so
that the Ruby garbage collector doesn't free them while they're being
used, which is why the slot mechanism is necessary.)
2025-05-09 22:49:13 -04:00
刘皓
d186fa97bc
Update Emscripten to 4.0.8 for the libretro Emscripten autobuild
Will be required once https://github.com/libretro/RetroArch/pull/17872
makes its way into the version of RetroArch used in the autobuild.
2025-05-09 18:02:37 -04:00
刘皓
d71cd242c7
Improve save directory creation algorithm in libretro builds
Before, if the game tried to create a save file, missing parent
directories would always be created because they could possibly exist
only in the game directory and not in the save directory, and we
wouldn't know due to the union mounting of the save and game
directories. But this is inconsistent with the behaviour of file
creation, where it should fail if parent directories don't exist.

The behaviour has been changed to only create parent directories if the
parent directories already exist. I know that sounds strange, but if the
parent directories exist, it could be that they only exist in the game
directory but not the save directory due to the union mounting, so we
need to create the parent directories, which will be created in the save
directory due to it being set as the write directory in PhysFS.
2025-05-07 22:13:45 -04:00
刘皓
66256e9156
Put saves in ./mkxp-z/Saves/ in libretro save directory
Since the libretro save directory isn't guaranteed to be private for
each core, or even private for just saves, we'd better create a
directory structure in the libretro save directory for our saves.
2025-05-07 18:35:25 -04:00
刘皓
c85e9554ec
Implement writing to filesystem (i.e. game saving) in libretro builds
Files are written to the libretro save directory, which is mounted at
/save in PhysFS. All filesystem calls made from Ruby in libretro builds
are routed through PhysFS, so the game can just use any ordinary
filesystem function provided by Ruby to interact with /save.

It's also union mounted on top of the game directory (located at /game
in PhysFS) so that games that write their save files to the current
working directory will have their save files saved to the libretro save
directory instead of the game directory.

For security and portability reasons, nothing outside of the libretro
save directory can be written to, and nothing outside of the libretro
save directory, the libretro game directory and the various embedded
files used by the runtime can be read from.
2025-05-07 16:01:41 -04:00
刘皓
3e3df818aa
Use C getcwd() instead of Ruby Dir.pwd() to get CWD in libretro builds 2025-05-06 18:02:03 -04:00
刘皓
13c0657691
Handle current working directory properly in libretro builds
Any relative paths that the game tries to access in libretro builds will
now be relative to whatever is the current working directory in the Ruby
sandbox, which will also now be initialized to the game directory during
initialization. Before, all of the bindings that took paths were
hardcoded to prepend the path with the game directory.
2025-05-06 16:55:28 -04:00
刘皓
b518ca62f0
Re-add polyfill for pthread_self()
Apparently PhysFS does actually need this function to work properly.
Without it, we get weird crashes and corruptions in some of the libretro
builds.
2025-05-05 16:45:22 -04:00
刘皓
33e1328e71
Prevent usage of mkxp_thread_t on single-threaded platforms 2025-05-05 11:47:17 -04:00
刘皓
1c10158f2d
Add single-threaded Graphics.play_movie for platforms without multithreading 2025-05-05 11:00:27 -04:00
刘皓
2bec640f7f
Update TheoraPlay in the Xcode build system as well 2025-05-04 21:39:52 -04:00
刘皓
307d3d84d5
Update TheoraPlay
The version originally used by mkxp-z has a bug where TheoraPlay's
internal mutexes don't do anything on non-Windows platforms (see commit
35295146d38d389729380a691292cdb8e90bad1b in TheoraPlay), leading to race
conditions, especially when using RetroArch's fast-forwarding.

Also, this new version has support for being run single-threaded,
which'll come in handy on platforms with no multithreading support.
2025-05-04 11:41:32 -04:00
刘皓
82c3d7985c
Fix some Graphics.play_movie audio/video synchronization issues in libretro builds 2025-05-03 23:01:11 -04:00
刘皓
74e5cc763c
Implement Graphics.play_movie in libretro builds 2025-05-03 18:27:44 -04:00
刘皓
23bc6625f1
Add Theora as a dependency in libretro builds 2025-05-03 13:46:17 -04:00
刘皓
a0219e7c79
Implement loading animated GIF bitmaps in libretro builds 2025-05-03 11:07:55 -04:00
刘皓
bcfcd6df8a
Merge branch 'misc-fixes' into libretro 2025-05-02 14:56:47 -04:00