summertriangle-dev / acb.py

Other
23 stars 8 forks source link

Failed to decrypt SIF2 acbs #5

Open kotori2 opened 1 year ago

kotori2 commented 1 year ago

I was trying to decrypt SIF2 audio with this library, but the generated file is just white noice (with some rhymes?) Here is the command I used (Tried both big and little endian): python3 -m acb --disarm-with 0x46537c6ceb39d400 BG_0001_Home.acb also

from acb import ACBFile, name_gen_default
import os.path

target_dir = "."
with ACBFile(open("dl/Sound/Bgm/BG_0001_Home.acb", "rb"), extern_awb=open("dl/Sound/Bgm/BG_0001_Home.awb", "rb"), hca_keys="0x46537c6ceb39d400") as acb:
    for track in acb.track_list.tracks:
        name = name_gen_default(track)

        with open(os.path.join(target_dir, name), "wb") as out_file:
            out_file.write(acb.get_track_data(track))

The following command generates the correct result with vgmstream: .\vgmstream-cli.exe -i -o BG_0001_Home.wav .\BG_0001_Home.acb .\BG_0001_Home.awb with key file 46 53 7C 6C EB 39 D4 00

Sample files: vgmstream-win64.zip

summertriangle-dev commented 1 year ago

SIF 2 seems to be using HCA version 3 which (as far as I know) only vgmstream supports for now. If you use any ffmpeg-based converter you'll get incorrect output.

The files are being decrypted correctly though (./vgmstream-cli -i -o test.wav BG_0001_Home.hca with no key produces good audio).