MRI: fix $RGSS_SCRIPTS

This commit is contained in:
cremno 2014-04-10 01:16:31 +02:00
parent f8b87eb188
commit 4e0262d2a7
1 changed files with 13 additions and 3 deletions

View File

@ -262,15 +262,24 @@ static void runRMXPScripts()
}
rb_ary_store(script, 3, rb_str_new_cstr(decodeBuffer.c_str()));
}
for (long i = 0; i < scriptCount; ++i)
{
VALUE script = rb_ary_entry(scriptArray, i);
VALUE scriptDecoded = rb_ary_entry(script, 3);
/* Store encoding header + the decoded script
* in 'sc.decData' */
std::string decData = "#encoding:utf-8\n";
size_t hdSize = decData.size();
decData.resize(hdSize + bufferLen);
memcpy(&decData[hdSize], decodeBuffer.c_str(), bufferLen);
const char *scriptDecPtr;
long scriptDecLen;
RSTRING_GETMEM(scriptDecoded, scriptDecPtr, scriptDecLen);
decData.resize(hdSize + scriptDecLen);
memcpy(&decData[hdSize], scriptDecPtr, scriptDecLen);
ruby_script(RSTRING_PTR(scriptName));
ruby_script(RSTRING_PTR(rb_ary_entry(script, 1)));
/* Execute code */
rb_eval_string_protect(decData.c_str(), 0);
@ -281,6 +290,7 @@ static void runRMXPScripts()
}
}
static void mriBindingExecute()
{
ruby_setup();