查看: 2466|回复: 0

[已经过期] 修改报错脚本的问题

[复制链接]
梦石
0
星屑
2245
在线时间
1015 小时
注册时间
2015-10-17
回帖
1077
发表于 2017-9-29 14:31:22 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
下面这个脚本,有人说没有修改也会出现无效存档,帮忙看看哪里出了问题,谢谢

  1. #---------------------------------------------------------------------------
  2. # *DataManager File Code1.2 date:2014.11.8 by.lyaci
  3. #---------------------------------------------------------------------------
  4. module DataManager
  5.   INVTEXT = '无效存档...'
  6.   CODEREXP = /:0x.{7}|[^0-9]/
  7.   CODESTR = String.new
  8.   def self.save_game_without_rescue(index)
  9.     File.open(make_filename(index), "wb") do |file|
  10.       $game_system.on_before_save
  11.       Marshal.dump(make_save_header, file)
  12.       data = Zlib::Deflate.deflate(Marshal.dump(make_save_contents).to_s)
  13.       Marshal.dump(data, file)
  14.       @last_savefile_index = index
  15.     end
  16.     file = File.open(make_filename(index), "ab")
  17.     Marshal.dump(get_self_code, file)
  18.     file.close
  19.     return true
  20.   end
  21.   def self.load_game_without_rescue(index)
  22.     File.open(make_filename(index), "rb") do |file|
  23.       Marshal.load(file)      
  24.       data = Zlib::Inflate.inflate(Marshal.load(file))
  25.       extract_save_contents(Marshal.load(data))
  26.       code = Marshal.load(file)
  27.       unless code == get_self_code
  28.         msgbox(INVTEXT)
  29.         return false
  30.       end
  31.       reload_map_if_updated
  32.       @last_savefile_index = index
  33.     end
  34.     return true
  35.   end
  36.   def self.get_self_code
  37.     ini = [0].pack('L*')
  38.     vif = Win32API.new("kernel32", "GetVolumeInformation", 'PPIP', 'V')
  39.     vif.call("c:\","\0"*128,128,ini);ini.unpack("L*")[-1]
  40.   end
  41. end
复制代码

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部