mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-25 16:23:46 +02:00
Fix array indexing in sandbox-bindgen.rb
This commit is contained in:
parent
7de761873c
commit
19cafa332c
2 changed files with 19 additions and 5 deletions
|
@ -32,7 +32,21 @@ GIT := git
|
|||
CLONE := $(GIT) clone -q --depth 1
|
||||
GITHUB := https://github.com
|
||||
|
||||
default: $(OUTDIR)/mkxp-retro-dist.zip.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby.h $(OUTDIR)/mkxp-sandbox-bindgen.cpp $(OUTDIR)/mkxp-sandbox-bindgen.h $(OUTDIR)/wasm2c/wasm-rt-impl.c $(OUTDIR)/wasm2c/wasm-rt-mem-impl.c $(OUTDIR)/libretro.h
|
||||
all default: deps ruby-dist ruby-bindings
|
||||
|
||||
ruby-dist: $(OUTDIR)/mkxp-retro-dist.zip.c $(OUTDIR)/mkxp-retro-ruby/mkxp-retro-ruby.h
|
||||
|
||||
ruby-bindings: $(OUTDIR)/mkxp-sandbox-bindgen.cpp $(OUTDIR)/mkxp-sandbox-bindgen.h
|
||||
|
||||
deps: $(OUTDIR)/libretro.h $(OUTDIR)/wasm2c/wasm-rt-impl.c $(OUTDIR)/wasm2c/wasm-rt-mem-impl.c
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_PREFIX)
|
||||
|
||||
clean-ruby-bindings:
|
||||
rm -f $(OUTDIR)/mkxp-sandbox-bindgen.cpp; \
|
||||
rm -f $(OUTDIR)/mkxp-sandbox-bindgen.h; \
|
||||
rm -f $(LIBDIR)/tags
|
||||
|
||||
$(OUTDIR)/libretro.h:
|
||||
mkdir -p $(OUTDIR); \
|
||||
|
@ -99,7 +113,7 @@ $(OUTDIR)/mkxp-sandbox-bindgen.cpp $(OUTDIR)/mkxp-sandbox-bindgen.h: $(LIBDIR)/t
|
|||
mv mkxp-sandbox-bindgen.cpp $(OUTDIR)
|
||||
|
||||
$(LIBDIR)/tags: $(LIBDIR)/include/ruby-$(RUBY_VERSION).0
|
||||
$(CTAGS) -R --output-format=e-ctags --fields=S --kinds-c=p --kinds-c++=p -o $(LIBDIR)/tags $(LIBDIR)/include/ruby-$(RUBY_VERSION).0
|
||||
$(CTAGS) -R --fields=S --kinds-c=p --kinds-c++=p -o $(LIBDIR)/tags $(LIBDIR)/include/ruby-$(RUBY_VERSION).0
|
||||
|
||||
$(RUBY) $(LIBDIR)/include/ruby-$(RUBY_VERSION).0: $(DOWNLOADS)/baseruby/Makefile
|
||||
cd $(DOWNLOADS)/baseruby; \
|
||||
|
|
|
@ -60,7 +60,7 @@ ARG_HANDLERS = {
|
|||
buf_size: 'PREV_ARG * sizeof(wasm_ptr_t)',
|
||||
serialize: <<~HEREDOC
|
||||
for (int i = 0; i < PREV_ARG; ++i) {
|
||||
((wasm_ptr_t *)module_instance->w2c_memory.data + BUF)[i] = SERIALIZE_PTR(ARG[i]);
|
||||
((wasm_ptr_t *)(module_instance->w2c_memory.data + BUF))[i] = SERIALIZE_PTR(ARG[i]);
|
||||
}
|
||||
HEREDOC
|
||||
},
|
||||
|
@ -355,7 +355,7 @@ File.readlines('tags', chomp: true).each do |line|
|
|||
std::va_list a;
|
||||
va_start(a, a#{args.length - 2});
|
||||
for (long i = 0; i < a#{args.length - 2}; ++i) {
|
||||
((wasm_ptr_t *)module_instance->w2c_memory.data + v)[i] = SERIALIZE_PTR(va_arg(a, wasm_ptr_t));
|
||||
((wasm_ptr_t *)(module_instance->w2c_memory.data + v))[i] = SERIALIZE_PTR(va_arg(a, wasm_ptr_t));
|
||||
}
|
||||
va_end(a);
|
||||
HEREDOC
|
||||
|
@ -378,7 +378,7 @@ File.readlines('tags', chomp: true).each do |line|
|
|||
throw SandboxOutOfMemoryException();
|
||||
}
|
||||
for (wasm_ptr_t i = 0; i < n; ++i) {
|
||||
((wasm_ptr_t *)module_instance->w2c_memory.data + v)[i] = SERIALIZE_PTR(va_arg(a, wasm_ptr_t));
|
||||
((wasm_ptr_t *)(module_instance->w2c_memory.data + v))[i] = SERIALIZE_PTR(va_arg(a, wasm_ptr_t));
|
||||
}
|
||||
HEREDOC
|
||||
binding += "\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue