查看: 3118|回复: 3

[已经过期] 免DLL截图存档,读档指向最新存档-已过期

[复制链接]
梦石
0
星屑
218
在线时间
356 小时
注册时间
2011-3-8
回帖
43
发表于 2016-10-19 19:02:35 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 daosi 于 2016-10-24 22:59 编辑

地址:https://rpg.blue/forum.php?mod=viewthread&tid=355323
脚本:免dll截图存档+覆盖存档提示
作者:英顺的马甲

之前问过一个冲突问题,当时只是整合脚本没注意到
这段时间做游戏测试,加到40个存档,存档一多就有点麻烦了
【【读取存档的时候能不能停在最新的那个存档啊?】】
自己又不会改……_(:з」∠)_只能来伸手了……我都觉得自己很烦……舍不得截图了啦

【顺便:】
【个人整合的脚本比较多啊,存档有时截图会截到上几秒的图【【覆盖存档有时候截图并不会替换成新的】】
 删掉存档重新存,然后覆盖存档,有时截图会变成删掉的那个存档的截图,截图君特别的调皮,存的数据倒是没事】
【有什么情况下会发生这些事吗?好像电脑重启后就没事了?】
【只是单纯的电脑太垃圾,延迟吧!我是这么想的!】
【这个倒是无所谓,仅仅吐个糟】

(个人用的脚本改坐标改的很乱,放上原作者的脚本代码)

  1. #-----------------------------------------------------------------------------#
  2. # 脚本设定                                                                    #
  3. #-----------------------------------------------------------------------------#
  4. # 说明:                                                                      #
  5. # ①主要采用了Snap To Bitmap这脚本省去了DLL。                                  #
  6. # ②采用了禁术,各位不用到处改脚本了,不过冲突率也大增==                       #
  7. # ③脚本当中采用的脚本归原作者所有。                                           #
  8. # ④设置区域的变量请自行更改。                                                 #
  9. # ⑤调整了截图的API,解决一些潜在的截图BUG。                                   #
  10. #-----------------------------------------------------------------------------#
  11. SaveSettings = Struct.new(:max_save_file,:save_file_dir,:slot_name_format,
  12. :save_help,:load_help,:override_question,:snap_no_found,:no_save_file).new
  13. #-----------------------------------------------------------------------------#
  14. # 设置区域
  15. #-----------------------------------------------------------------------------#
  16. # 最大的存档量
  17. SaveSettings.max_save_file = 20
  18. # 存档所在文件夹
  19. SaveSettings.save_file_dir = "Save/"
  20. # 存档槽的名称的格式,具体请参考sprintf
  21. SaveSettings.slot_name_format = "%03d号存档"
  22. # 存档界面所显示的字符串
  23. SaveSettings.save_help = "要保存哪号存档呢?"
  24. # 读档界面所显示的字符串
  25. SaveSettings.load_help = "要读取哪号存档呢?"
  26. # 需要覆盖存档时所发问的问题
  27. SaveSettings.override_question = "存档已在,是否覆盖?新档替代,莫能重来。"
  28. # 找不到截图时的信息
  29. SaveSettings.snap_no_found = "哎哟,截图找不到啦!你都干了啥啊?"
  30. # 存档槽没有存档时显示的信息
  31. SaveSettings.no_save_file = "这里还没存档喔"

  32. #-----------------------------------------------------------------------------#
  33. # 创建存档文件夹                                                              #
  34. #-----------------------------------------------------------------------------#
  35. Dir.mkdir(SaveSettings.save_file_dir) unless FileTest.directory?(SaveSettings.save_file_dir)

  36. #-----------------------------------------------------------------------------#
  37. # 游戏核心处理类                                                              #
  38. #-----------------------------------------------------------------------------#
  39. class Game_System
  40.   #---------------------------------------------------------------------------#
  41.   # 实例变量                                                                  #
  42.   #---------------------------------------------------------------------------#
  43.   attr_accessor :snap_bitmap
  44. end

  45. #-----------------------------------------------------------------------------#
  46. # 强改存档界面                                                                #
  47. #-----------------------------------------------------------------------------#
  48. class Scene_Save
  49.   def self.new(*a)
  50.     return Scene_Save_Load.new
  51.   end
  52. end

  53. #-----------------------------------------------------------------------------#
  54. # 强改读档界面                                                                #
  55. #-----------------------------------------------------------------------------#
  56. class Scene_Load
  57.   def self.new(*a)
  58.     return Scene_Save_Load.new(1)
  59.   end
  60. end

  61. #-----------------------------------------------------------------------------#
  62. # 地图界面钩子                                                                #
  63. #-----------------------------------------------------------------------------#
  64. Scene_Map = Class.new(Scene_Map) {
  65.   superclass.constants.each{|c|const_set(c, superclass.const_get(c))}
  66.   const_set(:NoDllSLHook, true)
  67.   define_method(:main) do
  68.     super
  69.     $game_system.snap_bitmap = Graphics.snap_to_bitmap if $scene.is_a?(Scene_Menu)
  70.   end
  71. } unless Scene_Map.const_defined?(:NoDllSLHook)

  72. #-----------------------------------------------------------------------------#
  73. # 移花接木大法======这段删掉了,会出错                            #
  74. #-----------------------------------------------------------------------------#

  75. #-----------------------------------------------------------------------------#
  76. # 存档界面用窗口                                                              #
  77. #-----------------------------------------------------------------------------#
  78. class Window_Save < Window_Base
  79.   #---------------------------------------------------------------------------#
  80.   # 初始化                                                                    #
  81.   #---------------------------------------------------------------------------#
  82.   def initialize
  83.     super(160,64,480,416)
  84.     self.contents = Bitmap.new(width-32,height-32)
  85.     @_index = -1
  86.     refresh(0)
  87.   end
  88.   #---------------------------------------------------------------------------#
  89.   # 刷新                                                                      #
  90.   #---------------------------------------------------------------------------#
  91.   def refresh(index)
  92.     if index != @_index
  93.       # 清除原有资料
  94.       self.contents.clear
  95.       @sprite.dispose if @sprite != nil
  96.       @sprite = nil
  97.       # 开始读取资料
  98.       @file_index = index
  99.       @filename = SaveSettings.save_file_dir + "Save#{@file_index + 1}.rxdata"
  100.       @time_stamp = Time.at(0)
  101.       @file_exist = FileTest.exist?(@filename)
  102.       if @file_exist
  103.         file = File.open(@filename, "r")
  104.         @time_stamp         = file.mtime
  105.         @characters         = Marshal.load(file)
  106.         @frame_count        = Marshal.load(file)
  107.         @game_system        = Marshal.load(file)
  108.         @game_switches      = Marshal.load(file)
  109.         @game_variables     = Marshal.load(file)
  110.         @game_self_switches = Marshal.load(file)
  111.         @game_screen        = Marshal.load(file)
  112.         @game_actors        = Marshal.load(file)
  113.         @game_party         = Marshal.load(file)
  114.         @game_troop         = Marshal.load(file)
  115.         @game_map           = Marshal.load(file)
  116.         [url=home.php?mod=space&uid=14736]@game_player[/url]        = Marshal.load(file)
  117.         @bitmap             = @game_system.snap_bitmap
  118.         @total_sec = @frame_count / Graphics.frame_rate
  119.         file.close
  120.         # 描绘截图的框与影子
  121.         self.contents.fill_rect(34,11,400,300,Color.new(0,0,0))
  122.         self.contents.fill_rect(23,0,402,302,system_color)
  123.         self.contents.fill_rect(24,1,400,300,Color.new(0,0,0,0))
  124.         # 如截图不为空的话
  125.         if @bitmap != nil
  126.           # 描绘截图
  127.           @sprite = Sprite.new
  128.           @sprite.bitmap = @bitmap
  129.           @sprite.x = 160+16+24
  130.           @sprite.y = 64+16+1
  131.           @sprite.zoom_x = @sprite.zoom_y = 0.625
  132.           @sprite.z = 99999
  133.         else
  134.           self.contents.draw_text(0,96,448,32,SaveSettings.snap_no_found,1)
  135.         end
  136.         # 描绘角色
  137.         @characters.size.times do |i|
  138.           x = i*56 + 24
  139.           bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  140.           self.contents.blt(x,328,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4))
  141.         end
  142.         # 描绘游戏时间
  143.         hour = @total_sec / 60 / 60
  144.         min = @total_sec / 60 % 60
  145.         sec = @total_sec % 60
  146.         time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  147.         self.contents.font.color = normal_color
  148.         self.contents.draw_text(0,320,448,32,time_string,2)
  149.         # 描绘时间标记
  150.         self.contents.font.color = normal_color
  151.         time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  152.         self.contents.draw_text(0,352,448,32,time_string, 2)
  153.       else
  154.         self.contents.draw_text(0,320,448,32,SaveSettings.no_save_file,1)
  155.       end
  156.       @_index = index
  157.     end
  158.   end
  159.   #---------------------------------------------------------------------------#
  160.   # 释放                                                                      #
  161.   #---------------------------------------------------------------------------#
  162.   def dispose
  163.     super
  164.     @sprite.dispose if @sprite != nil
  165.     @sprite = nil
  166.   end
  167. end

  168. #-----------------------------------------------------------------------------#
  169. # 存档界面                                                                    #
  170. #-----------------------------------------------------------------------------#
  171. class Scene_Save_Load
  172.   #---------------------------------------------------------------------------#
  173.   # 初始化                                                                    #
  174.   #---------------------------------------------------------------------------#
  175.   def initialize(type=0)
  176.     @type = type == 0 ? "save" : "load"
  177.     case @type
  178.     when "save"
  179.       [url=home.php?mod=space&uid=79957]@WORD[/url] = SaveSettings.save_help
  180.     when "load"
  181.       @word = SaveSettings.load_help
  182.       $game_temp = Game_Temp.new
  183.     end
  184.   end
  185.   #---------------------------------------------------------------------------#
  186.   # 主执行                                                                    #
  187.   #---------------------------------------------------------------------------#
  188.   def main
  189.     # 生成帮助窗口
  190.     @help_window = Window_Help.new
  191.     @help_window.set_text(@word)
  192.     # 选项窗口
  193.     choose = []
  194.     for i in 1..SaveSettings.max_save_file
  195.       choose.push(SaveSettings.slot_name_format % i)
  196.     end
  197.     @command_window = Window_Command.new(160,choose)
  198.     @command_window.height = 416
  199.     @command_window.y = 64
  200.     @command_window.active = true
  201.     # 存档资料窗口
  202.     @save_window = Window_Save.new
  203.     # 确认窗口
  204.     @confirm_window = Window_Base.new(80,176,480,128)
  205.     @confirm_window.contents = Bitmap.new(448,96)
  206.     @confirm_window.contents.draw_text(0,0,448,32,SaveSettings.override_question,1)
  207.     @confirm_window.contents.draw_text(0,64,216,32,"确定",1)
  208.     @confirm_window.contents.draw_text(232,64,216,32,"取消",1)
  209.     @confirm_window.cursor_rect.set(232,64,216,32)
  210.     @confirm_window.z = 999999
  211.     @confirm_window.visible = false
  212.     @confirm_ok = false
  213.     # 执行过渡
  214.     Graphics.transition
  215.     # 主循环
  216.     loop do
  217.       # 刷新游戏画面
  218.       Graphics.update
  219.       # 刷新输入信息
  220.       Input.update
  221.       # 刷新画面
  222.       update
  223.       # 如果画面切换的话的就中断循环
  224.       if $scene != self
  225.         break
  226.       end
  227.     end
  228.     # 准备过渡
  229.     Graphics.freeze
  230.     # 释放窗口
  231.     @help_window.dispose
  232.     @save_window.dispose
  233.     @command_window.dispose
  234.     @confirm_window.dispose
  235.   end
  236.   #---------------------------------------------------------------------------#
  237.   # 刷新                                                                      #
  238.   #---------------------------------------------------------------------------#
  239.   def update
  240.     # 选择存档窗口激活
  241.     unless @confirm_window.visible
  242.       update_command
  243.     else
  244.       update_confirm
  245.     end
  246.   end
  247.   #---------------------------------------------------------------------------#
  248.   # 选择存档窗口刷新                                                          #
  249.   #---------------------------------------------------------------------------#
  250.   def update_command
  251.     @command_window.update
  252.     @save_window.refresh(@command_window.index)
  253.     # 按下取消键
  254.     if Input.trigger?(Input::B)
  255.       case @type
  256.       when "save"
  257.         # 演奏取消 SE
  258.         $game_system.se_play($data_system.cancel_se)
  259.         # 如果被事件调用
  260.         if $game_temp.save_calling
  261.           # 清除存档调用标志
  262.           $game_temp.save_calling = false
  263.           # 切换到地图画面
  264.           $scene = Scene_Map.new
  265.           return
  266.         end
  267.         # 切换到菜单画面
  268.         $scene = Scene_Menu.new(4)
  269.       when "load"
  270.         # 演奏取消 SE
  271.         $game_system.se_play($data_system.cancel_se)
  272.         # 切换到标题画面
  273.         $scene = Scene_Title.new
  274.       end
  275.     end
  276.     # 按下确定键
  277.     if Input.trigger?(Input::C)
  278.       # 计算存档编号
  279.       filename = SaveSettings.save_file_dir + "Save#{@command_window.index+1}.rxdata"
  280.       case @type
  281.       when "save"
  282.         if File.exist?(filename)
  283.           @confirm_window.visible = true
  284.           @confirm_window.cursor_rect.set(232,64,216,32)
  285.           @confirm_ok = false
  286.         else
  287.           process_save
  288.         end
  289.       when "load"
  290.         # 文件不存在的情况下
  291.         unless FileTest.exist?(filename)
  292.           # 演奏冻结 SE
  293.           $game_system.se_play($data_system.buzzer_se)
  294.           return
  295.         end
  296.         # 演奏读档 SE
  297.         $game_system.se_play($data_system.load_se)
  298.         # 写入存档数据
  299.         file = File.open(filename, "rb")
  300.         read_save_data(file)
  301.         file.close
  302.         # 还原 BGM、BGS
  303.         $game_system.bgm_play($game_system.playing_bgm)
  304.         $game_system.bgs_play($game_system.playing_bgs)
  305.         # 刷新地图 (执行并行事件)
  306.         $game_map.update
  307.         # 切换到地图画面
  308.         $scene = Scene_Map.new
  309.       end
  310.     end
  311.   end
  312.   #---------------------------------------------------------------------------#
  313.   # 确认窗口刷新                                                              #
  314.   #---------------------------------------------------------------------------#
  315.   def update_confirm
  316.     @confirm_window.update
  317.     if Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
  318.       $game_system.se_play($data_system.cursor_se)
  319.       @confirm_ok = true
  320.     elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
  321.       $game_system.se_play($data_system.cursor_se)
  322.       @confirm_ok = false
  323.     elsif Input.trigger?(Input::C)
  324.       $game_system.se_play($data_system.decision_se)
  325.       process_save if @confirm_ok
  326.       @confirm_window.visible = false
  327.     elsif Input.trigger?(Input::B)
  328.       $game_system.se_play($data_system.cancel_se)
  329.       @confirm_window.visible = false
  330.     end
  331.     @confirm_window.cursor_rect.set(232,64,216,32)
  332.     @confirm_window.cursor_rect.set(0,64,216,32) if @confirm_ok
  333.   end
  334.   #---------------------------------------------------------------------------#
  335.   # 执行存档                                                                  #
  336.   #---------------------------------------------------------------------------#
  337.   def process_save
  338.     # 计算存档编号
  339.     filename = SaveSettings.save_file_dir + "Save#{@command_window.index+1}.rxdata"
  340.     # 演奏存档 SE
  341.     $game_system.se_play($data_system.save_se)
  342.     # 写入存档数据
  343.     file = File.open(filename, "wb")
  344.     write_save_data(file)
  345.     file.close
  346.     # 如果被事件调用
  347.     if $game_temp.save_calling
  348.       # 清除存档调用标志
  349.       $game_temp.save_calling = false
  350.       # 切换到地图画面
  351.       $scene = Scene_Map.new
  352.       return
  353.     end
  354.     # 切换到菜单画面
  355.     $scene = Scene_Menu.new(4)
  356.   end
  357.   #---------------------------------------------------------------------------#
  358.   # 存档                                                                      #
  359.   #---------------------------------------------------------------------------#
  360.   def write_save_data(file)
  361.     # 生成描绘存档文件用的角色图形
  362.     characters = []
  363.     for i in 0...$game_party.actors.size
  364.       actor = $game_party.actors[i]
  365.       characters.push([actor.character_name, actor.character_hue])
  366.     end
  367.     # 写入描绘存档文件用的角色数据
  368.     Marshal.dump(characters, file)
  369.     # 写入测量游戏时间用画面计数
  370.     Marshal.dump(Graphics.frame_count, file)
  371.     # 增加 1 次存档次数
  372.     $game_system.save_count += 1
  373.     # 保存魔法编号
  374.     # (将编辑器保存的值以随机值替换)
  375.     $game_system.magic_number = $data_system.magic_number
  376.     # 写入各种游戏对像
  377.     Marshal.dump($game_system, file)
  378.     Marshal.dump($game_switches, file)
  379.     Marshal.dump($game_variables, file)
  380.     Marshal.dump($game_self_switches, file)
  381.     Marshal.dump($game_screen, file)
  382.     Marshal.dump($game_actors, file)
  383.     Marshal.dump($game_party, file)
  384.     Marshal.dump($game_troop, file)
  385.     Marshal.dump($game_map, file)
  386.     Marshal.dump($game_player, file)
  387.   end
  388.   #---------------------------------------------------------------------------#
  389.   # 读档                                                                      #
  390.   #---------------------------------------------------------------------------#
  391.   def read_save_data(file)
  392.     # 读取描绘存档文件用的角色数据
  393.     characters = Marshal.load(file)
  394.     # 读取测量游戏时间用画面计数
  395.     Graphics.frame_count = Marshal.load(file)
  396.     # 读取各种游戏对像
  397.     $game_system        = Marshal.load(file)
  398.     $game_switches      = Marshal.load(file)
  399.     $game_variables     = Marshal.load(file)
  400.     $game_self_switches = Marshal.load(file)
  401.     $game_screen        = Marshal.load(file)
  402.     $game_actors        = Marshal.load(file)
  403.     $game_party         = Marshal.load(file)
  404.     $game_troop         = Marshal.load(file)
  405.     $game_map           = Marshal.load(file)
  406.     $game_player        = Marshal.load(file)
  407.     # 魔法编号与保存时有差异的情况下
  408.     # (加入编辑器的编辑过的数据)
  409.     if $game_system.magic_number != $data_system.magic_number
  410.       # 重新装载地图
  411.       $game_map.setup($game_map.map_id)
  412.       $game_player.center($game_player.x, $game_player.y)
  413.     end
  414.     # 刷新同伴成员
  415.     $game_party.refresh
  416.   end
  417. end

  418. #-----------------------------------------------------------------------------#
  419. # Graphics.snap_to_bitmap(优化版)                                           #
  420. # 作者:神思                                                                  #
  421. # 优化:釣到一隻猴子@_@  (  AAM@_@  )                                         #
  422. #-----------------------------------------------------------------------------#
  423. #-----------------------------------------------------------------------------#
  424. # Graphics                                                                    #
  425. #-----------------------------------------------------------------------------#
  426. class << Graphics
  427.   SRCCOPY = 0xCC0020
  428.   BitBlt = Win32API.new("gdi32", "BitBlt", "lllllllll", "l")
  429.   CreateCompatibleBitmap = Win32API.new("gdi32", "CreateCompatibleBitmap", "lll", "l")
  430.   CreateCompatibleDC = Win32API.new("gdi32", "CreateCompatibleDC", "l", "l")
  431.   DeleteDC = Win32API.new("gdi32", "DeleteDC", "l", "l")
  432.   DeleteObject = Win32API.new("gdi32", "DeleteObject", "l", "l")
  433.   SelectObject = Win32API.new("gdi32", "SelectObject", "ll", "l")
  434.   GetBitmapBits = Win32API.new("gdi32", "GetBitmapBits", "llp", "l")

  435.   GetWindowDC = Win32API.new("user32", "GetWindowDC", "l", "l")
  436.   ReleaseDC = Win32API.new("user32", "ReleaseDC", "ll", "l")
  437.   GetWindowRect = Win32API.new("user32", "GetWindowRect", "lp", "l")
  438.   GetClientRect = Win32API.new("user32", "GetClientRect", "lp", "l")
  439.   ClientToScreen = Win32API.new("user32", "ClientToScreen", "ip", "i")

  440.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  441.   HWnd = Win32API.new("user32", "GetActiveWindow", nil, 'l').call
  442.   #---------------------------------------------------------------------------#
  443.   # snap_to_bitmap                                                            #
  444.   #---------------------------------------------------------------------------#
  445.   def snap_to_bitmap
  446.     width, height, rgbs = self.bitmap_data
  447.     hb = Bitmap.new(width, height)
  448.     len = width * 4
  449.     ptr = [rgbs].pack("p").unpack("l")[0]
  450.     ptrs = []
  451.     height.times{|i| ptrs[height -1 -i] = ptr + (len * i)}
  452.     pdest = hb.address
  453.     height.times do |y|
  454.       RtlMoveMemory.call(pdest, ptrs[y], len)
  455.       pdest += len
  456.     end
  457.     return hb
  458.   end
  459.   #---------------------------------------------------------------------------#
  460.   # bitmap_data                                                               #
  461.   #---------------------------------------------------------------------------#
  462.   def bitmap_data
  463.     hdcSrc = GetWindowDC.call(HWnd)
  464.     wrect = [0,0,0,0].pack("l*")
  465.     crect = wrect.clone
  466.     point = [0, 0].pack("l*")
  467.     GetWindowRect.call(HWnd, wrect)
  468.     GetClientRect.call(HWnd, crect)
  469.     ClientToScreen.call(HWnd, point)
  470.     wrect = wrect.unpack("l*")
  471.     crect = crect.unpack("l*")
  472.     point = point.unpack("l*")
  473.     wrect[0] -= point[0]
  474.     wrect[1] -= point[1]
  475.     hdcDest = CreateCompatibleDC.call(hdcSrc)
  476.     hBitmap = CreateCompatibleBitmap.call(hdcSrc, crect[2], crect[3])
  477.     hOld = SelectObject.call(hdcDest, hBitmap)
  478.     BitBlt.call(hdcDest, wrect[0], wrect[1], crect[2] - wrect[0], crect[3] - wrect[1], hdcSrc, 0, 0, SRCCOPY)
  479.     SelectObject.call(hdcDest, hOld)
  480.     DeleteDC.call(hdcDest)
  481.     ReleaseDC.call(HWnd, hdcSrc)
  482.     dwCount = crect[2] * crect[3]
  483.     lpBits = ([0] * dwCount).pack("l*")
  484.     GetBitmapBits.call(hBitmap, dwCount * 4, lpBits)
  485.     DeleteObject.call(hBitmap)
  486.     return crect[2], crect[3], lpBits
  487.   end
  488. end

  489. #-----------------------------------------------------------------------------#
  490. # Font                                                                        #
  491. #-----------------------------------------------------------------------------#
  492. class Font
  493.   #---------------------------------------------------------------------------#
  494.   # marshal_dump                                                              #
  495.   #---------------------------------------------------------------------------#
  496.   def marshal_dump
  497.   end
  498.   #---------------------------------------------------------------------------#
  499.   # marshal_load                                                              #
  500.   #---------------------------------------------------------------------------#
  501.   def marshal_load(obj)
  502.   end
  503. end

  504. #-----------------------------------------------------------------------------#
  505. # Bitmap                                                                      #
  506. #-----------------------------------------------------------------------------#
  507. class Bitmap
  508.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  509.   # 传送到内存的API函数
  510.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  511.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  512.   #---------------------------------------------------------------------------#
  513.   # _dump                                                                     #
  514.   #---------------------------------------------------------------------------#
  515.   def _dump(limit)
  516.     data = "rgba" * width * height
  517.     RtlMoveMemory_pi.call(data, address, data.length)
  518.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  519.   end
  520.   #---------------------------------------------------------------------------#
  521.   # _load                                                                     #
  522.   #---------------------------------------------------------------------------#
  523.   def self._load(str)
  524.     w, h, zdata = str.unpack("LLa*")
  525.     b = self.new(w, h)
  526.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  527.     return b
  528.   end
  529.   #---------------------------------------------------------------------------#
  530.   # address                                                                   #
  531.   #---------------------------------------------------------------------------#
  532.   def address
  533.     # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  534.     buffer, ad = "xxxx", object_id * 2 + 16
  535.     RtlMoveMemory.call(buffer, ad, 4)
  536.     ad = buffer.unpack("L")[0] + 8
  537.     RtlMoveMemory.call(buffer, ad, 4)
  538.     ad = buffer.unpack("L")[0] + 16
  539.     RtlMoveMemory.call(buffer, ad, 4)
  540.     return buffer.unpack("L")[0]
  541.   end
  542. end
