// Detect It Easy: detection rule file

// Author: DosX
// E-Mail: collab@kay-software.ru
// GitHub: https://github.com/DosX-dev
// Telegram: @DosX_dev
// ---
// Samples by: BJNFNE <bjnfne@web.de>

// https://wiki.scummvm.org/index.php?title=Gob/DEV7_Information#STK21_File_Structure
meta("archive", "STK");

function detect() {
    if (Binary.getSize() > 64 && Binary.compare("'STK2.' %%")) {
        var stkMagicSign = Binary.getString(6, 32).trim();

        if (/^[0-9]{10,}[A-Za-z0-9]{5,}/.test(stkMagicSign)) {
            if (X.isVerbose()) sOptions = "Magic signature: " + stkMagicSign;
            sVersion = Binary.getString(3, 3).trim();

            if (/^2\.[0-9]$/.test(sVersion)) {
                bDetected = true;
            }
        }
    }

    return result();
}