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

Project1

 找回密码
 注册会员
搜索
查看: 1934|回复: 3

[有事请教] 使用截图存档加覆盖存档提示脚本,读取存档没有反应

[复制链接]

Lv2.观梦者

梦石
0
星屑
800
在线时间
166 小时
注册时间
2019-6-11
帖子
52
发表于 2019-6-22 03:35:45 | 显示全部楼层 |阅读模式

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

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

x
使用截图存档加覆盖存档提示脚本,然后测试游戏进入菜单,读取存档按确认键后没有反应。
如果没有移除这个脚本,读取存档又开始读档了。没有任何问题。
好像是说,我想要一个有读档画面的脚本,因为vx不带这个,听人家说,图书馆资料写明因为vx要删除掉一些不需要的
选项所以没有读档画面。使用截图存档可以用读档画面的样子。
vx因为存档的文件直接在工程文件下,如果复制放进save文件(s为大写)下。测试游戏读档时也没有反应啊。工程文件就是需要制作更改的游戏文件,是放在脚本说的文件夹下,而不是save文件夹。
怎么解呢?
脚本以下。
  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 = 10
  18. # 存档所在文件夹,等号后为 "Save/"
  19. SaveSettings.save_file_dir = "罗勒的剧院文件夹/"
  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. class Scene_Title
  76.   attr_accessor :command_window, :continue_enabled
  77.   class Window_Command < ::Window_Command
  78.     def disable_item(*a)
  79.       super(*a) unless $scene.any_save? or a[0] != 1
  80.     end
  81.   end
  82.   module Graphics
  83.     def self.transition(*a)
  84.       $scene.command_window.index = ($scene.continue_enabled = $scene.any_save?) ? 1 : 0
  85.       begin
  86.         ::Graphics.transition(*a)
  87.       rescue Exception
  88.         raise $!.class, $!.message, caller
  89.       end
  90.     end
  91.     def self.method_missing(m, *args, &block)
  92.       begin
  93.         ::Graphics.send(m, *args, &block)
  94.       rescue Exception
  95.         raise $!.class, $!.message, caller
  96.       end
  97.     end
  98.   end
  99.   def any_save?
  100.     for i in 1..SaveSettings.max_save_file
  101.       return true if File.exist?(SaveSettings.save_file_dir + "Save#{i}.rxdata")
  102.     end
  103.     return false
  104.   end
  105. end

  106. #-----------------------------------------------------------------------------#
  107. # 存档界面用窗口                                                              #
  108. #-----------------------------------------------------------------------------#
  109. class Window_Save < Window_Base
  110.   #---------------------------------------------------------------------------#
  111.   # 初始化                                                                    #
  112.   #---------------------------------------------------------------------------#
  113.   def initialize
  114.     super(160,64,480,416)
  115.     self.contents = Bitmap.new(width-32,height-32)
  116.     @_index = -1
  117.     refresh(0)
  118.   end
  119.   #---------------------------------------------------------------------------#
  120.   # 刷新                                                                      #
  121.   #---------------------------------------------------------------------------#
  122.   def refresh(index)
  123.     if index != @_index
  124.       # 清除原有资料
  125.       self.contents.clear
  126.       @sprite.dispose if @sprite != nil
  127.       @sprite = nil
  128.       # 开始读取资料
  129.       @file_index = index
  130.       @filename = SaveSettings.save_file_dir + "Save#{@file_index + 1}.rxdata"
  131.       @time_stamp = Time.at(0)
  132.       @file_exist = FileTest.exist?(@filename)
  133.       if @file_exist
  134.         file = File.open(@filename, "r")
  135.         @time_stamp         = file.mtime
  136.         @characters         = Marshal.load(file)
  137.         @frame_count        = Marshal.load(file)
  138.         @game_system        = Marshal.load(file)
  139.         @game_switches      = Marshal.load(file)
  140.         @game_variables     = Marshal.load(file)
  141.         @game_self_switches = Marshal.load(file)
  142.         @game_screen        = Marshal.load(file)
  143.         @game_actors        = Marshal.load(file)
  144.         @game_party         = Marshal.load(file)
  145.         @game_troop         = Marshal.load(file)
  146.         @game_map           = Marshal.load(file)
  147.         @game_player        = Marshal.load(file)
  148.         @bitmap             = @game_system.snap_bitmap
  149.         @total_sec = @frame_count / Graphics.frame_rate
  150.         file.close
  151.         # 描绘截图的框与影子
  152.         self.contents.fill_rect(34,11,400,300,Color.new(0,0,0))
  153.         self.contents.fill_rect(23,0,402,302,system_color)
  154.         self.contents.fill_rect(24,1,400,300,Color.new(0,0,0,0))
  155.         # 如截图不为空的话
  156.         if @bitmap != nil
  157.           # 描绘截图
  158.           @sprite = Sprite.new
  159.           @sprite.bitmap = @bitmap
  160.           @sprite.x = 160+16+24
  161.           @sprite.y = 64+16+1
  162.           @sprite.zoom_x = @sprite.zoom_y = 0.625
  163.           @sprite.z = 99999
  164.         else
  165.           self.contents.draw_text(0,96,448,32,SaveSettings.snap_no_found,1)
  166.         end
  167.         # 描绘角色
  168.         @characters.size.times do |i|
  169.           x = i*56 + 24
  170.           bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  171.           self.contents.blt(x,328,bitmap,Rect.new(0,0,bitmap.width/4,bitmap.height/4))
  172.         end
  173.         # 描绘游戏时间
  174.         hour = @total_sec / 60 / 60
  175.         min = @total_sec / 60 % 60
  176.         sec = @total_sec % 60
  177.         time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  178.         self.contents.font.color = normal_color
  179.         self.contents.draw_text(0,320,448,32,time_string,2)
  180.         # 描绘时间标记
  181.         self.contents.font.color = normal_color
  182.         time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  183.         self.contents.draw_text(0,352,448,32,time_string, 2)
  184.       else
  185.         self.contents.draw_text(0,320,448,32,SaveSettings.no_save_file,1)
  186.       end
  187.       @_index = index
  188.     end
  189.   end
  190.   #---------------------------------------------------------------------------#
  191.   # 释放                                                                      #
  192.   #---------------------------------------------------------------------------#
  193.   def dispose
  194.     super
  195.     @sprite.dispose if @sprite != nil
  196.     @sprite = nil
  197.   end
  198. end

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

  449. #-----------------------------------------------------------------------------#
  450. # Graphics.snap_to_bitmap(优化版)                                           #
  451. # 作者:神思                                                                  #
  452. # 优化:釣到一隻猴子@_@  (  AAM@_@  )                                         #
  453. #-----------------------------------------------------------------------------#
  454. #-----------------------------------------------------------------------------#
  455. # Graphics                                                                    #
  456. #-----------------------------------------------------------------------------#
  457. class << Graphics
  458.   SRCCOPY = 0xCC0020
  459.   BitBlt = Win32API.new("gdi32", "BitBlt", "lllllllll", "l")
  460.   CreateCompatibleBitmap = Win32API.new("gdi32", "CreateCompatibleBitmap", "lll", "l")
  461.   CreateCompatibleDC = Win32API.new("gdi32", "CreateCompatibleDC", "l", "l")
  462.   DeleteDC = Win32API.new("gdi32", "DeleteDC", "l", "l")
  463.   DeleteObject = Win32API.new("gdi32", "DeleteObject", "l", "l")
  464.   SelectObject = Win32API.new("gdi32", "SelectObject", "ll", "l")
  465.   GetBitmapBits = Win32API.new("gdi32", "GetBitmapBits", "llp", "l")

  466.   GetWindowDC = Win32API.new("user32", "GetWindowDC", "l", "l")
  467.   ReleaseDC = Win32API.new("user32", "ReleaseDC", "ll", "l")
  468.   GetWindowRect = Win32API.new("user32", "GetWindowRect", "lp", "l")
  469.   GetClientRect = Win32API.new("user32", "GetClientRect", "lp", "l")
  470.   ClientToScreen = Win32API.new("user32", "ClientToScreen", "ip", "i")

  471.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  472.   HWnd = Win32API.new("user32", "GetActiveWindow", nil, 'l').call
  473.   #---------------------------------------------------------------------------#
  474.   # snap_to_bitmap                                                            #
  475.   #---------------------------------------------------------------------------#
  476.   def snap_to_bitmap
  477.     width, height, rgbs = self.bitmap_data
  478.     hb = Bitmap.new(width, height)
  479.     len = width * 4
  480.     ptr = [rgbs].pack("p").unpack("l")[0]
  481.     ptrs = []
  482.     height.times{|i| ptrs[height -1 -i] = ptr + (len * i)}
  483.     pdest = hb.address
  484.     height.times do |y|
  485.       RtlMoveMemory.call(pdest, ptrs[y], len)
  486.       pdest += len
  487.     end
  488.     return hb
  489.   end
  490.   #---------------------------------------------------------------------------#
  491.   # bitmap_data                                                               #
  492.   #---------------------------------------------------------------------------#
  493.   def bitmap_data
  494.     hdcSrc = GetWindowDC.call(HWnd)
  495.     wrect = [0,0,0,0].pack("l*")
  496.     crect = wrect.clone
  497.     point = [0, 0].pack("l*")
  498.     GetWindowRect.call(HWnd, wrect)
  499.     GetClientRect.call(HWnd, crect)
  500.     ClientToScreen.call(HWnd, point)
  501.     wrect = wrect.unpack("l*")
  502.     crect = crect.unpack("l*")
  503.     point = point.unpack("l*")
  504.     wrect[0] -= point[0]
  505.     wrect[1] -= point[1]
  506.     hdcDest = CreateCompatibleDC.call(hdcSrc)
  507.     hBitmap = CreateCompatibleBitmap.call(hdcSrc, crect[2], crect[3])
  508.     hOld = SelectObject.call(hdcDest, hBitmap)
  509.     BitBlt.call(hdcDest, wrect[0], wrect[1], crect[2] - wrect[0], crect[3] - wrect[1], hdcSrc, 0, 0, SRCCOPY)
  510.     SelectObject.call(hdcDest, hOld)
  511.     DeleteDC.call(hdcDest)
  512.     ReleaseDC.call(HWnd, hdcSrc)
  513.     dwCount = crect[2] * crect[3]
  514.     lpBits = ([0] * dwCount).pack("l*")
  515.     GetBitmapBits.call(hBitmap, dwCount * 4, lpBits)
  516.     DeleteObject.call(hBitmap)
  517.     return crect[2], crect[3], lpBits
  518.   end
  519. end

  520. #-----------------------------------------------------------------------------#
  521. # Font                                                                        #
  522. #-----------------------------------------------------------------------------#
  523. class Font
  524.   #---------------------------------------------------------------------------#
  525.   # marshal_dump                                                              #
  526.   #---------------------------------------------------------------------------#
  527.   def marshal_dump
  528.   end
  529.   #---------------------------------------------------------------------------#
  530.   # marshal_load                                                              #
  531.   #---------------------------------------------------------------------------#
  532.   def marshal_load(obj)
  533.   end
  534. end

  535. #-----------------------------------------------------------------------------#
  536. # Bitmap                                                                      #
  537. #-----------------------------------------------------------------------------#
  538. class Bitmap
  539.   RtlMoveMemory = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  540.   # 传送到内存的API函数
  541.   RtlMoveMemory_pi = Win32API.new('kernel32', 'RtlMoveMemory', 'pii', 'i')
  542.   RtlMoveMemory_ip = Win32API.new('kernel32', 'RtlMoveMemory', 'ipi', 'i')
  543.   #---------------------------------------------------------------------------#
  544.   # _dump                                                                     #
  545.   #---------------------------------------------------------------------------#
  546.   def _dump(limit)
  547.     data = "rgba" * width * height
  548.     RtlMoveMemory_pi.call(data, address, data.length)
  549.     [width, height, Zlib::Deflate.deflate(data)].pack("LLa*") # 压缩
  550.   end
  551.   #---------------------------------------------------------------------------#
  552.   # _load                                                                     #
  553.   #---------------------------------------------------------------------------#
  554.   def self._load(str)
  555.     w, h, zdata = str.unpack("LLa*")
  556.     b = self.new(w, h)
  557.     RtlMoveMemory_ip.call(b.address, Zlib::Inflate.inflate(zdata), w * h * 4)
  558.     return b
  559.   end
  560.   #---------------------------------------------------------------------------#
  561.   # address                                                                   #
  562.   #---------------------------------------------------------------------------#
  563.   def address
  564.     # [[[bitmap.object_id * 2 + 16] + 8] + 16] == 数据的开头
  565.     buffer, ad = "xxxx", object_id * 2 + 16
  566.     RtlMoveMemory.call(buffer, ad, 4)
  567.     ad = buffer.unpack("L")[0] + 8
  568.     RtlMoveMemory.call(buffer, ad, 4)
  569.     ad = buffer.unpack("L")[0] + 16
  570.     RtlMoveMemory.call(buffer, ad, 4)
  571.     return buffer.unpack("L")[0]
  572.   end
  573. end
复制代码

Lv4.逐梦者

梦石
0
星屑
9617
在线时间
566 小时
注册时间
2017-9-28
帖子
208
发表于 2019-6-22 07:38:15 | 显示全部楼层
本帖最后由 hyrious 于 2019-6-22 07:40 编辑

首先它是一个 XP 的脚本,这里是 VX 区……
其次存档文件夹用中文可能会有潜在问题,建议还是用 Save 这种名字
Snipaste_2019-06-22_07-40-36.png

点评

算了,还是不用截图存档了~此问题作废吧~  发表于 2019-6-22 15:26

评分

参与人数 1+1 收起 理由
丝月 + 1 我很赞同

查看全部评分

喵喵喵
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
800
在线时间
166 小时
注册时间
2019-6-11
帖子
52
 楼主| 发表于 2019-6-22 15:53:57 | 显示全部楼层
hyrious 发表于 2019-6-22 07:38
首先它是一个 XP 的脚本,这里是 VX 区……
其次存档文件夹用中文可能会有潜在问题,建议还是用 Save 这种 ...

而且,在别处这个问题已经解决了。~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-18 14:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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