05-23-2019, 01:49 AM
Cktool won't work directly on several .ckb files since around the CYL2 update, because the internal sample names for hero voices became Base64-encoded garbage and could potentially include slashes (which would be interpreted as directory separators). For this I had to replace them inside Ruby before the actual extraction:
This suffices for voice files because those .ckb files only contain 1 sample; some sound effect files contain more than one, each with its own internal sample name. I used a more or less identical setup for batch-uploading the voice files to the FEH Gamepedia wiki.
Code:
#!/usr/bin/env ruby
Dir.glob('*.ckb').each do |fname|
bin = IO.binread(fname)
bin[0x48, 0x20] = 'a'.ljust(0x20, "\0")
IO.binwrite('voice.ckb', bin)
system "cktool extract voice.ckb >/dev/null"
File.rename('voice_a_extracted.wav', fname.sub(/\.ckb$/, '.wav'))
end
This suffices for voice files because those .ckb files only contain 1 sample; some sound effect files contain more than one, each with its own internal sample name. I used a more or less identical setup for batch-uploading the voice files to the FEH Gamepedia wiki.