diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 40adf7dd..cab40576 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -827,10 +827,6 @@ AllowUnsafeScripting=0 ;Does not require sfall debugging mode ;ExtraCRC=0x00000000,0x00000000 -;Set to 1 to skip the executable file size check -;Does not require sfall debugging mode -SkipSizeCheck=0 - ;Set to 1 to skip the compatibility mode check SkipCompatModeCheck=0 diff --git a/sfall/CRC.cpp b/sfall/CRC.cpp index 609829a9..9fe5e90f 100644 --- a/sfall/CRC.cpp +++ b/sfall/CRC.cpp @@ -87,22 +87,12 @@ bool CRC(const char* filepath) { HANDLE h = CreateFileA(filepath, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (h == INVALID_HANDLE_VALUE) { - sprintf_s(buf, "Cannot open %s for CRC check.", filepath); - ExitMessageFail(buf); + ExitMessageFail("Cannot open the game executable for CRC check."); return false; } DWORD size = GetFileSize(h, 0); - if (size != ExpectedSize && IniReader::GetIntDefaultConfig("Debugging", "SkipSizeCheck", 0) == 0) { - CloseHandle(h); - sprintf_s(buf, "You're trying to use sfall with an incompatible version of Fallout.\n" - "Was expecting '" TARGETVERSION "'.\n\n" - "%s has an unexpected size.\nExpected %d bytes but got %d bytes.", filepath, ExpectedSize, size); - ExitMessageFail(buf); - return false; - } - DWORD crc; BYTE* bytes = new BYTE[size]; ReadFile(h, bytes, size, &crc, 0); @@ -128,6 +118,13 @@ bool CRC(const char* filepath) { sprintf_s(buf, "You're trying to use sfall with an incompatible version of Fallout.\n" "Was expecting '" TARGETVERSION "'.\n\n" "%s has an unexpected CRC.\nExpected 0x%x but got 0x%x.", filepath, ExpectedCRC[0], crc); + + if (size == ExpectedSize) { + if (MessageBoxA(0, buf, "CRC mismatch", MB_TASKMODAL | MB_ICONWARNING | MB_ABORTRETRYIGNORE) != IDIGNORE) { + ExitProcess(1); + } + return true; + } ExitMessageFail(buf); } return matchedCRC;