From 689c568180f3f79e183353cb1ec5e1b3e3705d65 Mon Sep 17 00:00:00 2001 From: Mikhail Tyukin Date: Wed, 23 Jul 2025 21:02:59 -0400 Subject: [PATCH] fix game version not supported when it is this occurs when game was already patched --- ServerSelector/ServerSwitcher.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ServerSelector/ServerSwitcher.cs b/ServerSelector/ServerSwitcher.cs index ee0c728..3bbfb27 100644 --- a/ServerSelector/ServerSwitcher.cs +++ b/ServerSelector/ServerSwitcher.cs @@ -9,6 +9,7 @@ namespace ServerSelector public class ServerSwitcher { private static readonly string[] GameAssemblySodiumIntegrityFuncHint = ["40 53 56 57 41 54 41 55 41 56 41 57 48 81 EC C0 00 00 00 80 3d ?? ?? ?? ?? 00 0f 85 ?? 00 00 00 48"]; + private static readonly string[] GameAssemblySodiumIntegrityFuncPatched = ["b0 01 c3 90 90 54 41 55 41 56 41 57 48 81 EC C0 00 00 00 80 3d ?? ?? ?? ?? 00 0f 85 ?? 00 00 00 48"]; private static readonly string[] GameAssemblySodiumIntegrityFuncPatch = ["b0 01 c3 90 90"]; private const string HostsStartMarker = "# begin ServerSelector entries"; private const string HostsEndMarker = "# end ServerSelector entries"; @@ -167,6 +168,12 @@ namespace ServerSelector File.Delete(backupPath); } + if (PatchUtility.CanFindOffset(dll, GameAssemblySodiumIntegrityFuncPatched)) + { + // already patched + return true; + } + // patch assembly return PatchUtility.SearchAndReplace(dll, GameAssemblySodiumIntegrityFuncHint, GameAssemblySodiumIntegrityFuncPatch); }