// Detect It Easy: detection rule file

// Author: DosX
// E-Mail: collab@kay-software.ru
// GitHub: https://github.com/DosX-dev
// Telegram: @DosX_dev

// https://www.amd.com/en/products/graphics/technologies/fidelityfx/super-resolution.html
meta("library", "AMD FSR");

function detect() {
    if (PE.is64()) {
        if (PE.isLibraryPresentExp(/^ffx_fsr2/i)) {
            sVersion = "2.X";
        } else if (PE.isExportFunctionPresent("ffxFsr2ContextCreate")) {
            sOptions = "static"; // EAT
            sVersion = "2.X";
        } else if (PE.isLibraryPresentExp(/^ffx_fsr3/i)) {
            sVersion = "3.X";
        } else if (PE.isExportFunctionPresent("ffxFsr3UpscalerContextCreate")) {
            sOptions = "static"; // EAT
            sVersion = "3.X";
        } else if (PE.isLibraryPresentExp(/^ffx_fsr/i) || PE.isLibraryPresentExp(/fidelityfx/i)) { // unknown version
            bDetected = true;
        } else if (PE.isExportFunctionPresentExp(/^ffxFsr/)) {
            sOptions = "static"; // EAT
        }
    }

    bDetected = bDetected || Boolean(sVersion) || Boolean(sOptions);

    return result();
}