fix issue requiring game reinstall after game updates

This commit is contained in:
Mikhail
2025-05-04 14:25:07 -04:00
parent b30869953f
commit e4969c723d
3 changed files with 36 additions and 5 deletions

View File

@@ -7,9 +7,9 @@ namespace ServerSelector
{
public class ServerSwitcher
{
private static 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"];
public static bool GameAssemblyNeedsPatch = true; // Set to false if running on versions before v124
private static string[] GameAssemblySodiumIntegrityFuncPatch = ["b0 01 c3 90 90"];
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 const bool GameAssemblyNeedsPatch = true; // Set to false if running on versions before v124
private static readonly string[] GameAssemblySodiumIntegrityFuncPatch = ["b0 01 c3 90 90"];
private const string HostsStartMarker = "# begin ServerSelector entries";
private const string HostsEndMarker = "# end ServerSelector entries";
@@ -146,7 +146,7 @@ namespace ServerSelector
{
return PatchUtility.SearchAndReplace(dll, GameAssemblySodiumIntegrityFuncHint, GameAssemblySodiumIntegrityFuncPatch);
}
else if (backupExists)
else if (backupExists && !PatchUtility.CanFindOffset(dll, GameAssemblySodiumIntegrityFuncHint))
{
File.Move(dll + ".bak", dll, true);
}
@@ -210,7 +210,7 @@ namespace ServerSelector
if (!PatchGameAssembly(gameAssembly, false))
{
throw new Exception("Failed to restore GameAssembly.dll. Please repair the game in the launcher.");
supported = false;
}
if (File.Exists(launcherCertList))