// https://github.com/horsicq/Detect-It-Easy signature file
// Author: Kaens (TG @kaens)
/* beautify ignore:start */

meta("archive", "Jari Comppa's Compressed File Library 3 file (.CFL)");

function detect() {
    //ref https://solhsa.com/zip/cfl3r3.zip / src/CFL.cpp & CFLResource.cpp
    var startp = t = 0;
    if (!X.c("'CFL3"))
        if (X.c("'3CFL'", X.Sz() - 4))
            if (X.c("'CFL3'", t = X.Sz() - X.U32(X.Sz() - 8))) startp = t;
            else return false;
    var p = X.U32(startp + 4); p += 12 + X.U32(p + 4); if (!X.c("'3CFL'", p)) return false;

    bDetected = true;
    if (X.isVerbose()) {
        if (startp) sOption('begins @' + Hex(startp));
        sOption(outSz(p + 4 - startp), 'sz:')
    }

    return result();
}
/* beautify ignore:end */