Detect-It-Easy/db/Binary/audio_BCSTM.1.sg
DosX 9e621e1954 Rename and reorganize rule files
Renamed and moved numerous .sg files in the db directory to follow a more consistent naming convention and directory structure, grouping by type (e.g., compiler, cruncher, packer, protector, etc.). This improves maintainability and clarity of the signature database organization.
2026-01-25 11:20:39 +03:00

22 lines
988 B
JavaScript

// Detect It Easy: detection rule file
// Author: Kae <TG@kaens>
meta("audio", "Nintendo CTR Stream (.BCSTM)");
function detect() {
// ref https://www.3dbrew.org/wiki/BCSTM
if (!X.c("'CSTM'FF") && !X.c("'CSTM'FE") || X.U8(5) < 0xFE) return false;
var e = X.U8(5) == 0xFE ? _LE : _BE;
if (!X.c("'INFO'", ip = X.U32(0x18, e))) return false; ip += 0x20; // stream info ofs
if (!X.c("'SEEK'", t = 0x40 + X.U32(0x44, e)) || t != X.U32(0x24, e)) return false;
if (!X.c("'DATA'", t = t + X.U32(t + 4, e)) || t != X.U32(0x30, e)) return false;
bDetected = true;
sVersion = 'v' + X.U32(8, e).toString(16) + '_' + (e == 0xFE ? 'le' : 'be');
if (X.isVerbose()) {
var enc = X.U8(ip), senc = ['PCM8', 'PCM16', 'DSP ADPCM', 'IMA ADPCM'][enc],
lp = X.U8(ip + 1), ch = X.U8(ip + 2), sr = X.U32(ip + 4, e);
sOption(senc + ' ' + ch + 'ch ' + sr + 'Hz' + (lp ? ' looped' : '') + ' sz:' + outSz(X.U32(0xC, e)));
}
return result();
}