RESONANCE: A Plague Tale Legacy

Refuses to start: "Shader Model 6.7 is not supported by this device". It also turns HDR10 on by itself on a display it reads as HDR and starts to a black screen, so HDR10 0 goes into its ENGINESETTINGS file.

GPL-3.0-or-laterThis fix in MacGameFix

What you see

Fatal error — Shader Model 6.7 is not supported by this device!

Why it happens

D3DMetal reports Shader Model 6.6, because that is what it has, and the game refuses to start below 6.7.

What the fix changes

Lower the shader model floor to 6.6, in memory

The code

Finds the one cmp eax, 67h that compares the shader model with 6.7 and makes it 6.6, in memory only; with any other number of matches it touches nothing.

fixes/shader-floor-fix.c · lower_the_floor, lines 74–120
c
static void lower_the_floor(void)
{
    HMODULE base = GetModuleHandleA(NULL);
    IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)base;
    IMAGE_NT_HEADERS *nt;
    IMAGE_SECTION_HEADER *sec;
    BYTE *found = NULL;
    int hits = 0;
    unsigned i;

    if (!base || dos->e_magic != IMAGE_DOS_SIGNATURE) return;
    nt = (IMAGE_NT_HEADERS *)((BYTE *)base + dos->e_lfanew);
    if (nt->Signature != IMAGE_NT_SIGNATURE) return;
    sec = IMAGE_FIRST_SECTION(nt);

    for (i = 0; i < nt->FileHeader.NumberOfSections; i++, sec++)
    {
        BYTE *p, *end;
        if (memcmp(sec->Name, ".text", 5) != 0) continue;
        p   = (BYTE *)base + sec->VirtualAddress;
        end = p + sec->Misc.VirtualSize - sizeof(SM_FLOOR);
        for (; p < end; p++)
        {
            if (p[0] != SM_FLOOR[0] || memcmp(p, SM_FLOOR, sizeof(SM_FLOOR)) != 0) continue;
            if (++hits == 1) found = p;
        }
    }

    if (hits != 1)
    {
        logf_("%d places match the pattern -- leaving all of them alone", hits);
        return;
    }
    {
        DWORD old;
        if (!VirtualProtect(found + 2, 1, PAGE_EXECUTE_READWRITE, &old))
        {
            logf_("VirtualProtect refused (err %lu)", GetLastError());
            return;
        }
        found[2] = 0x66;
        VirtualProtect(found + 2, 1, old, &old);
        logf_("shader model floor 6.7 -> 6.6 at +0x%lX, in memory only%s",
              (unsigned long)(found - (BYTE *)base),
              found[2] == 0x66 ? "" : " -- but the write did not stick");
    }
}

Details

Needs
D3DMetal, D3D12
Installer
install-resonance-fix.sh
Executable
Resonance.exe
Built from
shader-floor-fix.c
Verified on
Stable 26.3 (cxoffice-26.3.0rc2), Game Porting Toolkit 3.0 and 4.0b2 alike

The full story, with the measurements and the wrong turns