复制代码
梦石
0
星屑
463
在线时间
193 小时
注册时间
2014-8-25
回帖
30
发表于 2016-10-19 19:30:36 | 显示全部楼层
为什么不用有DLL的截图存取档?里面就是自动定位到最新存档。而且也很好用
黄海有狂人,欲与日月争,还我三万六千晨
回复

使用道具 举报

梦石
0
星屑
218
在线时间
356 小时
注册时间
2011-3-8
回帖
43
 楼主| 发表于 2016-10-20 18:39:52 | 显示全部楼层
孤云黑月 发表于 2016-10-19 19:30
为什么不用有DLL的截图存取档?里面就是自动定位到最新存档。而且也很好用
...

那个冲突了不截图,之前提问后用的免DLL版
回复

使用道具 举报

梦石
0
星屑
251
在线时间
252 小时
注册时间
2013-11-9
回帖
88
发表于 2016-10-26 23:04:09 | 显示全部楼层
本帖最后由 泪的苍白 于 2016-10-26 23:08 编辑

将
  1.   def initialize(type=0)
  2.     @type = type == 0 ? "save" : "load"
  3.     case @type
  4.     when "save"
  5.       @word = SaveSettings.save_help
  6.     when "load"
  7.       @word = SaveSettings.load_help
  8.       $game_temp = Game_Temp.new
  9.     end
  10.   end
