A better Marshal.load for RPG Maker XP

Wed, 03 Oct 2007 04:14:21 -0400 - Author:

This overload of Marshal.load allows you to read files from your RPG Maker XP project, even in encrypted archives. Just use load_data to do so. If the file isn't a serialized Ruby object, then Marshal.load will consider it a string and return that instead.

module Marshal
 class << self
  alias oldload load
  def load(port,*arg)
   begin
    return oldload(port,*arg)
   rescue
    if port.is_a?(IO)
      return port.read
    else
      return port
    end
   end
  end
 end
end