Merge pull request #1404 from bnnm/keys

- Add FSB key
- Add HCA key
This commit is contained in:
bnnm 2023-08-15 19:49:48 +02:00 committed by GitHub
commit 72f676e57d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 10 deletions

View File

@ -18,12 +18,12 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
/* checks */
if (!is_id32be(0x00,sf, "RIFF"))
goto fail;
return NULL;
if (!is_id32be(0x08,sf, "FEV "))
goto fail;
return NULL;
if (!check_extensions(sf, "bank"))
goto fail;
return NULL;
version = read_u32le(0x14,sf); /* newer FEV have some kind of sub-version at 0x18 */
@ -102,8 +102,10 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
off_t fsb5_offset = read_u32le(bank_offset + 0x04 + entry_size*i + 0x00,sf);
size_t fsb5_size = read_u32le(bank_offset+0x08 + entry_size*i,sf);
int fsb5_subsongs = get_subsongs(sf, fsb5_offset, fsb5_size);
if (!fsb5_subsongs)
if (!fsb5_subsongs) {
vgm_logi("FSB: couldn't load bank (encrypted?)\n");
goto fail;
}
/* target in range */
if (target_subsong >= total_subsongs + 1 && target_subsong < total_subsongs + 1 + fsb5_subsongs) {
@ -140,7 +142,10 @@ VGMSTREAM* init_vgmstream_fsb5_fev_bank(STREAMFILE* sf) {
vgmstream = (read_u32be(0x00, temp_sf) == 0x46534235) ? /* "FSB5" (better flag?)*/
init_vgmstream_fsb5(temp_sf) :
init_vgmstream_fsb_encrypted(temp_sf);
if (!vgmstream) goto fail;
if (!vgmstream) {
vgm_logi("FSB: couldn't load bank (encrypted?)\n");
goto fail;
}
vgmstream->stream_index = sf->stream_index; //target_subsong; /* 0-index matters */
vgmstream->num_streams = total_subsongs;

View File

@ -71,6 +71,7 @@ static const fsbkey_info fsbkey_list[] = {
{ MODE_FSB5_STD, FSBKEY_ADD("281ad163160cfc16f9a22c6755a64fad") }, // Ash Echoes beta (Android)
{ MODE_FSB5_STD, FSBKEY_ADD("Aurogon666") }, // Afterimage demo (PC)
{ MODE_FSB5_STD, FSBKEY_ADD("IfYouLikeThosesSoundsWhyNotRenumerateTheir2Authors?") }, // Blanc (PC/Switch)
{ MODE_FSB5_STD, FSBKEY_ADD("L36nshM520") }, // Nishuihan Mobile (Android)
};
static const int fsbkey_list_count = sizeof(fsbkey_list) / sizeof(fsbkey_list[0]);

View File

@ -1248,6 +1248,9 @@ static const hcakey_info hcakey_list[] = {
// Tower of Sky (Android)
{5893902754391672}, // 0014F0792C042678
// The Irregular at Magic High School: Reloaded Memory (Android)
{7181280307767738368}, // 63A9086451010000
};
#endif/*_HCA_KEYS_H_*/

View File

@ -1983,7 +1983,7 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
offset += txth->base_offset;
if (/*offset < 0 ||*/ offset > get_streamfile_size(sf)) {
vgm_logi("TXTH: wrong offset over file size (%x + %x)\n", offset - txth->base_offset, txth->base_offset);
vgm_logi("TXTH: wrong offset over file size (%x + %x)\n", offset - txth->base_offset, txth->base_offset);
goto fail;
}
@ -1996,7 +1996,7 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
offset = offset + subsong_spacing * (txth->target_subsong - 1);
if (txth->debug)
vgm_logi("TXTH: use value at 0x%x (%s %ib)\n", offset, big_endian ? "BE" : "LE", size * 8);
vgm_logi("TXTH: use value at 0x%x (%s %ib)\n", offset, big_endian ? "BE" : "LE", size * 8);
switch(size) {
case 1: value = read_u8(offset,sf); break;
@ -2015,7 +2015,7 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
value_read = 1;
if (txth->debug)
vgm_logi(hex ? "TXTH: use constant 0x%x\n" : "TXTH: use constant %i\n", value);
vgm_logi(hex ? "TXTH: use constant 0x%x\n" : "TXTH: use constant %i\n", value);
}
else { /* known field */
if ((n = is_string_field(val,"interleave"))) value = txth->interleave;
@ -2074,7 +2074,7 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
value_read = 1;
if (txth->debug)
vgm_logi("TXTH: use field value 0x%x\n", value);
vgm_logi("TXTH: use field value 0x%x\n", value);
}
/* apply simple left-to-right math though, for now "(" ")" are counted and validated
@ -2117,7 +2117,7 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
*out_value = result;
if (txth->debug)
vgm_logi("TXTH: final value: %u (0x%x)\n", result, result);
vgm_logi("TXTH: final value: %u (0x%x)\n", result, result);
return 1;
fail: