From aace283683ea664af0e249082e5df25c276336f1 Mon Sep 17 00:00:00 2001 From: ZakatTeamI2P Date: Fri, 3 Apr 2026 14:38:30 +0400 Subject: [PATCH] a --- README.md | 7 +++++++ binding-mri/binding-util.h | 6 ++---- binding-mri/filesystem-binding.cpp | 26 ++++++++++++++++---------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ba60dc3..5d675e5 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,10 @@ cmake -S . -B build cd build make -jn n - count of threads for compilation + +#TODOs: +*Port to SDL3,Modern ruby and other +*Extend API with usefull thinks idk... +*Fix bugs +*Upgrade linux support +*MAKE THIS WORK diff --git a/binding-mri/binding-util.h b/binding-mri/binding-util.h index 2ca62f6..cd13e8d 100644 --- a/binding-mri/binding-util.h +++ b/binding-mri/binding-util.h @@ -290,13 +290,11 @@ int rb_get_args(int argc, VALUE *argv, const char *format, ...); typedef VALUE (*RubyMethod)(int argc, VALUE *argv, VALUE self); -static inline void -_rb_define_method(VALUE klass, const char *name, RubyMethod func){ +static inline void _rb_define_method(VALUE klass, const char *name, RubyMethod func){ rb_define_method(klass, name, RUBY_METHOD_FUNC(func), -1); } -static inline void -rb_define_class_method(VALUE klass, const char *name, RubyMethod func){ +static inline void rb_define_class_method(VALUE klass, const char *name, RubyMethod func){ rb_define_singleton_method(klass, name, RUBY_METHOD_FUNC(func), -1); } diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index 77ccb31..2d8f393 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -28,8 +28,7 @@ #include "ruby/encoding.h" #include "ruby/intern.h" -static void -fileIntFreeInstance(void *inst){ +static void fileIntFreeInstance(void *inst){ SDL_IOStream *ops = static_cast(inst); SDL_CloseIO(ops); @@ -184,23 +183,26 @@ static VALUE customProc(VALUE arg, VALUE proc) return obj; } -RB_METHOD(_marshalLoad) -{ +RB_METHOD(_marshalLoad){ + printf("test\n"); RB_UNUSED_PARAM; - + printf("test2\n"); VALUE port, proc = Qnil; - - rb_get_args(argc, argv, "o|o", &port, &proc RB_ARG_END); - + printf("test3\n"); + rb_scan_args(argc, argv, "01", &port, &proc); + //rb_get_args(argc, argv, "o|o", &port, &proc RB_ARG_END); + printf("test4\n"); VALUE utf8Proc; if (NIL_P(proc)) utf8Proc = rb_proc_new(RUBY_METHOD_FUNC(stringForceUTF8), Qnil); else utf8Proc = rb_proc_new(RUBY_METHOD_FUNC(customProc), proc); - + printf("test5\n"); VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); - + //if (!rb_obj_is_kind_of(marsh, rb_cModule)) rb_raise(rb_eRuntimeError, "Marshal not found"); + printf("test6\n"); VALUE v[] = { port, utf8Proc }; + printf("test7\n"); return rb_funcall2(marsh, rb_intern("_mkxp_load_alias"), ARRAY_SIZE(v), v); } @@ -221,7 +223,11 @@ fileIntBindingInit() /* We overload the built-in 'Marshal::load()' function to silently * insert our utf8proc that ensures all read strings will be * UTF-8 encoded */ + printf("test8\n"); VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); + printf("test9\n"); rb_define_alias(rb_singleton_class(marsh), "_mkxp_load_alias", "load"); + printf("test10\n"); _rb_define_module_function(marsh, "load", _marshalLoad); + printf("test11\n"); }