mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed SkipSizeCheck from ddraw.ini
* the executable file size check is also removed (mostly).
This commit is contained in:
@@ -851,10 +851,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
|
||||
|
||||
|
||||
+9
-12
@@ -31,7 +31,7 @@ namespace sfall
|
||||
static const DWORD ExpectedSize = 1189888;
|
||||
static const DWORD ExpectedCRC[] = {
|
||||
0xE1680293, // US 1.02d
|
||||
0xEF34F989 // US 1.02d + HRP
|
||||
0xEF34F989 // US 1.02d + HRP by Mash
|
||||
};
|
||||
|
||||
static void inline ExitMessageFail(const char* a) {
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user