mkxp
mkxp copied to clipboard
Add MRI 1.8 Support
This allows compiling of mkxp against Ruby 1.8.7 (tested with p374).
To test that it works simply start a RPG Maker XP game. If you get "Win32Api not found" instead of "Syntax error" it works ;).
This is mostly implemented by providing wrapper functions and macros (mostly copy-pasted from ruby 2.4) in binding-util.h.
Known issues:
- Everything encoding related is no-op by now. Includes the UTF8-Marhsaller. Guess I need to use the iconv-module here. I know that ruby reworked the whole encoding code in Ruby 2 but my Ruby knowledge is almost zero so I'm a bit lost here :(
- ~~ruby_option (like ruby_sysinit) segfaults when called.~~ call removed for now
- rb_check_typeddata not implemented
- rb_typeddata_is_kind_of not implemented
- ~~rb_hash_lookup2 not implemented but this is only in a RGSS3 codepath, so not relevant~~
- ~~rb_str_catf not implemented (so no stacktrace printed in error case)~~
- ~~raiseDisposedAccess will never raise~~
That typed data stuff was a bit tricky to fake because Ruby 1.8 does not have this typed data struct. But is good enough to launch games. Though some sanity checks are missing (see issues above)
To The Moon (Windows version) with 2.4 MRI:
With 1.8 MRI:
With 1.8 MRI and some WinApi emulation (Mouse cursor is stuck):
Also fixed compile for MRI 1.9, but this crashes with "[BUG] object allocation during garbage collection phase" on startup >.>
I can't comment too much on the 1.8 since I'm not familiar with the differences to 2.x
I'm also coding blind because the documentation for MRI 1.8 is basicly non-existent :D
Added raiseDisposedAccess (though the reported classname will be quite useless, just some internal class(#12345678). Though the bookkeeping for storing the "emulated typed data classname" somewhere is not worth the afford imho. So the sanity checks will also not work (they always return true) but I guess they bomb a bit later then. Or do you have any ideas to solve this with not too much work?
rb_str_catf and rb_hash_lookup2 are implemented. hash_lookup is quite useless, only used in VX Ace codepath.
The stacktrace somehow only always contains one element in my tests and I have no idea why o.O
Rebased my changes but I can't test if I failed with my rebase because I can't get mkxp to compile because PhysFS changed the API >.>. I also applied @carstene1ns PR, but I still get
rgssad.cpp:507:1: error: conversión no válida de ‘int (*)(void*, const char*, PHYSFS_EnumerateCallback, const char*, void*) {aka int (*)(void*, const char*, PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*), const char*, void*)}’ a ‘PHYSFS_EnumerateCallbackResult (*)(void*, const char*, PHYSFS_EnumerateCallback, const char*, void*) {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*), const char*, void*)}’ [-fpermissive]
};
^
rgssad.cpp:528:1: error: conversión no válida de ‘int (*)(void*, const char*, PHYSFS_EnumerateCallback, const char*, void*) {aka int (*)(void*, const char*, PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*), const char*, void*)}’ a ‘PHYSFS_EnumerateCallbackResult (*)(void*, const char*, PHYSFS_EnumerateCallback, const char*, void*) {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*), const char*, void*)}’ [-fpermissive]
};
^
src/rgssad.cpp:638:1: error: conversión no válida de ‘int (*)(void*, const char*, PHYSFS_EnumerateCallback, const char*, void*) {aka int (*)(void*, const char*, PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*), const char*, void*)}’ a ‘PHYSFS_EnumerateCallbackResult (*)(void*, const char*, PHYSFS_EnumerateCallback, const char*, void*) {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*), const char*, void*)}’ [-fpermissive]
};
^
make[2]: *** [CMakeFiles/mkxp.dir/build.make:983: CMakeFiles/mkxp.dir/src/rgssad.cpp.o] Error 1
make[2]: *** Se espera a que terminen otras tareas....
filesystem.cpp: En la función ‘int cacheEnumCB(void*, const char*, const char*)’:
filesystem.cpp:429:44: error: conversión no válida de ‘int (*)(void*, const char*, const char*)’ a ‘PHYSFS_EnumerateCallback {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*)}’ [-fpermissive]
PHYSFS_enumerate(fullPath, cacheEnumCB, d);
^
In file included from src/rgssad.h:25:0,
from src/filesystem.cpp:24:
/usr/include/physfs.h:2746:17: nota: argumento de inicialización 2 de ‘int PHYSFS_enumerate(const char*, PHYSFS_EnumerateCallback, void*)’
PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c,
^~~~~~~~~~~~~~~~
src/filesystem.cpp: En la función miembro ‘void FileSystem::createPathCache()’:
src/filesystem.cpp:452:41: error: conversión no válida de ‘int (*)(void*, const char*, const char*)’ a ‘PHYSFS_EnumerateCallback {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*)}’ [-fpermissive]
PHYSFS_enumerate("", cacheEnumCB, &data);
^
In file included from src/rgssad.h:25:0,
from src/filesystem.cpp:24:
/usr/include/physfs.h:2746:17: nota: argumento de inicialización 2 de ‘int PHYSFS_enumerate(const char*, PHYSFS_EnumerateCallback, void*)’
PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c,
^~~~~~~~~~~~~~~~
src/filesystem.cpp: En la función ‘int findFontsFolderCB(void*, const char*, const char*)’:
src/filesystem.cpp:517:46: error: conversión no válida de ‘int (*)(void*, const char*, const char*)’ a ‘PHYSFS_EnumerateCallback {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*)}’ [-fpermissive]
PHYSFS_enumerate(fname, fontSetEnumCB, data);
^
In file included from src/rgssad.h:25:0,
from src/filesystem.cpp:24:
/usr/include/physfs.h:2746:17: nota: argumento de inicialización 2 de ‘int PHYSFS_enumerate(const char*, PHYSFS_EnumerateCallback, void*)’
PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c,
^~~~~~~~~~~~~~~~
src/filesystem.cpp: En la función miembro ‘void FileSystem::initFontSets(SharedFontState&)’:
src/filesystem.cpp:526:45: error: conversión no válida de ‘int (*)(void*, const char*, const char*)’ a ‘PHYSFS_EnumerateCallback {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*)}’ [-fpermissive]
PHYSFS_enumerate(".", findFontsFolderCB, &d);
^
In file included from src/rgssad.h:25:0,
from src/filesystem.cpp:24:
/usr/include/physfs.h:2746:17: nota: argumento de inicialización 2 de ‘int PHYSFS_enumerate(const char*, PHYSFS_EnumerateCallback, void*)’
PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c,
^~~~~~~~~~~~~~~~
src/filesystem.cpp: En la función miembro ‘void FileSystem::openRead(FileSystem::OpenHandler&, const char*)’:
src/filesystem.cpp:663:46: error: conversión no válida de ‘int (*)(void*, const char*, const char*)’ a ‘PHYSFS_EnumerateCallback {aka PHYSFS_EnumerateCallbackResult (*)(void*, const char*, const char*)}’ [-fpermissive]
PHYSFS_enumerate(dir, openReadEnumCB, &data);
^
In file included from src/rgssad.h:25:0,
from src/filesystem.cpp:24:
/usr/include/physfs.h:2746:17: nota: argumento de inicialización 2 de ‘int PHYSFS_enumerate(const char*, PHYSFS_EnumerateCallback, void*)’
PHYSFS_DECL int PHYSFS_enumerate(const char *dir, PHYSFS_EnumerateCallback c,
^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/mkxp.dir/build.make:263: CMakeFiles/mkxp.dir/src/filesystem.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/mkxp.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Any idea?
My PR is not yet updated with the change @Ancurio requested... https://hg.icculus.org/icculus/physfs/rev/22c7dd45c588 https://hg.icculus.org/icculus/physfs/rev/97d3641bfba3
Thanks. https://gist.github.com/Ghabry/001c7e920b4a62089220866e7ce68a09 compiles for me now and can confirm that the rebase was successful 👍
Thank you for fixing my PR! =)
do you know if this works with ruby 1.8.1 specifically? iirc, the mkxp-z bindings dont
Not tested. Because it is a minor update I assumed it does not have any breaking changes. Is there any game that does not work with 1.8.7?
Not tested. Because it is a minor update I assumed it does not have any breaking changes. Is there any game that does not work with 1.8.7?
yeah ive found one thats throwing some subclass error or some shit,
anyway tried on ruby 1.8.1, got
root@Silica-Ubuntu:/home/silica/mkxp-ruby18/build# make
[ 1%] Linking CXX executable mkxp.bin.x86_64
/usr/bin/ld: CMakeFiles/mkxp.dir/binding-mri/binding-util.cpp.o: in function `rb_hash_lookup2(unsigned long, unsigned long, unsigned long)':
binding-util.cpp:(.text+0x11ef): undefined reference to `rb_hash_lookup'
Is this the only error?
Replace the content of my rb_hash_lookup2 function with return def
Should be fine because it is only used by rgss3 code
maybe add like ifdef RUBY_API_VERSION_TEENY == 1
anyway it built, but does not seem to work, even with a basic RTP project :D
Well no idea then. Needs more work to find the underlying issue first