复制代码
替换为:
  1.         def initialize(type = 0)
  2.                 @type = type == 0 ? "save" : "load"
  3.                 case @type
  4.                 when "save"
  5.                         @word = SaveSettings.save_help
  6.                         $game_temp = Game_Temp.new
  7.                         #选择存档时间最长的存档
  8.                         $game_temp.last_file_index = 0
  9.                         latest_time = Time.at(0)
  10.                         for i in 1..SaveSettings.max_save_file
  11.                                 filename = SaveSettings.save_file_dir + "Save#{i + 1}.rxdata"
  12.                                 if FileTest.exist?(filename)
  13.                                         file = File.open(filename, "r")
  14.                                         if file.mtime > latest_time
  15.                                                 latest_time = file.mtime
  16.                                                 $game_temp.last_file_index = i
  17.                                         end
  18.                                         file.close
  19.                                 end
  20.                         end
  21.                 when "load"
  22.                         @word = SaveSettings.load_help
  23.                         $game_temp = Game_Temp.new
  24.                         #选择存档时间最长的存档
  25.                         $game_temp.last_file_index = 0
  26.                         latest_time = Time.at(0)
  27.                         for i in 1..SaveSettings.max_save_file
  28.                                 filename = SaveSettings.save_file_dir + "Save#{i + 1}.rxdata"
  29.                                 if FileTest.exist?(filename)
  30.                                         file = File.open(filename, "r")
  31.                                         if file.mtime > latest_time
  32.                                                 latest_time = file.mtime
  33.                                                 $game_temp.last_file_index = i
  34.                                         end
  35.                                         file.close
  36.                                 end
  37.                         end
  38.                 end
  39.         end
复制代码

原205行现238行,在
  1.     @command_window = Window_Command.new(160,choose)
复制代码
下面添加一句:
  1.     @command_window.index = $game_temp.last_file_index
复制代码

应该是可行的。
为什么脚本的格式看起来那么奇怪啊OTL还改不了……

评分

参与人数 1星屑 +20 收起 理由
daosi + 20 囧已过期,仅能送上个人的微薄谢意.

查看全部评分

头像来自百度搜索,自改了一(小)部分。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部