#---------------------------------------------------------------------------
# *DataManager File Code1.2 date:2014.11.8 by.lyaci
#---------------------------------------------------------------------------
module DataManager
INVTEXT = '无效存档...'
CODEREXP = /:0x.{7}|[^0-9]/
CODESTR = String.new
def self.save_game_without_rescue(index)
File.open(make_filename(index), "wb") do |file|
$game_system.on_before_save
Marshal.dump(make_save_header, file)
data = Zlib::Deflate.deflate(Marshal.dump(make_save_contents).to_s)
Marshal.dump(data, file)
@last_savefile_index = index
end
file = File.open(make_filename(index), "ab")
Marshal.dump(get_self_code, file)
file.close
return true
end
def self.load_game_without_rescue(index)
File.open(make_filename(index), "rb") do |file|
Marshal.load(file)
data = Zlib::Inflate.inflate(Marshal.load(file))
extract_save_contents(Marshal.load(data))
code = Marshal.load(file)
unless code == get_self_code
msgbox(INVTEXT)
return false
end
reload_map_if_updated
@last_savefile_index = index
end
return true
end
def self.get_self_code
ini = [0].pack('L*')
vif = Win32API.new("kernel32", "GetVolumeInformation", 'PPIP', 'V')
vif.call("c:\\","\0"*128,128,ini);ini.unpack("L*")[-1]
end
end