SimSaw wrote: ↑Tue Jun 18, 2024 8:51 pm
Sorry for bringing this old topic up again, but no matter what I try, I always get the error message:
Unexpected input file 'AUDIO001.002'!
I've been trying with the command
scummvm-tools-cli --tool compress_sci --flac AUDIO001.002
after using the python tool above and I made sure I indeed have WAVE files in the archive.
Am I doing something wrong or is the tool defective?
From the source code, it looks like the compress_sci tool expects an input file strictly named in the format of "resource.*".
https://github.com/scummvm/scummvm-tool ... ci.cpp#L55
Copy the AUDIO001.002 and AUDIO001.MAP files out of the King's Quest game data folder, and rename the first (AUDIO001.002) to "resource.002". Keep the map file with its original name (AUDIO001.MAP).
Run the command line script:
Code: Select all
scummvm-tools-cli.exe --tool compress_sci --flac -o AUDIO001.flac resource.002
I am unsure if the python script fix has been integrated in the tool, or it's needed to be run before using the compress_sci tool.
I was able to run the tool with either version of AUDIO001.002 resource (original or modified with the python script), without errors, and the result had the same size, but the actual contents were different.
Also keep in mind that the above script as pasted needs editing and a couple of fixes to run correctly.
My "corrected" version looks like this (with the kq5_dir also edited to point to the folder for my KQ5 data files):
Code: Select all
#!/usr/bin/env python2
from __future__ import with_statement
from struct import unpack, pack
from StringIO import StringIO
from wave import open as wave_open
# dir with KQ5 installed
kq5_dir = "C:\\Users\\adam\\Games\\sierra\\King's Quest Collection\\KQ5"
# original AUDIO001.002
kq5_aud = "AUDIO001.002.bak"
# original AUDIO001.MAP
kq5_map = "AUDIO001.MAP.bak"
# new AUDIO001.002
aud_new = "AUDIO001.002.new"
# new AUDIO001.MAP
map_new = "AUDIO001.MAP.new"
def parse_map():
with open('\\'.join((kq5_dir, kq5_map)), 'rb') as file: map = file.read()
return tuple((fields[0], fields[1] >> 28, fields[1] & 0x0fffffff, fields[2])
for fields in (unpack('<HII', map[n:n+10])
for n in range(0, len(map) - 10, 10)))
def convert_to_wav():
res_map = parse_map()
with open('\\'.join((kq5_dir, kq5_aud)), 'rb') as aud_in:
with open('\\'.join((kq5_dir, aud_new)), 'wb') as aud_out:
with open('\\'.join((kq5_dir, map_new)), 'wb') as new_map:
for num, volume, offset, size in res_map:
aud_in.seek(offset)
temp = StringIO('')
wav = wave_open(temp, 'wb')
wav.setparams((1, 1, 11025, 0, 'NONE', 'not compressed'))
wav.writeframes(aud_in.read(size))
new_offset = aud_out.tell()
aud_out.write(temp.getvalue())
new_map.write(pack('<HII', num,
((volume << 28) & 0xffffffff) + new_offset,
aud_out.tell() - new_offset))
new_map.write(pack('<HII', 0xffff, 0xffffffff, 0xffffffff))
if __name__ == '__main__': convert_to_wav()
Disclaimer: The results may be unusable, I cannot tell. I can only test that the tool produces something and does not error out.