Author Topic: [XP] RMXPAce -- Using the VX Ace engine in your XP games  (Read 78041 times)

Offline Ethereal

  • Total Beginner
  • Posts: 1
  • LV: 0
    • View Profile
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #300 on: March 25, 2017, 04:49:09 AM »
hi
Sorry to bother you, but the link is broken  :(

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2954
  • LV: 368
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #301 on: March 25, 2017, 07:48:49 AM »
Thanks for reminding me. Dropbox changed how the Public folder works so all the shared file links don't work anymore. I've updated the links on the first post.

Now because of this, I wonder how many old scripts/resources here are gone forever now since those users aren't active.



(click to show/hide)
NNID: KK20-CP

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 831
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #302 on: March 25, 2017, 11:59:29 AM »
You should update the kit as well, I noticed the tilemap used is still v0.12b.

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2954
  • LV: 368
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #303 on: March 27, 2017, 01:56:18 AM »
I can just release whatever fixes I made and call it v2.1 tomorrow. Still in the process of making a tech demo.

EDIT:
Updated to Version 2.1
  • Updated XPA Tilemap to v0.32
  • Removed Unlimited Resolution as this has been moved over to XPA Tilemap
  • Superclass Mismatch Fix moved lower in script list as it was not running Console Output
  • Updated Ruby 1.8 Methods to v1.1 (includes Array#to_s, String#delete and #[])
Download



(click to show/hide)
NNID: KK20-CP

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2954
  • LV: 368
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #304 on: June 20, 2017, 04:48:40 AM »
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
Code: [Select]
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Enterbrain\RGSS\RTPso, knowing that, I updated the Load RTP script like so:
(change is in RPG::Path.getRTPPath)
Code: [Select]
#===============================================================================
# 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.
« Last Edit: June 20, 2017, 04:50:20 AM by KK20 »



(click to show/hide)
NNID: KK20-CP

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 831
  • LV: 514
  • Gender: Male
    • View Profile
    • ~
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #305 on: June 20, 2017, 12:20:22 PM »
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
Code: [Select]
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Enterbrain\RGSS\RTPso, knowing that, I updated the Load RTP script like so:
(change is in RPG::Path.getRTPPath)

*redacted*

You forgot VX and VXAce, the edit only hardcoding RTP for XP.
It should be:

Code: [Select]
"SOFTWARE\\Wow6432Node\\Enterbrain\\#{rgss}\\RTP",
"#{rtpname}",

Shortened ver
(click to show/hide)

This will allow XPAce to load VX and VXAce RTP too (Priority RTP loaded will be XP > VX > VXA).

Code: [Select]
    # Tried these in Scene_Title
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    #-------------------------------------------------------------------------
    bmp = Bitmap.new("Graphics/Titles1/Book")
    @sprite.bitmap.stretch_blt(@sprite.bitmap.rect, bmp, bmp.rect)
    bmp.dispose
    #-------------------------------------------------------------------------

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2954
  • LV: 368
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] RMXPAce -- Using the VX Ace engine in your XP games
« Reply #306 on: August 01, 2017, 10:07:39 AM »
Updated to Version 2.2
  • Uses XPAT v0.35 (which was updated today)
  • Superclass Mismatch Helper got some minor changes
  • Load RTP now pulls from the registry (explained in posts above)
  • Marshal.load now calls Kernel#load_data instead as this method ensures strings are encoded in UTF-8



(click to show/hide)
NNID: KK20-CP