This repository has been archived on 2026-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2025-09-11 19:54:25 -04:00

61 lines
2.0 KiB
C#

using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using HarmonyLib;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.Config;
using UnityEngine;
namespace undead_universal_patch_il2cpp.Patches
{
[HarmonyPatch]
public class ConnectToRecNetPatchEvent
{
static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes(
PatchConfig.HilePatch,
"Hile Patch event method",
"RecNet.Core",
"ConnectToRecNet"
);
static bool Prepare() => patchResult.Success;
static MethodBase TargetMethod() => patchResult.Method;
static void Prefix()
{
if (!ServerPatchesConfig.CustomKnownDlls.Value && PatchConfig.HilePatch.Value) HilePatch.Patch();
}
}
public static class HilePatch
{
public static void Patch([Optional] string[] dlls)
{
Util.ConditionalDebug($"Patching KnownDlls with {(dlls != null ? dlls.Length : 0)} new filenames");
string[] baseDlls = [
"GameAssembly.dll",
"UnityPlayer.dll",
"WinPixEventRuntime.dll",
"steam_api64.dll",
"steam_api.dll",
"d3d11.dll",
"d3d9.dll",
"d3d8.dll",
"ddraw.dll",
"dxgi.dll",
"winhttp.dll"
];
if (dlls != null) baseDlls = baseDlls.Concat(dlls).ToArray();
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(baseDlls));
UniversalPatchPlugin.Log.LogInfo($"Hile patch succeeded: {baseDlls.Length} new KnownDlls.");
}
}
}