| 赞 | 0  | 
 
| VIP | 40 | 
 
| 好人卡 | 2 | 
 
| 积分 | 1 | 
 
| 经验 | 10932 | 
 
| 最后登录 | 2016-5-17 | 
 
| 在线时间 | 462 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 462 小时
 
        - 注册时间
 - 2007-7-30
 
        - 帖子
 - 643
 
 
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
 本帖最后由 david50407 于 2010-11-14 12:14 编辑  
 
关于RTP请参照 : http://rpg.blue/thread-160800-1-1.html 
因为 VX 没有多重 RTP 的设置 
于是我用脚本来实现个 
基本上脚本是遵循 FSL 协议的 
不过 String 转码模块是不遵循的 (介于本人懒惰...)- #==============================================================================
 
 - # ■ String
 
 - #------------------------------------------------------------------------------
 
 - #  字符串类。可处理任意长度的字节串。 (追加编码转换的定义)
 
 - #==============================================================================
 
  
- class String
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 用来编码Ruby 字符串、解码unicode 的两个Windows API 函数
 
 -   #--------------------------------------------------------------------------
 
 -   @@MultiByteToWideChar = Win32API.new("kernel32", "MultiByteToWideChar", ['I', 'L', 'P', 'I', 'P', 'I'], 'I')
 
 -   @@WideCharToMultiByte = Win32API.new("kernel32", "WideCharToMultiByte", ['I', 'L', 'P', 'I', 'P', 'I', 'P', 'P'], 'I')
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 返回将Ruby UTF-8 字符串对象(本身)编码为unicode 后的字符串
 
 -   #--------------------------------------------------------------------------
 
 -   def to_unicode
 
 -     len = @@MultiByteToWideChar.call(65001, 0, self, -1, 0, 0) << 1
 
 -     buf =" " * len
 
 -     # 65001: UTF-8 字符集编码(代码页)
 
 -     @@MultiByteToWideChar.call(65001, 0, self, -1, buf, len)
 
 -     return buf
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 返回将编码为unicode 的字符串对象(本身)解码为UTF-8 后的字符串
 
 -   #--------------------------------------------------------------------------
 
 -   def to_UTF8
 
 -     len = @@WideCharToMultiByte.call(65001, 0, self, -1, 0, 0, 0, 0)
 
 -     buf =" " * len
 
 -     @@WideCharToMultiByte.call(65001, 0, self, -1, buf, len, 0, 0)
 
 -     # 去掉'\0' 字符串结束符(因为转换之后仅仅用于Ruby 字符串)
 
 -     buf.slice!(-1, 1)
 
 -     return buf
 
 -   end
 
 - end
 
 
  复制代码 这是String转码模块- #===============================================================================
 
 - # ■ 多重 RTP
 
 - # mutiRTP
 
 - #-------------------------------------------------------------------------------
 
 - # 基于 VX 没有多 RTP 供选择的缘故
 
 - # 这是个多 RTP 设置的实现
 
 - #
 
 - # 在配置区可以随意设置要使用的RTP 名称
 
 - # 在找不到该 RTP 时也能设置是否忽略
 
 - # (不过若是资源找不着时还是采用 VX 默认的报错)
 
 - #-------------------------------------------------------------------------------
 
 - #    更新作者: David Kuo (david50407 @ 66rpg.com)
 
 - #    许可协议: FSL
 
 - #    项目版本: 1.00.0000
 
 - #    引用网址:
 
 - #-------------------------------------------------------------------------------
 
 - #    - *1.00.0000 * By David Kuo (david50407 @ 66rpg.com)
 
 - #      * 初版
 
 - #===============================================================================
 
 - $fscript = {} if $fscript == nil
 
 - $fscript["mutiRTP"] = "1.00.0000"
 
 - #-------------------------------------------------------------------------------
 
 - # ▼ 通用配置模块
 
 - #-------------------------------------------------------------------------------
 
 - module FSL
 
 -   module MutiRTP
 
 -     ERROR = false # 找不到 RTP 时是否导致 致命错误(程序退出)
 
 -     # 以下设置 RTP 的名称
 
 -     RTPs = ["RPGVX"]
 
 -   end
 
 - end
 
 - #-------------------------------------------------------------------------------
 
 - # ▼ 多重 RTP
 
 - #-------------------------------------------------------------------------------
 
 - module MutiRTP
 
 -   include FSL::MutiRTP # 引入设置
 
 -   # 定义 API
 
 -   RegOpenKeyEx = Win32API.new('advapi32', 'RegOpenKeyEx', 'lpiip', 'l')
 
 -   RegQueryValueEx = Win32API.new('advapi32', 'RegQueryValueExW', 'lppppp', 'l')
 
 -   RegCloseKey = Win32API.new('advapi32', 'RegCloseKey', 'l', 'l')
 
 -   
 
 -   # 定义模块方法
 
 -   module_function
 
 -   
 
 -   def findRTPs(*args)
 
 -     rtpPath = []
 
 -     hKey = '    '
 
 -     RegOpenKeyEx.call(-2147483646, 'SOFTWARE\Enterbrain\RGSS2\RTP', 0, 0x20019 | 0x0200, hKey)
 
 -     hKey = hKey.unpack('l')[0]
 
  
-     for rtp in args
 
 -       data, cbData = '    ' * 32, [128].pack('l')
 
 -       RegQueryValueEx.call(hKey, rtp.to_unicode, 0, 0, data, cbData)
 
 -       if data == '    ' * 32
 
 -         if ERROR
 
 -           p "找不到 RTP : \"#{rtp}\""
 
 -           exit
 
 -         end
 
 -       else
 
 -         rtpPath.push(File.expand_path(data.to_UTF8) + '/')
 
 -       end
 
 -     end
 
 -     
 
 -     RegCloseKey.call(hKey)
 
 -     return rtpPath
 
 -   end
 
 -   
 
 -   def init
 
 -     rtpPath = findRTPs(*RTPs)
 
 -     for p in rtpPath
 
 -       $: << p
 
 -     end
 
 -     $mutiRTP = rtpPath
 
 -   end
 
 - end
 
  
- #-------------------------------------------------------------------------------
 
 - # ▼ 修正路径
 
 - #-------------------------------------------------------------------------------
 
 - module RPG
 
 -   module Path
 
 -     FindFirstFile = Win32API.new("kernel32", "FindFirstFileW", "PP", "L")
 
 -     FindNextFile = Win32API.new("kernel32", "FindNextFileW", "LP", "I")
 
 -     def self.findP(*paths)
 
 -       findFileData = " " * 592
 
 -       for p in paths
 
 -         unless FindFirstFile.call(p.to_unicode, findFileData) == -1 # INVALID_HANDLE_VALUE
 
 -           return File.dirname(p) + "/" + findFileData[44, 45 + 260 * 2].to_UTF8
 
 -         end
 
 -       end
 
 -       return ""
 
 -     end
 
 -     
 
 -     @list = {}
 
 -     def self.Get(path)
 
 -       return @list[path] if @list.include?(path)
 
 -       check = File.extname(path).empty?
 
 -       rtp = []
 
 -       for i in 0...$mutiRTP.length
 
 -         unless $mutiRTP[i].empty?
 
 -           rtp.push($mutiRTP[i] + path)
 
 -           if check
 
 -             rtp.push($mutiRTP[i] + path + ".*")
 
 -           end
 
 -         end
 
 -       end
 
 -       pa = self.findP(*rtp)
 
 -       if pa == ""
 
 -         @list[path] = path
 
 -       else
 
 -         @list[path] = pa
 
 -       end
 
 -       return @list[path]
 
 -     end
 
 -   end
 
 - end
 
  
- #-------------------------------------------------------------------------------
 
 - # ▼ 修正 Cache
 
 - #-------------------------------------------------------------------------------
 
 - module Cache
 
 -   class << self
 
 -     alias_method :old_load_bitmap, :load_bitmap
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # * 载入图档
 
 -   #--------------------------------------------------------------------------
 
 -   def self.load_bitmap(folder_name, filename, hue = 0)
 
 -     self.old_load_bitmap(File.dirname(RPG::Path.Get(folder_name+filename))+'/', filename, hue)
 
 -   end
 
 - end
 
  
- #-------------------------------------------------------------------------------
 
 - # ▼ 修正 Audio
 
 - #-------------------------------------------------------------------------------
 
 - module Audio
 
 -   class << self
 
 -     alias_method :old_bgm_play, :bgm_play
 
 -     alias_method :old_bgs_play, :bgs_play
 
 -     alias_method :old_me_play,  :me_play
 
 -     alias_method :old_se_play,  :se_play
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # * 播放背景音乐
 
 -   #--------------------------------------------------------------------------
 
 -   def self.bgm_play(*args)
 
 -     args[0] = RPG::Path.Get(args[0])
 
 -     return self.old_bgm_play(*args)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # * 播放背景音效
 
 -   #--------------------------------------------------------------------------
 
 -   def self.bgs_play(*args)
 
 -     args[0] = RPG::Path.Get(args[0])
 
 -     return self.old_bgs_play(*args)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # * 播放事件音乐
 
 -   #--------------------------------------------------------------------------
 
 -   def self.me_play(*args)
 
 -     args[0] = RPG::Path.Get(args[0])
 
 -     return self.old_me_play(*args)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # * 播放事件音效
 
 -   #--------------------------------------------------------------------------
 
 -   def self.se_play(*args)
 
 -     args[0] = RPG::Path.Get(args[0])
 
 -     return self.old_se_play(*args)
 
 -   end
 
 - end
 
  
- MutiRTP.init
 
  复制代码 这是我们的主角~~ 请放置于Cache模块之后 
RTPs = ["RPGVX"] # 这就是RTP设置 
 
有BUG请回报 
 
至于图嘛...还是上个几张好了... 
 
没设置RTP 
 
RMVX游戏照样运行~~ 
 
范例: 
 
Project1.rar
(1.05 MB, 下载次数: 925)
 |   
 
评分
- 
查看全部评分
 
 
 
 
 
 |