Files
undead-universal-patch-il2cpp/BasePatches/HilePatch.cs
zombieb 8d1bac8201 - SignalR handshake fix
- Self-hosted PhotonSocketServer support
- Split photon and hile event patch
- Deprecated amplitude redirect patch
2025-04-13 02:11:08 -04:00

58 lines
2.0 KiB
C#

using System.Reflection;
using HarmonyLib;
using UnityEngine;
namespace undead_universal_patch_il2cpp.Patches
{
[HarmonyPatch]
public class ConnectToRecNetPatchEvent
{
static readonly string TargetTypeName = "RecNet.Core";
static readonly string TargetMethodName = "ConnectToRecNet";
static readonly string Description = "Hile Patch event method"; // It's convenient. Could patch at a different time. But this part was easy.
static readonly MethodInfo connectMethod = AccessTools.Method(AccessTools.TypeByName(TargetTypeName), TargetMethodName);
static bool Prepare()
{
if (connectMethod == null)
{
Plugin.Log.LogWarning($"'{Description}' disabled. The method for this patch was not found.");
return false;
}
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
return true;
}
static MethodBase TargetMethod() => connectMethod;
static void Prefix()
{
if (GenericConfig.HilePatch.Value) HilePatch.Patch();
}
}
public static class HilePatch
{
public static void Patch()
{
GameObject cheatManagerObject = GameObject.Find("[CheatManager]");
HileManager hileManager = cheatManagerObject.GetComponent<HileManager>();
PropertyInfo knownDllsProperty = AccessTools.Property(typeof(HileManager), "KnownDlls");
knownDllsProperty.SetValue(hileManager, new Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppStringArray([
"GameAssembly.dll",
"UnityPlayer.dll",
"WinPixEventRuntime.dll",
"steam_api64.dll",
"steam_api.dll",
"d3d11.dll",
"d3d9.dll",
"d3d8.dll",
"ddraw.dll",
"dxgi.dll",
"winhttp.dll"
]));
Plugin.Log.LogInfo("Hile patch succeeded.");
}
}
}