I downloaded the Steam version of RMXP to test the weird issues it was having with XPA projects. One of them was the location of the RTP. Sure this can be easily resolved by either loading your project with all the RTP assets or installing the RTP package from the official RPG Maker website, but I found a way to read the registry of the RTP location. It seems to reside in
#===============================================================================
# Load RTP File
# Author: joe59491, edit by LiTTleDRAgo
# Version : 1.40
#-------------------------------------------------------------------------------
# [ Description ]
# Loads RMXP RTP assets so that the user does not have to manually import all of
# them into their project.
#
# [ Instructions ]
# There is nothing to do here.
# Please keep this script in its current location.
#
# It is highly advised to not modify this script unless you know what you are
# doing.
#===============================================================================
if XPA_CONFIG::RTP_LOADER
module Load_RTP_File
RMXP = true
RMVX = false
RMVXA = false
end
#==============================================================================
# ** Ini
#------------------------------------------------------------------------------
#
#==============================================================================
module Ini
#--------------------------------------------------------------------------
# * self.readIni
#--------------------------------------------------------------------------
def self.readIni(item = "Title")
buf = 0.chr * 256
@gpps ||= Win32API.new("kernel32","GetPrivateProfileString","pppplp","l")
@gpps.call("Game",item,"",buf,256,"./Game.ini")
buf.delete!("\0")
return buf
end
end
#==============================================================================
# ** String
#------------------------------------------------------------------------------
#
#==============================================================================
class String
#--------------------------------------------------------------------------
# ● UTF8_to_unicode
#--------------------------------------------------------------------------
def to_unicode
@mbytetowchar ||= Win32API.new("kernel32","MultiByteToWideChar",'ilpipi','I')
len = @mbytetowchar.call(65001, 0, self, -1, 0, 0) << 1
@mbytetowchar.call(65001, 0, self, -1, (buf = " " * len), len)
return buf
end
end
#==============================================================================
# ** RPG::Path
#------------------------------------------------------------------------------
#
#==============================================================================
module RPG
module Path
#--------------------------------------------------------------------------
# * Constant
#--------------------------------------------------------------------------
FindFirstFile = Win32API.new("kernel32", "FindFirstFileW", "PP", "L")
FindNextFile = Win32API.new("kernel32", "FindNextFileW", "LP", "I")
ReadRegistry = Win32API.new("advapi32","RegGetValue","lppllpp","l")
#--------------------------------------------------------------------------
# * getRTPPath
#--------------------------------------------------------------------------
def self.getRTPPath(rgss,rtpname)
return "" if rtpname == "" or rtpname.nil?
size = [256].pack("L")
# Get the registry value's length
ReadRegistry.call(
0x80000002, # HKEY_LOCAL_MACHINE
"SOFTWARE\\Wow6432Node\\Enterbrain\\RGSS\\RTP",
"Standard",
2, # REG_SZ
0, # Null
0, # Null, so that we can get value's length
size)
buffer = size.unpack("L")[0] # Length stored in 'size'
path = "\0" * buffer # Now we know how long the string is
# Get the registry value itself
ReadRegistry.call(
0x80000002, # HKEY_LOCAL_MACHINE
"SOFTWARE\\Wow6432Node\\Enterbrain\\RGSS\\RTP",
"Standard",
2, # REG_SZ
0, # Null
path,
size)
path.delete!("\0")
path = path + '/' # Ensure trailing forward slash to path name
path = path.gsub("\\","/").gsub("//","/")
path
end
#--------------------------------------------------------------------------
# * Class Variable
#--------------------------------------------------------------------------
@@RTP = []
if Load_RTP_File::RMXP
@@RTP << self.getRTPPath('RGSS','Standard')
(0..3).each do |i|
@@RTP << self.getRTPPath('RGSS',Ini.readIni("RTP#{i.to_s}"))
end
end
@@RTP << self.getRTPPath('RGSS2',"RPGVX") if Load_RTP_File::RMVX
@@RTP << self.getRTPPath('RGSS3',"RPGVXAce") if Load_RTP_File::RMVXA
@@RTP.reject! {|rtp| rtp.nil? || rtp.empty?}
#--------------------------------------------------------------------------
# * self.findP
#--------------------------------------------------------------------------
def self.findP(*paths)
findFileData = " " * 596
result = ""
for file in paths
unless FindFirstFile.call(file.to_unicode, findFileData) == -1
name = file.split("/").last.split(".*").first
result = File.dirname(file) + "/" + name
end
end
return result
end
#--------------------------------------------------------------------------
# * self.RTP
#--------------------------------------------------------------------------
def self.RTP(path)
@list ||= {}
return @list[path] if @list.include?(path)
check = File.extname(path).empty?
rtp = []
@@RTP.each do |item|
unless item.empty?
rtp.push(item + path)
rtp.push(item + path + ".*") if check
end
end
rtp.push(path)
rtp.push(path + ".*") if check
pa = self.findP(*rtp)
@list[path] = pa == "" ? path : pa
return @list[path]
end
end
end
#==============================================================================
# ** Audio
#------------------------------------------------------------------------------
#
#==============================================================================
class << Audio
#--------------------------------------------------------------------------
# * Alias Listing
#--------------------------------------------------------------------------
[:bgm_play,:bgs_play,:se_play,:me_play].each do |meth|
$@ || alias_method(:"#{meth}_path", :"#{meth}")
define_method(:"#{meth}") do |*args|
args[0] = RPG::Path::RTP(args[0]) if args[0].is_a?(String)
send(:"#{meth}_path",*args)
end
end
end
#==============================================================================
# ** Bitmap
#------------------------------------------------------------------------------
#
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# ● Alias Method
#--------------------------------------------------------------------------
$@ || alias_method(:rtp_path_init, :initialize)
#--------------------------------------------------------------------------
# ● Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
args[0] = RPG::Path::RTP(args.at(0)) if args.at(0).is_a?(String)
rtp_path_init(*args)
end
end
#==============================================================================
# ** Graphics
#------------------------------------------------------------------------------
# This module handles all Graphics
#==============================================================================
class << Graphics
#--------------------------------------------------------------------------
# ● Alias Method
#--------------------------------------------------------------------------
$@ || alias_method(:rtp_path_transition, :transition)
#--------------------------------------------------------------------------
# ● transition
#--------------------------------------------------------------------------
def transition(*args)
args[1] = RPG::Path::RTP(args.at(1)) if args[1].is_a?(String)
rtp_path_transition(*args)
end
end
end
I only tested this on a Win7x64. No guarantees if this is 100% foolproof.