- if ((!cdr.Muted) && (cdr.Mode & MODE_STRSND) && (!Config.Xa) && (cdr.FirstSector != -1)) { // CD-XA
- hdr = buf + 4;
- // Firemen 2: Multi-XA files - briefings, cutscenes
- if( cdr.FirstSector == 1 && (cdr.Mode & MODE_SF)==0 ) {
- cdr.File = hdr[0];
- cdr.Channel = hdr[1];
+ subhdr = (void *)(buf + 4);
+ do {
+ // try to process as adpcm
+ if (!(cdr.Mode & MODE_STRSND))
+ break;
+ if (buf[3] != 2 || (subhdr->mode & 0x44) != 0x44) // or 0x64?
+ break;
+ CDR_LOG("f=%d m=%d %d,%3d | %d,%2d | %d,%2d\n", !!(cdr.Mode & MODE_SF), cdr.Muted,
+ subhdr->file, subhdr->chan, cdr.CurFile, cdr.CurChannel, cdr.FilterFile, cdr.FilterChannel);
+ if ((cdr.Mode & MODE_SF) && (subhdr->file != cdr.FilterFile || subhdr->chan != cdr.FilterChannel))
+ break;
+ if (subhdr->chan & 0xe0) { // ?
+ if (subhdr->chan != 0xff)
+ log_unhandled("adpcm %d:%d\n", subhdr->file, subhdr->chan);
+ break;
+ }
+ if (!cdr.FileChannelSelected) {
+ cdr.CurFile = subhdr->file;
+ cdr.CurChannel = subhdr->chan;
+ cdr.FileChannelSelected = 1;