Get a game running with 1.8 (Used Ao Oni)

This commit is contained in:
Inori 2019-07-30 03:31:34 -04:00 committed by Inori
parent 5bccdb761f
commit be9eda93c0
2 changed files with 9 additions and 2 deletions

View file

@ -394,7 +394,7 @@ static inline VALUE
rb_file_open_str(VALUE filename, const char *mode) rb_file_open_str(VALUE filename, const char *mode)
{ {
VALUE fileobj = rb_const_get(rb_cObject, rb_intern("File")); VALUE fileobj = rb_const_get(rb_cObject, rb_intern("File"));
return rb_funcall(fileobj, rb_intern("open"), 2, filename, mode); return rb_funcall(fileobj, rb_intern("open"), 2, filename, rb_str_new2(mode));
} }
#endif #endif

View file

@ -132,8 +132,15 @@ VALUE
kernelLoadDataInt(const char *filename, bool rubyExc) kernelLoadDataInt(const char *filename, bool rubyExc)
{ {
rb_gc_start(); rb_gc_start();
#ifndef OLD_RUBY
VALUE port = fileIntForPath(filename, rubyExc); VALUE port = fileIntForPath(filename, rubyExc);
#else
// the above results in an uninitialized IO,
// so let's use Ruby to open the file instead
// hopefully a temporary fix
VALUE port = rb_file_open_str(rb_str_new2(filename), "rb");
#endif
VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal")); VALUE marsh = rb_const_get(rb_cObject, rb_intern("Marshal"));