// Detect It Easy: detection rule file format
// Author: LinXP

init("image", "DirectDraw Surface (.DDS)");

function detect(bShowType, bShowVersion, bShowOptions) {
    if (Binary.getSize() >= 0x40) {
        if (Binary.compare("'DDS '7C000000")) {
            bDetected = true;
            if (Binary.isVerbose()) {
                sOption(Binary.read_uint32(0x0C) + "x" + Binary.read_uint32(0x10));
                var sFourCC = Binary.getString(0x54, 0x04);
                if (sFourCC) {
                    sOption("compressed: " + sFourCC);
                } else {
                    sOption("uncompressed");
                }
                if (Binary.read_uint32(0x1C)) {
                    sOption("MipMap");
                }
            }
        }
    }

    return result(bShowType, bShowVersion, bShowOptions);
}