Commit graph

2002 commits

Author SHA1 Message Date
刘皓
1c4d65e02e
Refactor the non-autogenerated parts of sandbox-bindgen into separate files 2025-02-05 01:11:23 -05:00
刘皓
f1ad41814a
Start implementing input for libretro builds 2025-02-04 23:47:54 -05:00
刘皓
1706584e9d
Split patch files for libretro builds into smaller files 2025-02-03 23:55:44 -05:00
刘皓
d7e002f9b0
Compile Ruby with -Oz -DNDEBUG in libretro builds 2025-02-02 17:05:15 -05:00
刘皓
b9bb3535ae
Use vcs_tag to get Git version instead of run_command
This way Meson will automatically keep the Git hash updated as you make
new Git commits, rather than forcing you to reconfigure the build again
every time you make a new commit to keep the commit hash updated.
2025-02-01 17:28:52 -05:00
刘皓
37a7559e38
Remove dependency on ghc::filesystem in libretro builds 2025-02-01 13:03:13 -05:00
刘皓
f03d8e3f5d
Embed mkxp-z version into the libretro core 2025-01-31 23:35:20 -05:00
刘皓
93d0cabd53
Disable OpenAL Soft's event thread in libretro builds
I don't think we need the event thread when all we're doing is rendering
to OpenAL Soft's loopback driver. Besides, the event thread was causing
crashes in Emscripten builds.
2025-01-31 20:51:20 -05:00
刘皓
4a730f5e8b
Use a newer version of OpenAL Soft in libretro builds
The Emscripten build was crashing because of some unaligned memory
access in OpenAL Soft. Hopefully this fixes it.
2025-01-31 17:28:34 -05:00
刘皓
23b6a931d8
Stop OpenAL Soft from enabling -pthread when targeting Emscripten 2025-01-31 12:27:27 -05:00
刘皓
ba5a5386ed
Don't initialize PhysFS basedir and userdir in libretro builds 2025-01-31 01:07:02 -05:00
刘皓
9f8d321c84
Use a better method of fixing the Emscripten OpenAL symbol conflict 2025-01-30 22:55:20 -05:00
刘皓
e598114a73
Fix OpenAL symbol conflict in libretro Emscripten build 2025-01-30 21:25:20 -05:00
刘皓
1f13a834d1
Small fixes to the libretro build process 2025-01-30 11:51:42 -05:00
刘皓
b6993d7f37
Add Emscripten and PlayStation Vita builds to libretro CI 2025-01-29 20:37:53 -05:00
刘皓
b271ff7ade
Remove libretro CI builds that definitely won't work due to hardware memory limitations 2025-01-29 00:56:46 -05:00
刘皓
b249ad0d98
Add Ogg, Vorbis and libsndfile to libretro builds 2025-01-28 23:25:17 -05:00
刘皓
64f0f093c3
Render audio to OpenAL every frame in libretro builds 2025-01-27 17:47:33 -05:00
刘皓
66720a5bc0
Use embedded GMGSx.sf2 as soundfont in libretro builds 2025-01-27 13:15:55 -05:00
刘皓
b1133b78f7
Fix some libretro compilation errors on Android, Darwin, Nintendo and Windows 2025-01-27 11:48:53 -05:00
刘皓
c42949713d
Start integrating the audio code into libretro builds 2025-01-27 00:34:52 -05:00
刘皓
84ca884f84
Reimplement WASI filesystem on top of existing mkxp-z filesystem implementation
This allows more flexibility when loading games in libretro builds,
since we can now load games either from a directory or from a ZIP or 7Z
archive. Also, the path cache is now active for all filesystem calls
made from inside Ruby.
2025-01-25 22:03:52 -05:00
刘皓
973b33e3e5
Fix PhysFS compilation errors in libretro builds 2025-01-25 00:58:11 -05:00
刘皓
a44f3b16b3
Add SDL headers and PhysFS to libretro builds
I don't think I'll be needing SDL. Pretty sure about 100% of the
functionality of SDL that's currently being used here is either trivial
to reimplement or needs to be replaced for the libretro core to work in
the first place. For example, I already know I'm going to need to
completely replace the SDL input handling with libretro's input API.
Also, I'll need to get rid of the use of SDL threads in the audio code
later because libretro cores need to render audio synchronously with the
video rendering.

I'm including the SDL headers, though, to reduce the number of
compilation errors.
2025-01-24 23:56:00 -05:00
刘皓
afed16f086
Fix OpenAL Soft devkitPro compilation errors 2025-01-24 11:37:31 -05:00
刘皓
66177c3981
Remove useless try/catch blocks in destructors in sandbox-bindgen 2025-01-23 22:50:17 -05:00
刘皓
12a74bb9e7
Don't call __wasm_call_dtors() when sandbox is destroyed
This line is sometimes throwing an exception when the sandbox is
destroyed because the sandbox is being destroyed while it's in the
middle of yielding, and I guess it's undefined behaviour to call
`__wasm_call_dtors()` while the sandbox is yielding.

As evidenced by the try/catch block, I anticipated that
`__wasm_call_dtors()` could throw an exception. But I forgot that you
can't catch exceptions in a destructor! Let's just not call
`__wasm_call_dtors()` then. What harm can that do anyways, given that we
clean up all the memory used by the sandbox in the immediately following
lines in the destructor?
2025-01-23 22:17:39 -05:00
刘皓
dee41c7b79
Add OpenAL Soft as a dependency in libretro builds 2025-01-23 19:15:52 -05:00
刘皓
b1206d9dc5
Implement enough stub bindings for binding-sandbox to begin testing KNight-Blade 2025-01-23 14:23:34 -05:00
刘皓
91fdc3028b
Fix arguments passed to ruby_exec_node() in libretro builds
This is really stupid. But it seems this undefined behaviour here was
causing the sporadic Ruby VM crashes I experienced before.
2025-01-22 22:45:54 -05:00
刘皓
7d753e2655
Implement even more of binding-sandbox
I've made it so that `Graphics.update` pauses the Ruby VM and returns to
the libretro frontend. Once the libretro frontend calls `retro_run()`
again, the Ruby VM resumes. This allows the libretro frontend to control
the rendering loop.
2025-01-22 21:52:55 -05:00
刘皓
739185594e
Implement more of binding-sandbox 2025-01-22 11:52:10 -05:00
刘皓
4c9e68e066
Convert VALUEs to little-endian before passing to function pointers 2025-01-21 20:14:53 -05:00
刘皓
019812f71e
Start writing class/method stubs for binding-sandbox
I know I've got a long road ahead of me. I'm committing my work so far
for future reference and so that I can check for CI failures.
2025-01-21 12:56:17 -05:00
刘皓
6d3296906d
Move VALUE alignment test from meson.build to sandbox-bindgen 2025-01-19 22:37:20 -05:00
刘皓
e346343be4
Fix memory leaks in sandbox-bindgen 2025-01-19 21:10:53 -05:00
刘皓
379c22833f
Store coroutine variables in the Ruby stack in libretro builds
To stop Ruby's garbage collector from freeing Ruby `VALUE`s while we're
in the middle of using them in libretro builds, we need to make sure all
the `VALUE`s we use are on the sandbox's stack.

Also, to allow Ruby to recognize `VALUE`s on the sandbox's stack on
big-endian targets, I've changed the serialization of `VALUE`s. Before,
any `VALUE`s returned by a sandbox function were always converted to the
target's endian, and any `VALUE`s passed to sandbox functions as
argument were then converted back to WebAssembly's endianness,
little-endian. Now, `VALUE`s are always little-endian; they are no
longer converted to the target's endianness. That should be fine since
`VALUE`s are supposed to be opaque values.
2025-01-19 19:08:03 -05:00
刘皓
835795a0c6
Use different Ruby command-line arguments in libretro builds
I've decided to stop gambling with ways to make `-e` not crash Ruby on
startup in libretro builds (see commit
1473416a5a for context). Making Ruby load
a dummy script seems to work better.
2025-01-19 11:56:47 -05:00
刘皓
d7d460d6b0
Small fixes to the sandbox bindings 2025-01-19 11:30:55 -05:00
刘皓
fe5a94aea7
Implement loading scripts from Scripts.rxdata for libretro 2025-01-18 18:51:29 -05:00
刘皓
f10dc81410
Add more sandbox bindings 2025-01-18 13:51:58 -05:00
刘皓
94e8d4607d
Fix sandbox bindings for Ruby globals
It has come to light that the global bindings generated by wasm2c are
not the globals themselves, but rather pointers to the memory locations
where the globals are stored. I've updated sandbox-bindgen.rb to take
this into account.
2025-01-18 01:43:52 -05:00
刘皓
9edac122fb
Add sandbox bindings for Ruby constants and use zstd compression for libretro Ruby dist 2025-01-17 22:04:42 -05:00
刘皓
e4acdeb9e7
Switch libretro phase 1 CI from ubuntu-24.04 to ubuntu-latest
Now that GitHub has finished upgrading the `ubuntu-latest` image to
Ubuntu 24.04, we can just use `ubuntu-latest`. We need at least Ubuntu
24.04 because the version of WABT from earlier versions of Ubuntu is too
old.
2025-01-17 11:13:57 -05:00
刘皓
1473416a5a
Fix crashes when starting up libretro Ruby sandbox (hopefully)
Guys, I think I'm going insane. Every time I build the libretro Ruby
sandbox with a different version of Ruby, or even when I build Ruby at a
different path on my computer, there's some chance that the builds
produced with that version of Ruby and/or that path on my computer
result in Ruby crashing on startup in libretro builds. I've been
tweaking these command-line arguments that are passed to Ruby for a
while now, and I *think* these are the correct ones that will stop Ruby
from crashing.
2025-01-17 01:23:18 -05:00
刘皓
510f1b0211
Move sandbox files to binding-sandbox directory 2025-01-16 22:16:14 -05:00
刘皓
474e1f536a
Fix libretro Alpine Linux armv6 build 2025-01-16 18:48:23 -05:00
刘皓
53a638ab74
Update non-libretro CI
GitHub has deprecated some of the v3 actions, so I've updated them to
v4.
2025-01-16 14:43:37 -05:00
刘皓
16f21ff043
Disable -fPIC when building for PlayStation Portable
The PSPDEV toolchain doesn't seem to support position independent code.
2025-01-16 11:49:11 -05:00
刘皓
0602c97a0a
Fix dependency compilation errors when compiling for Nintendo consoles 2025-01-16 01:33:44 -05:00