I think the reason this was originally done was some
issue with ruby's GC where it would wrongfully sweep
the script array variable on the C stack.
This change should speed up startup a little.
This looks like a pretty major change, but in reality,
80% of it is just renames of types and corresponding
methods.
The config parsing code has been completely replaced
with a boost::program_options based version. This
means that the config file format slightly changed
(checkout the updated README).
I still expect there to be bugs / unforseen events.
Those should be fixed in follow up commits.
Also, finally reverted back to using pkg-config to
locate and link libruby. Yay for less hacks!
An exception is made of TexPool, which will need a
bit more testing before transitioning to std containers.
Also replace 'int' with 'size_t' where it is used only
as an array index.
The general rule I'm aiming for is to <> include
system wide / installed paths / generally everything
that's outside the git managed source tree (this means
mruby paths too!), and "" include everything else,
ie. local mkxp headers.
The only current exception are the mri headers, which
all have './' at their front as to not clash with
system wide ruby headers. I'm leaving them be for now
until I can come up with a better general solution.
This replaces the previously directly bound #clone
methods, which weren't really the "the Ruby way".
Rubys default Object#clone will call into our #init_copy
methods instead.
Partly incorporates pull request #3 by /cremno.
Previously, wrapped instances of mkxp core classes were
stored as RData ivars inside the actual object. This turned
out to be pointless as RData objects themselves are perfectly
valid objects that can carry ivars and have parent classes.
Therefore, the RData objects are now exposed directly to
the user scripts, effectively halving the amount of object
allocations.
We override 'Marshal::load()' via alias and call it with
a custom auxiliary proc in the alias which sets the encoding
of all demarshalled strings to UTF-8. The case where a user
himself provided a proc to 'load()' is not implemented.
This is definitely a better solution than patching the ruby
source tree. Thanks to github.com/cremno for hints and help!
Using "SDL2/SDL_xxx.h" instead of "SDL_xxx.h" caused
the include paths provided by pkg-config to be ignored,
and headers from a standard include path to be used instead.
What can I say. I made a pact with the devil, and paid dearly.
Almost a whole day's worth of debugging, actually. Not again.
If this turns out to be slow we can always optimize the critical
parts (with no variable param count) later, or completely remove it.