Closed khkramer closed 9 years ago
Can you try adding ruby_sysinit(0, NULL)
at the beginning of mriBindingExecute
in binding-mri/binding-mri.cpp
?
Added it like this:
static void mriBindingExecute()
{
ruby_sysinit(0, NULL);
ruby_setup();
rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));
RbData rbData;
shState->setBindingData(&rbData);
mriBindingInit();
std::string &customScript = shState->rtData().config.customScript;
if (!customScript.empty())
runCustomScript(customScript);
else
runRMXPScripts();
VALUE exc = rb_errinfo();
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
showExc(exc);
ruby_cleanup(0);
shState->rtData().rqTermAck = true;
}
and recompiled. It just exits without any error messages whatsoever.
Then I tried it like this:
static void mriBindingExecute()
{
ruby_setup();
ruby_sysinit(0, NULL);
rb_enc_set_default_external(rb_enc_from_encoding(rb_utf8_encoding()));
RbData rbData;
shState->setBindingData(&rbData);
mriBindingInit();
std::string &customScript = shState->rtData().config.customScript;
if (!customScript.empty())
runCustomScript(customScript);
else
runRMXPScripts();
VALUE exc = rb_errinfo();
if (!NIL_P(exc) && !rb_obj_is_kind_of(exc, rb_eSystemExit))
showExc(exc);
ruby_cleanup(0);
shState->rtData().rqTermAck = true;
}
And that gave me this error output:
<main>: [BUG] Segmentation fault
ruby 2.0.0p481 (2014-05-08 revision 45883) [i386-mingw32]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0002 E:0019a4 TOP [FINISH]
-- C level backtrace information -------------------------------------------
C:\Windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0xc) [0x770ED1BC]
C:\Windows\SYSTEM32\KERNELBASE.dll(WaitForSingleObject+0x12) [0x7609103D]
G:\Pokemon_NoxMK\msvcrt-ruby200.dll(nl_langinfo_codeset+0xcecd3) [0x66925477]
G:\Pokemon_NoxMK\msvcrt-ruby200.dll(Init_File+0xb60) [0x667D075C] g:\ruby-2.0.0-
p481\file.c:5725
G:\Pokemon_NoxMK\msvcrt-ruby200.dll(nl_langinfo_codeset+0x670ec) [0x668BD890]
G:\Pokemon_NoxMK\msvcrt-ruby200.dll(rb_file_expand_path+0x14) [0x667D151E] g:\ru
by-2.0.0-p481\file.c:3317
G:\Pokemon_NoxMK\msvcrt-ruby200.dll(nl_langinfo_codeset+0x4bffc) [0x668A27A0]
C:\Windows\SYSTEM32\msvcrt.dll(XcptFilter+0x14e) [0x7621F630]
C:\Windows\SYSTEM32\msvcrt.dll(libm_sse2_tan_precise+0x11bdc) [0x76201CF7]
C:\Windows\SYSTEM32\msvcrt.dll(beginthreadex+0xc7) [0x761B0CEC]
C:\Windows\SYSTEM32\KERNEL32.DLL(BaseThreadInitThunk+0xe) [0x75F6919F]
C:\Windows\SYSTEM32\ntdll.dll(RtlInitializeExceptionChain+0x84) [0x770FA8CB]
-- Other runtime information -----------------------------------------------
What about this?
static void mriBindingExecute()
{
int argc;
char **argv;
ruby_sysinit(&argc, &argv);
ruby_setup();
I can't test it at the moment. I hope you don't mind that you have to test my guesses!
Of course I don't mind, you're trying to help me out here.
EDIT: That worked like a charm, thank you very much.
Is it okay to pass uninitialized variables into ruby_sysinit
?
Also,
/*! Initializes the process for ruby(1).
*
* This function assumes this process is ruby(1) and it has just started.
* Usually programs that embeds CRuby interpreter should not call this function,
* and should do their own initialization.
*/
I guess this doesn't make much sense to include in master then?
ruby_sysinit
needs to be called. At least on Windows, because it calls rb_w32_sysinit
.
The RMX-OS Input module also seems to be broken, even after I've already fixed all Win32-api calls.
I'm not getting any errors or warnings whatsoever though.
It should actually be compatible with Ruby 2.0 so that shouldn't be the problem, since it also worked with ARC.
Hm, how did you "fix" the Win32API calls? Did you use equivalent Xlib calls instead?
I used the win32-api gem, as I'm currently still on windows only.
Ohh, right, forgot you're on windows. My bad.
Maybe there's a difference in how RMXP's player sets up its window compared to mkxp (SDL2), but I'm not familiar with Windows development at all unfortunately.
It seems to be the input module does not allow 'overwriting' it I think, when I aliased the update method adding a call to the rmxos's input module update method it worked, however this is a far from ideal solution.
So I stubbed out the Win32API class and made an Input.update
call in the main script, and it did call the correct overwritten RMX-OS Input::update function. Very weird =/
Fixed that issue, but can't seem to get the method working that gets an input string.
This method is pretty vital as it's used for the login/register screen and the chat.
It's also in the RMX-OS Input module.
I've googled around for this error but nothing relevant came up. I've tried recompiling Ruby several times in the hopes that it would fix it but no luck so far. Here is the output of $LOADED_FEATURES: