Merge pull request #412 from bnnm/txtp-hca

txtp hca
This commit is contained in:
bnnm 2019-05-17 22:37:58 +02:00 committed by GitHub
commit 3f687f4f15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 5 deletions

View File

@ -129,4 +129,6 @@ done:
VGM_ASSERT(best_score > 1, "HCA: best key=%08x%08x (score=%i)\n",
(uint32_t)((*out_keycode >> 32) & 0xFFFFFFFF), (uint32_t)(*out_keycode & 0xFFFFFFFF), best_score);
VGM_ASSERT(best_score < 0, "HCA: key not found\n");
}

View File

@ -258,9 +258,6 @@ static const hcakey_info hcakey_list[] = {
// Onsen Musume: Yunohana Kore Kushon (Android) voices
{6667}, // 0000000000001A0B
/* Dragalia Lost (Cygames) [iOS/Android] */
{2967411924141, subkeys_dgl, sizeof(subkeys_dgl) / sizeof(subkeys_dgl[0]) }, // 000002B2E7889CAD
/* Libra of Precatus (Android) */
{0x6D8EFB700870FCD4}, // 6D8EFB700870FCD4
@ -274,8 +271,16 @@ static const hcakey_info hcakey_list[] = {
{19850716}, // 00000000012EE5DC
/* Puchiguru Love Live! (Android) */
{355541041372}, // 00000052C7E5C0DC
{355541041372}, // 00000052C7E5C0DC
/* Dolls Order (Android) */
{153438415134838}, // 00008B8D2A3AA076
/* Fantasy Life Online (Android) */
{123456789}, // 00000000075BCD15
/* Dragalia Lost (Cygames) [iOS/Android] */
{2967411924141, subkeys_dgl, sizeof(subkeys_dgl) / sizeof(subkeys_dgl[0]) }, // 000002B2E7889CAD
};
#endif/*_HCA_KEYS_H_*/

View File

@ -117,6 +117,7 @@ typedef struct {
int is_segmented;
int is_layered;
int is_single;
} txtp_header;
static txtp_header* parse_txtp(STREAMFILE* streamFile);
@ -155,6 +156,14 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE *streamFile) {
}
/* detect single files before grouping */
if (txtp->group_count == 0 && txtp->vgmstream_count == 1) {
txtp->is_single = 1;
txtp->is_segmented = 0;
txtp->is_layered = 0;
}
/* open all entry files first as they'll be modified by modes */
for (i = 0; i < txtp->vgmstream_count; i++) {
STREAMFILE* temp_streamFile = open_streamfile_by_filename(streamFile, txtp->entry[i].filename);
@ -217,7 +226,7 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE *streamFile) {
apply_config(txtp->vgmstream[grp->position], &grp->group_config);
}
/* final grouping (should be integrated with the above?) */
/* final tweaks (should be integrated with the above?) */
if (txtp->is_layered) {
if (!make_group_layer(txtp, 0, txtp->vgmstream_count))
goto fail;
@ -226,6 +235,13 @@ VGMSTREAM * init_vgmstream_txtp(STREAMFILE *streamFile) {
if (!make_group_segment(txtp, 0, txtp->vgmstream_count))
goto fail;
}
if (txtp->is_single) {
/* special case of setting start_segment to force/overwrite looping
* (better to use #E but left for compatibility with older TXTPs) */
if (txtp->loop_start_segment == 1 && !txtp->loop_end_segment) {
vgmstream_force_loop(txtp->vgmstream[0], 1, txtp->vgmstream[0]->loop_start_sample, txtp->vgmstream[0]->num_samples);
}
}
/* may happen if using mixed mode but some files weren't grouped */