libertyernie / LoopingAudioConverter

A converter frontend for loopable audio formats
181 stars 17 forks source link

HCA Keycode Encryption Doesn't Work #102

Closed Sonen10 closed 3 weeks ago

Sonen10 commented 1 month ago

When encoding an audio file using the HCA encoder, I've noticed that the keycode option doesn't appear to do anything. I would enter a code into the section but when put in a game that uses that encryption, it doesn't sound right; a telltale sign that the encryption didn't occur. I didn't think to write an issue about it until today, when I decided to convert the same audio file with the same parameters, with the only difference being the use of a keycode. To my beffudlement, LoopingAudioConverter output two byte-identical files, even though I entered a keycode for one of them.

VGAudio definitely supports keycode encryption (there's even a fork of it that can apply encryption to pre-existing HCA files), so it seems like an issue pertaing to LoopingAudioConverter's implementation...

Sonen10 commented 1 month ago

After a bit of actually using the standard version of VGAudioCli, I learnt that it doesn't support HCA encryption. Below are all the options given when running the executable:

HCA Options:
      --hcaquality     The quality level to use for the HCA file
      --bitrate        The bitrate in bps of the output HCA file
                       --bitrate takes precedence over --hcaquality
      --limit-bitrate  This flag sets a limit on how low the bitrate can go
                       This limit depends on the properties of the input file

This inclines me to believe that you just duplicated the ADX encoding options into the HCA options without considering what VGAudio could actually manage. With that said, a fork of VGAudio which actually does support HCA encryption exists which I feel could be implemented. I figured that instead of removing the option you accidentally left in, it would be better practice to actually make the option work. I don't quite know how I would implement it myself with my own build, which is why I just replied to this issue.

IsaacSchemm commented 4 weeks ago

Where does it say that fork supports HCA encryption? The master branch looks exactly the same as the original to me, but I don't really know where to look. I'd definitely use it if it helps add that feature, but if there isn't a fork where it's working yet, I'll at least remove it from the UI.

Sonen10 commented 4 weeks ago

Compared the two forks and apparently they're one-to-one identical. When I built the latest source code from thealexbarney myself, it actually does do keycode encryption, something that the latest release of VGAudio on the official page doesn't do (the latest release is about 2 years, 8 months, 15 days, 9 hours, 34 minutes older than the latest commit). This means that M&M's fork likely exists to just distribute a built version with encryption support. There's another that adds --keycode to the HCA options I mentioned earlier, but that's getting a bit off-track. Point is, the current source code of VGAudio from its original author does support HCA encryption, meaning it'd be possible to also make the keycode option functional in Looping Audio Conveter.

Sonen10 commented 3 weeks ago

After some further testing, it turns out that the only things that will need to be updated is VGAudio.dll and VGAudio.xml, both to the latest builds that are built from the latest source code. From here, I'll make a fork of the software with these changes integrated into the source code. Thanks for helping out!

IsaacSchemm commented 3 weeks ago

Thanks! Next time I make a release of LoopingAudioConverter, I'll make sure to build VGAudio from source instead of using the release.