设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2580|回复: 3
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
218
在线时间
356 小时
注册时间
2011-3-8
帖子
66
跳转到指定楼层
1
发表于 2016-10-19 19:02:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

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

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

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

RUBY 代码复制
  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. #-----------------------------------------------------------------------------#
  36. Dir.mkdir(SaveSettings.save_file_dir) unless FileTest.directory?(SaveSettings.save_file_dir)
  37.  
  38. #-----------------------------------------------------------------------------#
  39. # 游戏核心处理类                                                              #
  40. #-----------------------------------------------------------------------------#
  41. class Game_System
  42.   #---------------------------------------------------------------------------#
  43.   # 实例变量                                                                  #
  44.   #---------------------------------------------------------------------------#
  45.   attr_accessor :snap_bitmap
  46. end
  47.  
  48. #-----------------------------------------------------------------------------#
  49. # 强改存档界面                                                                #
  50. #-----------------------------------------------------------------------------#
  51. class Scene_Save
  52.   def self.new(*a)
  53.     return Scene_Save_Load.new
  54.   end
  55. end
  56.  
  57. #-----------------------------------------------------------------------------#
  58. # 强改读档界面                                                                #
  59. #-----------------------------------------------------------------------------#
  60. class Scene_Load
  61.   def self.new(*a)
  62.     return Scene_Save_Load.new(1)
  63.   end
  64. end
  65.  
  66. #-----------------------------------------------------------------------------#
  67. # 地图界面钩子                                                                #
  68. #-----------------------------------------------------------------------------#
  69. Scene_Map = Class.new(Scene_Map) {
  70.   superclass.constants.each{|c|const_set(c, superclass.const_get(c))}
  71.   const_set(:NoDllSLHook, true)
  72.   define_method(:main) do
  73.     super
  74.     $game_system.snap_bitmap = Graphics.snap_to_bitmap if $scene.is_a?(Scene_Menu)
  75.   end
  76. } unless Scene_Map.const_defined?(:NoDllSLHook)
  77.  
  78. #-----------------------------------------------------------------------------#
  79. # 移花接木大法======这段删掉了,会出错                            #
  80. #-----------------------------------------------------------------------------#
  81.  
  82. #-----------------------------------------------------------------------------#
  83. # 存档界面用窗口                                                              #
  84. #-----------------------------------------------------------------------------#
  85. class Window_Save < Window_Base
  86.   #---------------------------------------------------------------------------#
  87.   # 初始化                                                                    #
  88.   #---------------------------------------------------------------------------#
  89.   def initialize
  90.     super(160,64,480,416)
  91.     self.contents = Bitmap.new(width-32,height-32)
  92.     @_index = -1
  93.     refresh(0)
  94.   end
  95.   #---------------------------------------------------------------------------#
  96.   # 刷新                                                                      #
  97.   #---------------------------------------------------------------------------#
  98.   def refresh(index)
  99.     if index != @_index
  100.       # 清除原有资料
  101.       self.contents.clear
  102.       @sprite.dispose if @sprite != nil
  103.       @sprite = nil
  104.       # 开始读取资料
  105.       @file_index = index
  106.       @filename = SaveSettings.save_file_dir + "Save#{@file_index + 1}.rxdata"
  107.       @time_stamp = Time.at(0)
  108.       @file_exist = FileTest.exist?(@filename)
  109.       if @file_exist
  110.         file = File.open(@filename, "r")
  111.         @time_stamp         = file.mtime
  112.         @characters         = Marshal.load(file)
  113.         @frame_count        = Marshal.load(file)
  114.         @game_system        = Marshal.load(file)
  115.         @game_switches      = Marshal.load(file)
  116.         @game_variables     = Marshal.load(file)
  117.         @game_self_switches = Marshal.load(file)
  118.         @game_screen        = Marshal.load(file)
  119.         @game_actors        = Marshal.load(file)
  120.         @game_party         = Marshal.load(file)
  121.         @game_troop         = Marshal.load(file)
  122.         @game_map           = Marshal.load(file)
  123.         [url=home.php?mod=space&uid=14736]@game_player[/url]        = Marshal.load(file)
  124.         @bitmap             = @game_system.snap_bitmap
  125.         @total_sec = @frame_count / Graphics.frame_rate
  126.         file.close
  127.         # 描绘截图的框与影子
  128.         self.contents.fill_rect(34,11,400,300,Color.new(0,0,0))
  129.         self.contents.fill_rect(23,0,402,302,system_color)
  130.         self.contents.fill_rect(24,1,400,300,Color.new(0,0,0,0))
  131.         # 如截图不为空的话
  132.         if @bitmap != nil
  133.           # 描绘截图
  134.           @sprite = Sprite.new
  135.           @sprite.bitmap = @bitmap
  136.           @sprite.x = 160+16+24
  137.           @sprite.y = 64+16+1
  138.           @sprite.zoom_x = @sprite.zoom_y = 0.625
  139.           @sprite.z = 99999
  140.         else
  141.           self.contents.draw_text(0,96,448,32,SaveSettings.snap_no_found,1)
  142.         end
  143.         # 描绘角色
  144.         @characters.size.times do |i|
  145.           x = i*56 + 24
  146.           bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  147.           self.contents.blt(x,328,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4))
  148.         end
  149.         # 描绘游戏时间
  150.         hour = @total_sec / 60 / 60
  151.         min = @total_sec / 60 % 60
  152.         sec = @total_sec % 60
  153.         time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  154.         self.contents.font.color = normal_color
  155.         self.contents.draw_text(0,320,448,32,time_string,2)
  156.         # 描绘时间标记
  157.         self.contents.font.color = normal_color
  158.         time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  159.         self.contents.draw_text(0,352,448,32,time_string, 2)
  160.       else
  161.         self.contents.draw_text(0,320,448,32,SaveSettings.no_save_file,1)
  162.       end
  163.       @_index = index
  164.     end
  165.   end
  166.   #---------------------------------------------------------------------------#
  167.   # 释放                                                                      #
  168.   #---------------------------------------------------------------------------#
  169.   def dispose
  170.     super
  171.     @sprite.dispose if @sprite != nil
  172.     @sprite = nil
  173.   end
  174. end
  175.  
  176. #-----------------------------------------------------------------------------#
  177. # 存档界面                                                                    #
  178. #-----------------------------------------------------------------------------#
  179. class Scene_Save_Load
  180.   #---------------------------------------------------------------------------#
  181.   # 初始化                                                                    #
  182.   #---------------------------------------------------------------------------#
  183.   def initialize(type=0)
  184.     @type = type == 0 ? "save" : "load"
  185.     case @type
  186.     when "save"
  187.       [url=home.php?mod=space&uid=79957]@WORD[/url] = SaveSettings.save_help
  188.     when "load"
  189.       @word = SaveSettings.load_help
  190.       $game_temp = Game_Temp.new
  191.     end
  192.   end
  193.   #---------------------------------------------------------------------------#
  194.   # 主执行                                                                    #
  195.   #---------------------------------------------------------------------------#
  196.   def main
  197.     # 生成帮助窗口
  198.     @help_window = Window_Help.new
  199.     @help_window.set_text(@word)
  200.     # 选项窗口
  201.     choose = []
  202.     for i in 1..SaveSettings.max_save_file
  203.       choose.push(SaveSettings.slot_name_format % i)
  204.     end
  205.     @command_window = Window_Command.new(160,choose)
  206.     @command_window.height = 416
  207.     @command_window.y = 64
  208.     @command_window.active = true
  209.     # 存档资料窗口
  210.     @save_window = Window_Save.new
  211.     # 确认窗口
  212.     @confirm_window = Window_Base.new(80,176,480,128)
  213.     @confirm_window.contents = Bitmap.new(448,96)
  214.     @confirm_window.contents.draw_text(0,0,448,32,SaveSettings.override_question,1)
  215.     @confirm_window.contents.draw_text(0,64,216,32,"确定",1)
  216.     @confirm_window.contents.draw_text(232,64,216,32,"取消",1)
  217.     @confirm_window.cursor_rect.set(232,64,216,32)
  218.     @confirm_window.z = 999999
  219.     @confirm_window.visible = false
  220.     @confirm_ok = false
  221.     # 执行过渡
  222.     Graphics.transition
  223.     # 主循环
  224.     loop do
  225.       # 刷新游戏画面
  226.       Graphics.update
  227.       # 刷新输入信息
  228.       Input.update
  229.       # 刷新画面
  230.       update
  231.       # 如果画面切换的话的就中断循环
  232.       if $scene != self
  233.         break
  234.       end
  235.     end
  236.     # 准备过渡
  237.     Graphics.freeze
  238.     # 释放窗口
  239.     @help_window.dispose
  240.     @save_window.dispose
  241.     @command_window.dispose
  242.     @confirm_window.dispose
  243.   end
  244.   #---------------------------------------------------------------------------#
  245.   # 刷新                                                                      #
  246.   #---------------------------------------------------------------------------#
  247.   def update
  248.     # 选择存档窗口激活
  249.     unless @confirm_window.visible
  250.       update_command
  251.     else
  252.       update_confirm
  253.     end
  254.   end
  255.   #---------------------------------------------------------------------------#
  256.   # 选择存档窗口刷新                                                          #
  257.   #---------------------------------------------------------------------------#
  258.   def update_command
  259.     @command_window.update
  260.     @save_window.refresh(@command_window.index)
  261.     # 按下取消键
  262.     if Input.trigger?(Input::B)
  263.       case @type
  264.       when "save"
  265.         # 演奏取消 SE
  266.         $game_system.se_play($data_system.cancel_se)
  267.         # 如果被事件调用
  268.         if $game_temp.save_calling
  269.           # 清除存档调用标志
  270.           $game_temp.save_calling = false
  271.           # 切换到地图画面
  272.           $scene = Scene_Map.new
  273.           return
  274.         end
  275.         # 切换到菜单画面
  276.         $scene = Scene_Menu.new(4)
  277.       when "load"
  278.         # 演奏取消 SE
  279.         $game_system.se_play($data_system.cancel_se)
  280.         # 切换到标题画面
  281.         $scene = Scene_Title.new
  282.       end
  283.     end
  284.     # 按下确定键
  285.     if Input.trigger?(Input::C)
  286.       # 计算存档编号
  287.       filename = SaveSettings.save_file_dir + "Save#{@command_window.index+1}.rxdata"
  288.       case @type
  289.       when "save"
  290.         if File.exist?(filename)
  291.           @confirm_window.visible = true
  292.           @confirm_window.cursor_rect.set(232,64,216,32)
  293.           @confirm_ok = false
  294.         else
  295.           process_save
  296.         end
  297.       when "load"
  298.         # 文件不存在的情况下
  299.         unless FileTest.exist?(filename)
  300.           # 演奏冻结 SE
  301.           $game_system.se_play($data_system.buzzer_se)
  302.           return
  303.         end
  304.         # 演奏读档 SE
  305.         $game_system.se_play($data_system.load_se)
  306.         # 写入存档数据
  307.         file = File.open(filename, "rb")
  308.         read_save_data(file)
  309.         file.close
  310.         # 还原 BGM、BGS
  311.         $game_system.bgm_play($game_system.playing_bgm)
  312.         $game_system.bgs_play($game_system.playing_bgs)
  313.         # 刷新地图 (执行并行事件)
  314.         $game_map.update
  315.         # 切换到地图画面
  316.         $scene = Scene_Map.new
  317.       end
  318.     end
  319.   end
  320.   #---------------------------------------------------------------------------#
  321.   # 确认窗口刷新                                                              #
  322.   #---------------------------------------------------------------------------#
  323.   def update_confirm
  324.     @confirm_window.update
  325.     if Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
  326.       $game_system.se_play($data_system.cursor_se)
  327.       @confirm_ok = true
  328.     elsif Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
  329.       $game_system.se_play($data_system.cursor_se)
  330.       @confirm_ok = false
  331.     elsif Input.trigger?(Input::C)
  332.       $game_system.se_play($data_system.decision_se)
  333.       process_save if @confirm_ok
  334.       @confirm_window.visible = false
  335.     elsif Input.trigger?(Input::B)
  336.       $game_system.se_play($data_system.cancel_se)
  337.       @confirm_window.visible = false
  338.     end
  339.     @confirm_window.cursor_rect.set(232,64,216,32)
  340.     @confirm_window.cursor_rect.set(0,64,216,32) if @confirm_ok
  341.   end
  342.   #---------------------------------------------------------------------------#
  343.   # 执行存档                                                                  #
  344.   #---------------------------------------------------------------------------#
  345.   def process_save
  346.     # 计算存档编号
  347.     filename = SaveSettings.save_file_dir + "Save#{@command_window.index+1}.rxdata"
  348.     # 演奏存档 SE
  349.     $game_system.se_play($data_system.save_se)
  350.     # 写入存档数据
  351.     file = File.open(filename, "wb")
  352.     write_save_data(file)
  353.     file.close
  354.     # 如果被事件调用
  355.     if $game_temp.save_calling
  356.       # 清除存档调用标志
  357.       $game_temp.save_calling = false
  358.       # 切换到地图画面
  359.       $scene = Scene_Map.new
  360.       return
  361.     end
  362.     # 切换到菜单画面
  363.     $scene = Scene_Menu.new(4)
  364.   end
  365.   #---------------------------------------------------------------------------#
  366.   # 存档                                                                      #
  367.   #---------------------------------------------------------------------------#
  368.   def write_save_data(file)
  369.     # 生成描绘存档文件用的角色图形
  370.     characters = []
  371.     for i in 0...$game_party.actors.size
  372.       actor = $game_party.actors[i]
  373.       characters.push([actor.character_name, actor.character_hue])
  374.     end
  375.     # 写入描绘存档文件用的角色数据
  376.     Marshal.dump(characters, file)
  377.     # 写入测量游戏时间用画面计数
  378.     Marshal.dump(Graphics.frame_count, file)
  379.     # 增加 1 次存档次数
  380.     $game_system.save_count += 1
  381.     # 保存魔法编号
  382.     # (将编辑器保存的值以随机值替换)
  383.     $game_system.magic_number = $data_system.magic_number
  384.     # 写入各种游戏对像
  385.     Marshal.dump($game_system, file)
  386.     Marshal.dump($game_switches, file)
  387.     Marshal.dump($game_variables, file)
  388.     Marshal.dump($game_self_switches, file)
  389.     Marshal.dump($game_screen, file)
  390.     Marshal.dump($game_actors, file)
  391.     Marshal.dump($game_party, file)
  392.     Marshal.dump($game_troop, file)
  393.     Marshal.dump($game_map, file)
  394.     Marshal.dump($game_player, file)
  395.   end
  396.   #---------------------------------------------------------------------------#
  397.   # 读档                                                                      #
  398.   #---------------------------------------------------------------------------#
  399.   def read_save_data(file)
  400.     # 读取描绘存档文件用的角色数据
  401.     characters = Marshal.load(file)
  402.     # 读取测量游戏时间用画面计数
  403.     Graphics.frame_count = Marshal.load(file)
  404.     # 读取各种游戏对像
  405.     $game_system        = Marshal.load(file)
  406.     $game_switches      = Marshal.load(file)
  407.     $game_variables     = Marshal.load(file)
  408.     $game_self_switches = Marshal.load(file)
  409.     $game_screen        = Marshal.load(file)
  410.     $game_actors        = Marshal.load(file)
  411.     $game_party         = Marshal.load(file)
  412.     $game_troop         = Marshal.load(file)
  413.     $game_map           = Marshal.load(file)
  414.     $game_player        = Marshal.load(file)
  415.     # 魔法编号与保存时有差异的情况下
  416.     # (加入编辑器的编辑过的数据)
  417.     if $game_system.magic_number != $data_system.magic_number
  418.       # 重新装载地图
  419.       $game_map.setup($game_map.map_id)
  420.       $game_player.center($game_player.x, $game_player.y)
  421.     end
  422.     # 刷新同伴成员
  423.     $game_party.refresh
  424.   end
  425. end
  426.  
  427. #-----------------------------------------------------------------------------#
  428. # Graphics.snap_to_bitmap(优化版)                                           #
  429. # 作者:神思                                                                  #
  430. # 优化:釣到一隻猴子@_@  (  AAM@_@  )                                         #
  431. #-----------------------------------------------------------------------------#
  432. #-----------------------------------------------------------------------------#
  433. # Graphics                                                                    #
  434. #-----------------------------------------------------------------------------#
  435. class << Graphics
  436.   SRCCOPY = 0xCC0020
  437.   BitBlt = Win32API.new("gdi32", "BitBlt", "lllllllll", "l")
  438.   CreateCompatibleBitmap = Win32API.new("gdi32", "CreateCompatibleBitmap", "lll", "l")
  439.   CreateCompatibleDC = Win32API.new("gdi32", "CreateCompatibleDC", "l", "l")
  440.   DeleteDC = Win32API.new("gdi32", "DeleteDC", "l", "l")
  441.   DeleteObject = Win32API.new("gdi32", "DeleteObject", "l", "l")
  442.   SelectObject = Win32API.new("gdi32", "SelectObject", "ll", "l")
  443.   GetBitmapBits = Win32API.new("gdi32", "GetBitmapBits", "llp", "l")
  444.  
  445.   GetWindowDC = Win32API.new("user32", "GetWindowDC", "l", "l")
  446.   ReleaseDC = Win32API.new("user32", "ReleaseDC", "ll", "l")
  447.   GetWindowRect = Win32API.new("user32", "GetWindowRect", "lp", "l")
  448.   GetClientRect = Win32API.new("user32", "GetClientRect", "lp", "l")
  449.   ClientToScreen = Win32API.new("user32", "ClientToScreen", "ip", "i")
  450.  
  451.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  452.   HWnd = Win32API.new("user32", "GetActiveWindow", nil, 'l').call
  453.   #---------------------------------------------------------------------------#
  454.   # snap_to_bitmap                                                            #
  455.   #---------------------------------------------------------------------------#
  456.   def snap_to_bitmap
  457.     width, height, rgbs = self.bitmap_data
  458.     hb = Bitmap.new(width, height)
  459.     len = width * 4
  460.     ptr = [rgbs].pack("p").unpack("l")[0]
  461.     ptrs = []
  462.     height.times{|i| ptrs[height -1 -i] = ptr + (len * i)}
  463.     pdest = hb.address
  464.     height.times do |y|
  465.       RtlMoveMemory.call(pdest, ptrs[y], len)
  466.       pdest += len
  467.     end
  468.     return hb
  469.   end
  470.   #---------------------------------------------------------------------------#
  471.   # bitmap_data                                                               #
  472.   #---------------------------------------------------------------------------#
  473.   def bitmap_data
  474.     hdcSrc = GetWindowDC.call(HWnd)
  475.     wrect = [0,0,0,0].pack("l*")
  476.     crect = wrect.clone
  477.     point = [0, 0].pack("l*")
  478.     GetWindowRect.call(HWnd, wrect)
  479.     GetClientRect.call(HWnd, crect)
  480.     ClientToScreen.call(HWnd, point)
  481.     wrect = wrect.unpack("l*")
  482.     crect = crect.unpack("l*")
  483.     point = point.unpack("l*")
  484.     wrect[0] -= point[0]
  485.     wrect[1] -= point[1]
  486.     hdcDest = CreateCompatibleDC.call(hdcSrc)
  487.     hBitmap = CreateCompatibleBitmap.call(hdcSrc, crect[2], crect[3])
  488.     hOld = SelectObject.call(hdcDest, hBitmap)
  489.     BitBlt.call(hdcDest, wrect[0], wrect[1], crect[2] - wrect[0], crect[3] - wrect[1], hdcSrc, 0, 0, SRCCOPY)
  490.     SelectObject.call(hdcDest, hOld)
  491.     DeleteDC.call(hdcDest)
  492.     ReleaseDC.call(HWnd, hdcSrc)
  493.     dwCount = crect[2] * crect[3]
  494.     lpBits = ([0] * dwCount).pack("l*")
  495.     GetBitmapBits.call(hBitmap, dwCount * 4, lpBits)
  496.     DeleteObject.call(hBitmap)
  497.     return crect[2], crect[3], lpBits
  498.   end
  499. end
  500.  
  501. #-----------------------------------------------------------------------------#
  502. # Font                                                                        #
  503. #-----------------------------------------------------------------------------#
  504. class Font
  505.   #---------------------------------------------------------------------------#
  506.   # marshal_dump                                                              #
  507.   #---------------------------------------------------------------------------#
  508.   def marshal_dump
  509.   end
  510.   #---------------------------------------------------------------------------#
  511.   # marshal_load                                                              #
  512.   #---------------------------------------------------------------------------#
  513.   def marshal_load(obj)
  514.   end
  515. end
  516.  
  517. #-----------------------------------------------------------------------------#
  518. # Bitmap                                                                      #
  519. #-----------------------------------------------------------------------------#
  520. class Bitmap
  521.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  522.   # 传送到内存的API函数
  523.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  524.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  525.   #---------------------------------------------------------------------------#
  526.   # _dump                                                                     #
  527.   #---------------------------------------------------------------------------#
  528.   def _dump(limit)
  529.     data = "rgba" * width * height
  530.     RtlMoveMemory_pi.call(data, address, data.length)
  531.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  532.   end
  533.   #---------------------------------------------------------------------------#
  534.   # _load                                                                     #
  535.   #---------------------------------------------------------------------------#
  536.   def self._load(str)
  537.     w, h, zdata = str.unpack("LLa*")
  538.     b = self.new(w, h)
  539.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  540.     return b
  541.   end
  542.   #---------------------------------------------------------------------------#
  543.   # address                                                                   #
  544.   #---------------------------------------------------------------------------#
  545.   def address
  546.     # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  547.     buffer, ad = "xxxx", object_id * 2 + 16
  548.     RtlMoveMemory.call(buffer, ad, 4)
  549.     ad = buffer.unpack("L")[0] + 8
  550.     RtlMoveMemory.call(buffer, ad, 4)
  551.     ad = buffer.unpack("L")[0] + 16
  552.     RtlMoveMemory.call(buffer, ad, 4)
  553.     return buffer.unpack("L")[0]
  554.   end
  555. end

Lv2.观梦者

梦石
0
星屑
463
在线时间
193 小时
注册时间
2014-8-25
帖子
30
2
发表于 2016-10-19 19:30:36 | 只看该作者
为什么不用有DLL的截图存取档?里面就是自动定位到最新存档。而且也很好用
黄海有狂人,欲与日月争,还我三万六千晨
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
251
在线时间
252 小时
注册时间
2013-11-9
帖子
97
4
发表于 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 囧已过期,仅能送上个人的微薄谢意.

查看全部评分

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 02:06

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表