def ptr_to_ansi(pstr)
  _RtlMoveMemory = Win32API.new('ntdll', 'RtlMoveMemory', 'pLL', 'v')
  str = ''
  char = ' '
  while true
    _RtlMoveMemory.call(char, pstr, 1)
    break if char == "\0"
    str += char
    pstr += 1
  end
  str
end

def expand_rtp(path)
  _RGSSGetPathWithRTP = Win32API.new('RGSS104E', 'RGSSGetPathWithRTP', 'p', 'i') # 你可能想把 RGSS104E 改成 RGSS103J
  ptr_to_ansi(_RGSSGetPathWithRTP.call(path))
end

expand_rtp("Audio\\SE\\001-System01") #=> D:\SteamLibrary\steamapps\common\RPGXP\rtp\Audio\SE\001-System01.ogg
Audio.length(expand_rtp("Audio\\SE\\001-System01")) #=> 0