Project1

标题: 不需要了 [打印本页]

作者: z2z4    时间: 2012-12-25 13:49
标题: 不需要了
本帖最后由 z2z4 于 2012-12-25 14:42 编辑

111111111111
作者: z2z4    时间: 2012-12-25 14:28
这 脚本的 窗口 如何改宽  太小了
作者: c248611    时间: 2012-12-26 18:00
不知怎么的,我想叫斑竹帮你收尸@迷糊的安安 @Mic_洛洛

这 脚本的 窗口 如何改宽  太小了

另外加上 (屏幕分辨率) :
lz任意选择1个吧。

RUBY 代码复制
  1. #==============================================================================
  2. # ■ 屏幕分辨率
  3. #------------------------------------------------------------------------------
  4. #    适用于:RPG Maker VX Ace
  5. #    说明:把脚本放在Main的前面。扩展到640*480。
  6. #==============================================================================
  7.  
  8. Graphics.resize_screen(640,480)


RUBY 代码复制
  1. #==============================================================================
  2. # ■ 屏幕分辨率
  3. #------------------------------------------------------------------------------
  4. #    适用于:RPG Maker VX Ace
  5. #    说明:把脚本放在Main的前面。直接扩大屏幕,但还是544*416。
  6. #==============================================================================
  7.  
  8. 宽度=800
  9. 高度=600
  10. 游戏ini名=".\\Game.ini"
  11. #============================================================================
  12. val = "\0"*256
  13. gps = Win32API.new('kernel32', 'GetPrivateProfileString',%w(p p p p l p), 'l')
  14. gps.call("Game", "Title", "", val, 256, 游戏ini名)
  15. val.delete!("\0")
  16. title = val
  17. fw = Win32API.new('user32', 'FindWindow', %(p, p), 'i')
  18. hWnd = fw.call("RGSS Player", title)
  19. swp = Win32API.new('user32', 'SetWindowPos', %(l, l, i, i, i, i, i), 'i')
  20. ok = swp.call(hWnd, 0, 0, 0, 宽度, 高度, 2)


RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ 屏幕分辨率
  4. #------------------------------------------------------------------------------
  5. #    适用于:RPG Maker VX Ace
  6. #    说明:把脚本放在Main的前面。扩大到800*600。原脚本:ACE分辨率内存补丁
  7. #==============================================================================
  8.  
  9. #==============================================================================
  10. # ■ String
  11. #------------------------------------------------------------------------------
  12. #  String 类追加定义。
  13. #==============================================================================
  14.  
  15. class String
  16.   #----------------------------------------------------------------------------
  17.   # ● API
  18.   #----------------------------------------------------------------------------
  19.   @@MultiByteToWideChar  = Win32API.new('kernel32', 'MultiByteToWideChar', 'ilpipi', 'i')
  20.   @@WideCharToMultiByte  = Win32API.new('kernel32', 'WideCharToMultiByte', 'ilpipipp', 'i')
  21.   #----------------------------------------------------------------------------
  22.   # ● UTF-8 转 Unicode
  23.   #----------------------------------------------------------------------------
  24.   def u2w
  25.     i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
  26.     buffer = "\0" * (i*2)
  27.     @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
  28.     buffer.chop!
  29.     return buffer
  30.   end  
  31.   #----------------------------------------------------------------------------
  32.   # ● UTF-8 转系统编码
  33.   #----------------------------------------------------------------------------
  34.   def u2s
  35.     i = @@MultiByteToWideChar.call(65001, 0 , self, -1, nil,0)
  36.     buffer = "\0" * (i*2)
  37.     @@MultiByteToWideChar.call(65001, 0 , self, -1, buffer, i)
  38.     i = @@WideCharToMultiByte.call(0, 0, buffer, -1, nil, 0, nil, nil)
  39.     result = "\0" * i
  40.     @@WideCharToMultiByte.call(0, 0, buffer, -1, result, i, nil, nil)
  41.     result.chop!
  42.     return result
  43.   end
  44.   #----------------------------------------------------------------------------
  45.   # ● 系统编码转 UTF-8
  46.   #----------------------------------------------------------------------------
  47.   def s2u
  48.     i = @@MultiByteToWideChar.call(0, 0, self, -1, nil, 0)
  49.     buffer = "\0" * (i*2)
  50.     @@MultiByteToWideChar.call(0, 0, self, -1, buffer, buffer.size / 2)
  51.     i = @@WideCharToMultiByte.call(65001, 0, buffer, -1, nil, 0, nil, nil)
  52.     result = "\0" * i
  53.     @@WideCharToMultiByte.call(65001, 0, buffer, -1, result, result.size, nil, nil)
  54.     result.chop!
  55.     return result
  56.   end
  57. end
  58.  
  59. #==============================================================================
  60. # ■ AceResolutionMemoryPatch
  61. #------------------------------------------------------------------------------
  62. #  用于调整RMACE分辨率的内存补丁脚本,免修改DLL。
  63. #==============================================================================
  64. module AceResolutionMemoryPatch
  65.  
  66.   GetModuleFileName       = Win32API.new("kernel32", "GetModuleFileName", "lpl", "l")
  67.   GetPrivateProfileString = Win32API.new("kernel32", "GetPrivateProfileString", "pppplp", "l")
  68.   GetModuleHandle         = Win32API.new("kernel32", "GetModuleHandle", "p", "l")
  69.   RtlMoveMemory           = Win32API.new("kernel32", "RtlMoveMemory", "pli", "v")
  70.   RtlMoveMemoryLP         = Win32API.new("kernel32", "RtlMoveMemory", "lpi", "v")
  71.   VirtualProtect          = Win32API.new("kernel32", "VirtualProtect", "lllp", "i")
  72.   FindWindow              = Win32API.new("user32", "FindWindow", "pp", "l")
  73.  
  74.   module_function
  75.  
  76.   def patch(width = 800, height = 600)
  77.     # 获取句柄
  78.     path = 0.chr * 256
  79.     return false if 0 == GetModuleFileName.call(0, path, path.size)
  80.     path = path.s2u.gsub!(/.exe/ ,".ini").u2s
  81.     buff = 0.chr * 256
  82.     return false if 0 == GetPrivateProfileString.call("Game", "Library", nil, buff, buff.size, path)
  83.     buff.delete!("\0")
  84.     rgsshandle = GetModuleHandle.call(buff)
  85.     # 获取标题名和脚本名字
  86.     title = 0.chr * 256
  87.     return false if 0 == GetPrivateProfileString.call("Game", "Title", nil, title, title.size, path)
  88.     title = title.s2u.delete("\0").u2s
  89.     scripts = 0.chr * 256
  90.     return false if 0 == GetPrivateProfileString.call("Game", "Scripts", nil, scripts, scripts.size, path)
  91.     scripts = scripts.s2u.delete("\0").u2w
  92.     # 地址表
  93.     addr =
  94.     {
  95.       # 直接宽度替换
  96.       :w0 => [0x000016EE, 0x000020F6, 0x000020FF, 0x0010DFED, 0x0010E025, 0x0010E059, 0x0010E08D, 0x000019AA, 0x00001A5B, 0x0001C528, 0x0001F49C, 0x0010E7E7, 0x0010EFE9],
  97.       # 直接高度替换
  98.       :h0 => [0x000016E9, 0x00002106, 0x0000210F, 0x0010DFE8, 0x0010E020, 0x0010E054, 0x0010E088, 0x000019A5, 0x00001A56, 0x0001C523, 0x0001F497, 0x0010E803, 0x0010EFF9],
  99.  
  100.       # 宽度+32
  101.       :w1 => [0x000213E4],
  102.       # 高度+32
  103.       :h1 => [0x000213DF],
  104.  
  105.       # 最大宽度/32+1
  106.       :w2 => [0x00021FE1],
  107.       # 最大高度/32+1
  108.       :h2 => [0x00021F5D]
  109.     }
  110.     # 更新
  111.     w0 = [width].pack("L")
  112.     addr[:w0].each{|ofs| return false if !write_memory(rgsshandle + ofs, w0)}
  113.     h0 = [height].pack("L")
  114.     addr[:h0].each{|ofs| return false if !write_memory(rgsshandle + ofs, h0)}
  115.     w1 = [width + 32].pack("L")
  116.     addr[:w1].each{|ofs| return false if !write_memory(rgsshandle + ofs, w1)}
  117.     h1 = [height + 32].pack("L")
  118.     addr[:h1].each{|ofs| return false if !write_memory(rgsshandle + ofs, h1)}
  119.     w2 = [width / 32 + 1].pack("C")
  120.     addr[:w2].each{|ofs| return false if !write_memory(rgsshandle + ofs, w2)}
  121.     h2 = [height / 32 + 1].pack("C")
  122.     addr[:h2].each{|ofs| return false if !write_memory(rgsshandle + ofs, h2)}
  123.     # 重启
  124.     rgssgamemain = Win32API.new(buff, "RGSSGameMain", "ipp", "v")
  125.     rgssgamemain.call(FindWindow.call("RGSS Player", title), scripts, "")
  126.     # 补丁成功
  127.     return true
  128.   end
  129.  
  130.   def write_memory(addr, str)
  131.     old = 0.chr * 4
  132.     return false if 0 == VirtualProtect.call(addr, str.size, 0x40, old)
  133.     RtlMoveMemoryLP.call(addr, str, str.size)
  134.     return false if 0 == VirtualProtect.call(addr, str.size, old.unpack("L").first, old)
  135.     return true
  136.   end
  137.   private_class_method :write_memory
  138.  
  139.   def read_byte(addr)
  140.     dst = 0.chr * 1
  141.     RtlMoveMemory.call(dst, addr, dst.size)
  142.     return dst.unpack("C").first
  143.   end
  144.   private_class_method :read_byte
  145.  
  146.   def read_dword(addr)
  147.     dst = 0.chr * 4
  148.     RtlMoveMemory.call(dst, addr, dst.size)
  149.     return dst.unpack("L").first
  150.   end
  151.   private_class_method :read_dword
  152.  
  153. end
  154.  
  155. unless $ace_patched
  156.   $ace_patched = true
  157.   raise "应用分辨率补丁失败!" unless AceResolutionMemoryPatch.patch
  158.   #raise RGSSReset.new
  159. end
  160.  
  161. Graphics.resize_screen(800, 600)





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1