class RSGuitarTech::Repacker

Attributes

opts[RW]
psarc[RW]
unpacked[RW]

Public Class Methods

new(opts) click to toggle source
# File lib/rsgt/repacker.rb, line 6
def initialize(opts)
  @psarc = File.expand_path(opts.delete :psarc)
  @opts  = opts
end

Public Instance Methods

repack!() click to toggle source
# File lib/rsgt/repacker.rb, line 11
def repack!
  UnpackedPSARC.from_psarc(psarc, opts) do |unpacked|
    repack_vocals(unpacked) if opts[:vocals_xml]
    repack_audio(unpacked)  if opts[:audio]
    unpacked.repack!
  end
end

Private Instance Methods

repack_audio(unpacked) click to toggle source
# File lib/rsgt/repacker.rb, line 29
def repack_audio(unpacked)
  puts ".. Converting audio to .wem"
  WWiseConverter.new(opts[:audio], opts).convert! do |converter|
    FileUtils.cp converter.results[:main],    unpacked.audio_track
    FileUtils.cp converter.results[:preview], unpacked.audio_track(track: :preview) if opts[:preview]
  end
end
repack_vocals(unpacked) click to toggle source
# File lib/rsgt/repacker.rb, line 21
def repack_vocals(unpacked)
  puts ".. Converting .xml to .sng"
  CommandRunner.run! RSCustomSongToolkit.xml2sng(
    manifest: unpacked.manifest(:vocals),
    input:    opts[:vocals_xml]
  )
end