From ce4514d40a3edf456ff25c76260142defc9ab9f5 Mon Sep 17 00:00:00 2001 From: Dv4L Date: Sun, 12 Jul 2020 22:27:56 +0200 Subject: [PATCH 1/3] - Fix for the game trying to decrypt all read files instead of just encrypted images, also fixes a crash when loading mods due to the game trying to decrypt the gsc files. - Ugly fix for the game crashing with the latest version of steam (credits to IceNinjaman). --- src/Components/Modules/Zones.cpp | 18 ++++-------------- src/Steam/Proxy.cpp | 4 ++-- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index d5188da4..970ef4f0 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -2908,23 +2908,13 @@ namespace Components // check if file should be skipped auto skipFile = false; - if (!strncmp(&file[strlen(file) - 4], ".iwi", 4)) - { - if (readSize > 3 && !memcmp(&fileBuffer[0], "IWi", 3)) - { - skipFile = true; - } - } - else if (strstr(file, "weapons")) + if (!strncmp(&file[strlen(file) - 5], ".iwi", 4)) { skipFile = true; } - else + else if (memcmp(&fileBuffer[0], "IWi", 4)) { - if (readSize > 8 && *reinterpret_cast(&fileBuffer[4]) == 0xe9c9c447) - { - skipFile = true; - } + skipFile = true; } // if the header seems encrypted... @@ -3511,4 +3501,4 @@ namespace Components } } -#pragma optimize( "", on ) +#pragma optimize( "", on ) \ No newline at end of file diff --git a/src/Steam/Proxy.cpp b/src/Steam/Proxy.cpp index 8ab6a4fb..6a08e969 100644 --- a/src/Steam/Proxy.cpp +++ b/src/Steam/Proxy.cpp @@ -175,11 +175,11 @@ namespace Steam size_t expectedParams = Proxy::ClientUser.paramSize("SpawnProcess"); if (expectedParams == 40) // Release { - Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), 0, ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); + Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); } else if (expectedParams == 36) // Beta { - Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), 0, ourDirectory, gameID.bits, mod.data(), 0, 0); + Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); } else if (expectedParams == 48) // Legacy, expects VAC blob { From da7961058ae2592b770e89416bb9533ed4929635 Mon Sep 17 00:00:00 2001 From: Dv4L Date: Sun, 12 Jul 2020 23:45:55 +0200 Subject: [PATCH 2/3] Made a mistake pasting this shit --- src/Steam/Proxy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Steam/Proxy.cpp b/src/Steam/Proxy.cpp index 6a08e969..499bfb25 100644 --- a/src/Steam/Proxy.cpp +++ b/src/Steam/Proxy.cpp @@ -175,11 +175,11 @@ namespace Steam size_t expectedParams = Proxy::ClientUser.paramSize("SpawnProcess"); if (expectedParams == 40) // Release { - Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); + Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); } else if (expectedParams == 36) // Beta { - Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); + Proxy::ClientUser.invoke("SpawnProcess", ourPath, cmdline.data(), ourDirectory, gameID.bits, mod.data(), Proxy::AppId, 0, 0); } else if (expectedParams == 48) // Legacy, expects VAC blob { From 6381826d1b62c53b2886f4342c46c31e1de0db03 Mon Sep 17 00:00:00 2001 From: Dv4L Date: Sun, 19 Jul 2020 16:31:52 +0200 Subject: [PATCH 3/3] More fixes to image decryption check. --- src/Components/Modules/Zones.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Zones.cpp b/src/Components/Modules/Zones.cpp index 970ef4f0..7afeecb4 100644 --- a/src/Components/Modules/Zones.cpp +++ b/src/Components/Modules/Zones.cpp @@ -2908,11 +2908,12 @@ namespace Components // check if file should be skipped auto skipFile = false; - if (!strncmp(&file[strlen(file) - 5], ".iwi", 4)) + + if (strlen(file) > 5 && ((strncmp(&file[strlen(file) - 4], ".iwi", 4) != 0))) { skipFile = true; } - else if (memcmp(&fileBuffer[0], "IWi", 4)) + else if (readSize >= 3 && (!memcmp(&fileBuffer[0], "IWi", 3))) { skipFile = true; }