From a235171c5fa4674f84105e58c3285793f18d790d Mon Sep 17 00:00:00 2001 From: meowtech Date: Sun, 3 May 2026 14:32:02 +0000 Subject: [PATCH] having no idea what to do to make it work, but.. it crashes in another file now yipeeeeeeee!!! --- binding-mri/binding-mri.cpp | 11 +++++++---- binding-mri/filesystem-binding.cpp | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp index 6d4a474..81cf275 100644 --- a/binding-mri/binding-mri.cpp +++ b/binding-mri/binding-mri.cpp @@ -331,6 +331,7 @@ struct evalArg{ }; static VALUE evalHelper(evalArg *arg){ + // crashes with Game_Battler_1 for some reason VALUE argv[] = { arg->string, Qnil, arg->filename }; return rb_funcall2(Qnil, rb_intern("eval"), ARRAY_SIZE(argv), argv); } @@ -381,7 +382,7 @@ static void runRMXPScripts(BacktraceData &btData){ * still go wrong */ try{ scriptArray = kernelLoadDataInt(scriptPack.c_str(), false); - printf("[runRMXPScripts] %s", scriptPack.c_str()); + printf("[runRMXPScripts] %s\n", scriptPack.c_str()); }catch (const Exception &e){ showMsg(std::string("Failed to read script data: ") + e.msg); return; @@ -410,7 +411,7 @@ static void runRMXPScripts(BacktraceData &btData){ VALUE scriptName = rb_ary_entry(script, 1); VALUE scriptString = rb_ary_entry(script, 2); - printf("[runRMXPScripts] Script Name: %s", rb_str_to_str(scriptName)); + //printf("[runRMXPScripts] Script Name: %s\n", RSTRING_PTR(scriptName)); int result = Z_OK; unsigned long bufferLen; @@ -433,8 +434,8 @@ static void runRMXPScripts(BacktraceData &btData){ if (result != Z_OK){ static char buffer[256]; - snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'", i, RSTRING_PTR(scriptName)); - printf("[runRMXPScripts] Script Name: %s", buffer); + snprintf(buffer, sizeof(buffer), "Error decoding script %ld: '%s'\n", i, RSTRING_PTR(scriptName)); + //printf("[runRMXPScripts] Script Name: %s\n", buffer); showMsg(buffer); break; @@ -468,6 +469,8 @@ static void runRMXPScripts(BacktraceData &btData){ fname = newStringUTF8(buf, len); btData.scriptNames.insert(buf, scriptName); + printf("%s\n", scriptName); + int state; evalString(string, fname, &state); if (state) diff --git a/binding-mri/filesystem-binding.cpp b/binding-mri/filesystem-binding.cpp index f0340b7..177de1d 100644 --- a/binding-mri/filesystem-binding.cpp +++ b/binding-mri/filesystem-binding.cpp @@ -207,7 +207,8 @@ RB_METHOD(_marshalLoad){ VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); VALUE v[] = { port, utf8Proc }; - return rb_funcall_with_block(marsh, rb_intern("_mkxp_load_alias"), 1, &port, utf8Proc); + return rb_marshal_load(port); // uh.. well.. it works now at least. + //return rb_funcall_with_block(marsh, rb_intern("_mkxp_load_alias"), 1, &port, utf8Proc); } void fileIntBindingInit(){