mirror of
https://github.com/horsicq/Detect-It-Easy.git
synced 2026-06-24 01:54:08 +00:00
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.
25 lines
1 KiB
JavaScript
25 lines
1 KiB
JavaScript
// Detect It Easy: detection rule file
|
|
// Author: Kae <TG@kaens>
|
|
|
|
// https://github.com/Gota7/NitroStudio2/blob/master/docs/specs/stream.md
|
|
meta("audio", "Nintendo DS multi-channel stream (.STRM)");
|
|
|
|
function detect() {
|
|
if ((!X.c("'STRM'FE") && !X.c("'STRM'FF")) || X.U8(4) == X.U8(5) || X.U8(5) < 0xFE || !X.c("'HEAD'", 0x10)) return;
|
|
var e = X.U8(4) == 0xFF ? _LE : _BE, dp = 0x10 + X.U32(0x14, e);
|
|
if (X.U8(0x19) > 1 || dp > X.Sz()) return;
|
|
if (!X.c("'DATA'", dp) || X.U32(0x28, e) != dp + 8 || X.U32(8, e) != dp + X.U32(dp + 4, e)) return;
|
|
|
|
bDetected = true;
|
|
|
|
sVersion = ['PCM8s', 'PCM16', 'IMA-ADPCM'][X.U8(0x18)] + '/' + (e == _LE ? 'le' : 'be');
|
|
if (X.isVerbose()) {
|
|
var ch = X.U8(0x1A), len = (X.U32(0x24, e) / X.U16(0x1C, e)).toFixed(0);
|
|
sOption(
|
|
'ch:' + ch + ' len ' + secondsToTimeStr(len) +
|
|
' s/r:' + X.U16(0x1C, e) + 'Hz ' + ['not looped', 'looped'][X.U8(0x19)] + ' sz:' + outSz(X.U32(dp + 4, e) + dp)
|
|
);
|
|
}
|
|
|
|
return result();
|
|
}
|