Merge pull request #1546 from bnnm/txth-hca

- Fix TXTH samples for mono MS-IMA/MSADPCM
- Add HCA key
This commit is contained in:
bnnm 2024-06-17 20:18:18 +02:00 committed by GitHub
commit 4f88db173b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -1314,6 +1314,9 @@ static const hcakey_info hcakey_list[] = {
// Sonic Rumble (Android) // Sonic Rumble (Android)
{6834182874188563}, // 001847A7328BCB13 {6834182874188563}, // 001847A7328BCB13
// P A Certain Magical Index 2 (Android)
{5963}, // 000000000000174B
}; };
#endif/*_HCA_KEYS_H_*/ #endif/*_HCA_KEYS_H_*/

View File

@ -2155,6 +2155,8 @@ fail:
static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) { static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) {
switch(txth->codec) { switch(txth->codec) {
case MS_IMA: case MS_IMA:
if (txth->interleave && txth->frame_size) /* mono mode */ //TODO maybe some helper instead
return ms_ima_bytes_to_samples(bytes / txth->channels, txth->frame_size, 1);
return ms_ima_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave, txth->channels); return ms_ima_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave, txth->channels);
case XBOX: case XBOX:
return xbox_ima_bytes_to_samples(bytes, txth->channels); return xbox_ima_bytes_to_samples(bytes, txth->channels);
@ -2185,6 +2187,8 @@ static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) {
case TGC: case TGC:
return pcm_bytes_to_samples(bytes, txth->channels, 4); return pcm_bytes_to_samples(bytes, txth->channels, 4);
case MSADPCM: case MSADPCM:
if (txth->interleave && txth->frame_size) /* mono mode */ //TODO some helper instead
return msadpcm_bytes_to_samples(bytes / txth->channels, txth->frame_size, 1);
return msadpcm_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave, txth->channels); return msadpcm_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave, txth->channels);
case ATRAC3: case ATRAC3:
return atrac3_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave); return atrac3_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave);