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.
This commit is contained in:
刘皓 2025-01-22 22:45:54 -05:00
parent 7d753e2655
commit 91fdc3028b
No known key found for this signature in database
GPG key ID: 7901753DB465B711
2 changed files with 2 additions and 2 deletions

View file

@ -106,7 +106,7 @@ sandbox::sandbox(const char *game_path) : ruby(new struct w2c_ruby), wasi(new wa
usize state_buf = sandbox_malloc(sizeof(usize));
AWAIT(valid = w2c_ruby_ruby_executable_node(RB, node, state_buf));
if (valid) {
AWAIT(state = w2c_ruby_ruby_exec_node(RB, WASM_GET(u32, state_buf)));
AWAIT(state = w2c_ruby_ruby_exec_node(RB, node));
}
if (!valid || state) {
throw SandboxNodeException();

View file

@ -97,7 +97,7 @@ $(LIBDIR)/mkxp-retro-dist.zip: $(LIBDIR)/mkxp-retro-dist/bin/ruby $(P7ZIP)
rm -r $(LIBDIR)/_mkxp-retro-dist/include
rm -r $(LIBDIR)/_mkxp-retro-dist/share
rm -r $(LIBDIR)/_mkxp-retro-dist/lib/ruby/gems/$(RUBY_VERSION).0/cache/*
echo '# This is a Ruby script that does nothing. We make Ruby load this file on startup just because Ruby needs to load a script on startup for some reason. No, we cannot just use `-e`: for some reason that sometimes causes the Ruby VM to crash on startup.' > $(LIBDIR)/_mkxp-retro-dist/bin/mkxp-z
echo '# This is a Ruby script that does nothing. We make Ruby load this file on startup just because Ruby needs to load a script on startup for some reason.' > $(LIBDIR)/_mkxp-retro-dist/bin/mkxp-z
rm -f $(LIBDIR)/mkxp-retro-dist.zip
cd $(LIBDIR)/_mkxp-retro-dist && $(P7ZIP) a -bb3 -mm=zstd -mx=19 $(LIBDIR)/mkxp-retro-dist.zip *
rm -r $(LIBDIR)/_mkxp-retro-dist