mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
Load HCA encryption keys from external file (songname.extkey or .extkey)
This commit is contained in:
parent
800a700b4e
commit
bf7d3da39a
@ -9,9 +9,8 @@ VGMSTREAM * init_vgmstream_hca(STREAMFILE *streamFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VGMSTREAM * init_vgmstream_hca_offset(STREAMFILE *streamFile, uint64_t start, uint64_t size) {
|
VGMSTREAM * init_vgmstream_hca_offset(STREAMFILE *streamFile, uint64_t start, uint64_t size) {
|
||||||
/* These I don't know about... */
|
unsigned int ciphKey1;
|
||||||
static const unsigned int ciphKey1=0x30DBE1AB;
|
unsigned int ciphKey2;
|
||||||
static const unsigned int ciphKey2=0xCC554639;
|
|
||||||
|
|
||||||
char filename[PATH_LIMIT];
|
char filename[PATH_LIMIT];
|
||||||
|
|
||||||
@ -51,6 +50,20 @@ VGMSTREAM * init_vgmstream_hca_offset(STREAMFILE *streamFile, uint64_t start, ui
|
|||||||
|
|
||||||
hca = (clHCA *)(hca_file + 1);
|
hca = (clHCA *)(hca_file + 1);
|
||||||
|
|
||||||
|
/* try to find key in external file */
|
||||||
|
{
|
||||||
|
uint8_t keybuf[8];
|
||||||
|
|
||||||
|
if ( read_key_file(keybuf, 8, streamFile) ) {
|
||||||
|
ciphKey2 = get_32bitBE(keybuf+0);
|
||||||
|
ciphKey1 = get_32bitBE(keybuf+4);
|
||||||
|
} else {
|
||||||
|
/* PSO2 */
|
||||||
|
ciphKey2=0xCC554639;
|
||||||
|
ciphKey1=0x30DBE1AB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clHCA_clear(hca, ciphKey1, ciphKey2);
|
clHCA_clear(hca, ciphKey1, ciphKey2);
|
||||||
|
|
||||||
if (clHCA_Decode(hca, hca_data, header_size, 0) < 0) goto fail;
|
if (clHCA_Decode(hca, hca_data, header_size, 0) < 0) goto fail;
|
||||||
|
Loading…
Reference in New Issue
Block a user