From f608a94fb7eb2b033faed0d69ae51bceb8783e3c Mon Sep 17 00:00:00 2001 From: Inori Date: Mon, 5 Aug 2019 11:24:51 -0400 Subject: [PATCH] Fix loading from encrypted archives (RGSSADs) --- binding/filesystem-binding.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/binding/filesystem-binding.cpp b/binding/filesystem-binding.cpp index c8630079..742f8849 100644 --- a/binding/filesystem-binding.cpp +++ b/binding/filesystem-binding.cpp @@ -135,14 +135,7 @@ kernelLoadDataInt(const char *filename, bool rubyExc) { rb_gc_start(); -#ifndef OLD_RUBY 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")); @@ -234,6 +227,9 @@ fileIntBindingInit() _rb_define_method(klass, "read", fileIntRead); _rb_define_method(klass, "getbyte", fileIntGetByte); +#ifdef OLD_RUBY // Marshal looks for 'getc', not 'getbyte' + rb_define_alias(klass, "getc", "getbyte"); +#endif _rb_define_method(klass, "binmode", fileIntBinmode); _rb_define_method(klass, "close", fileIntClose);