Skip to content

Commit

Permalink
Merge pull request #1546 from bnnm/txth-hca
Browse files Browse the repository at this point in the history
- Fix TXTH samples for mono MS-IMA/MSADPCM
- Add HCA key
  • Loading branch information
bnnm committed Jun 17, 2024
2 parents 135e90b + dd69f9d commit 4f88db1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/meta/hca_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,9 @@ static const hcakey_info hcakey_list[] = {
// Sonic Rumble (Android)
{6834182874188563}, // 001847A7328BCB13

// P A Certain Magical Index 2 (Android)
{5963}, // 000000000000174B

};

#endif/*_HCA_KEYS_H_*/
4 changes: 4 additions & 0 deletions src/meta/txth.c
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,8 @@ static int parse_num(STREAMFILE* sf, txth_header* txth, const char* val, uint32_
static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) {
switch(txth->codec) {
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);
case XBOX:
return xbox_ima_bytes_to_samples(bytes, txth->channels);
Expand Down Expand Up @@ -2185,6 +2187,8 @@ static int get_bytes_to_samples(txth_header* txth, uint32_t bytes) {
case TGC:
return pcm_bytes_to_samples(bytes, txth->channels, 4);
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);
case ATRAC3:
return atrac3_bytes_to_samples(bytes, txth->frame_size ? txth->frame_size : txth->interleave);
Expand Down

0 comments on commit 4f88db1

Please sign in to comment.