mkxp
mkxp copied to clipboard
Fix mruby bindings
The bindings currently provided are really old and incompatible with API changes. mkxp compiles and runs against the latest mruby with these changes.
Good to see someone work on this! :+1:
@Ancurio any reason why the RPG module is defined differently for mruby and MRI? The current mruby module gives me really cryptic errors; just adding the scripts from MRI to my Scripts.rxdata
works pretty well. With only minor changes, the game seems to work (sorta), though for some reason no events are being triggered as I interact with them :(
@pulsejet
any reason why the RPG module is defined differently for mruby and MRI? The current mruby module gives me really cryptic errors; just adding the scripts from MRI to my Scripts.rxdata works pretty well. With only minor changes, the game seems to work (sorta), though for some reason no events are being triggered as I interact with them :(
The mruby RPG module is the pre-compiled bytecode version; if there was a way to do this with MRI I would, but atm I can only feed it plain Ruby source code. You should be able to use your up-to-date version of mruby to update the precompiled bytecode.
@Ancurio
The mruby RPG module is the pre-compiled bytecode version; if there was a way to do this with MRI I would, but atm I can only feed it plain Ruby source code.
Would there be any realistic advantage of doing this?
Fixed up the requested changes and updated the RPG module. Decided to move the bytecode to a separate xxd
file the way the mri bindings do; is there any argument against this?
Would there be any realistic advantage of doing this?
Maybe it just irks me to parse the same source code every time on startup; but you're right, it might be less of a headache to always just parse source instead having to compile against a possibly changing bytecode-specification (like with mruby); and I believe there might be far heavier tasks going on at startup.
Ideally though, the bytecode compilation would be integrated in mkxp's build process,
Could you please compile mruby without the io
gem and only keep the fixes required to get that running? We can move eventual changes from replacing my custom code with the gem into a separate issue/PR.
Sorry I didn't see this. Going out of town for now; I'll fix this when I get back. @Ancurio do we also want to make the change to to mruby-marshal? It seems to be much more complete and saving/loading works with minor changes (you can dump/load only once) unlike the current marshal class. One downside is that it depends on onig.
@pulsejet Wait, my marshal code can only dump / load once? That's not supposed to happen.. I think. The Marshal gem by @take-cheeze is not merged into mruby, is it? I would consider switching to it; the more code being shared, the better, especially if it's more complete.
Do you know the status of regular expressions in mruby? I also remember having quite a few problems with that in the past.
Noo @take-cheeze's mruby-marshal can load only once in the sense that you can't get variables by doing variable_name = Marshal.load(file)
repeatedly, as it will set the entire contents of the file to variable_name
and for dump any repeated calls are ignored. That part isn't merged yet. Sorry for the confusion.
For Regex, I'm using mruby-onig-regexp, but I've also tried mruby-regexp-pcre and both seem to work fine, at least as far as I tested.
I wonder if @take-cheeze 's implementation can be configured for different RegExp implementations. Also on the dumping / loading only working once, that's a different behavior from MRI then, isn't it? I wonder if that is intentional or a bug.
Might be intentional, not sure. How is the behavior of MRI supposed to be implemented anyway? As for regex, I think using onig might be recommendable anyway, since the PCRE implementation says that you might want to use onig if you want better compatibility with MRI.
Sorry I completely forgot about this. Removed the IOError2
thing (don't even remember much now) and right now this just works with mruby 1.4.1 compiled with the default gems (which includes io
, btw), and the default game seems to run fine (with the exception of save/load, of course). @Ancurio could you please go over this quickly one more time?