Radicade Public Code

This commit is contained in:
JogmansonReal
2026-10-16 23:33:13 -07:00
commit 55175acdf6
832 changed files with 363261 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
using System;
using System.Threading;
using HarmonyLib;
internal static class ConnectionGate
{
private const int WaitMilliseconds = 15000;
private static readonly ManualResetEventSlim Opened = new ManualResetEventSlim(false);
private static int _holds;
internal static void Install(Harmony harmony)
{
harmony.PatchAll(typeof(ConnectionGatePatch));
}
internal static void Open()
{
Opened.Set();
}
internal static void Hold()
{
if (Opened.IsSet) return;
var count = Interlocked.Increment(ref _holds);
RadicadeEacBypassPlugin.LogSource.LogWarning("[Patch] a server request arrived before the patch list finished; holding it until it does (hold #"
+ count + ").");
if (Opened.Wait(WaitMilliseconds)) return;
RadicadeEacBypassPlugin.LogSource.LogError("[Patch] the patch list did not finish within "
+ (WaitMilliseconds / 1000) + "s; releasing this request and every later one so the client is not held forever.");
Opened.Set();
}
}
[HarmonyPatch(typeof(BestHTTP.HTTPManager), "SendRequest", new[] { typeof(BestHTTP.HTTPRequest) })]
internal static class ConnectionGatePatch
{
[HarmonyPriority(Priority.First)]
internal static void Prefix()
{
ConnectionGate.Hold();
}
}