INTERNAL REWRITE! server configs

This commit is contained in:
2025-08-12 03:10:25 -04:00
parent 1c51b37a7c
commit 7fc0d6c5b0
23 changed files with 645 additions and 564 deletions

View File

@@ -0,0 +1,44 @@
using System.Reflection;
using HarmonyLib;
using Il2CppInterop.Runtime;
using RecRoom.Async;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.CustomRecNet;
namespace undead_universal_patch_il2cpp.Patches;
[HarmonyPatch]
public class AuthenticationEventPatch
{
static PatchTypesResult patchResult = Util.PreparePatchTypes(
"RecNet AccessToken event patch",
"RecNet.Login",
"SetAccessToken"
);
static readonly PropertyInfo hasAccessTokenProperty = patchResult.Type?.GetProperty("HasAccessToken");
static bool Prepare() => Util.PostRequireTypes(patchResult, [
hasAccessTokenProperty
]).Success;
static MethodBase TargetMethod() => patchResult.Method;
private static bool RanPostActions { get; set; } = false;
static void Postfix(ref string accessToken)
{
UniversalPatchPlugin.Log.LogInfo("Intercepted AccessToken");
RecNetInteractions.AccessToken = accessToken;
if (!RanPostActions)
{
bool value = (bool)hasAccessTokenProperty.GetValue(patchResult.Type);
if (value) UniversalPatchPlugin.Log.LogInfo("Running post-authentication actions");
foreach (var action in RecNetInteractions.postAuthenticationActions)
action();
}
else RanPostActions = true;
}
}