Initial commit
This commit is contained in:
63
Patches/HilePatch.cs
Normal file
63
Patches/HilePatch.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public static class HilePatch
|
||||
{
|
||||
public static void Patch()
|
||||
{
|
||||
Plugin.Log.LogInfo("Attempting hile patch");
|
||||
|
||||
HileManager man = GameObject.Find("/GameRoot/Startup/Core Systems/[CheatManager]").GetComponent<HileManager>();
|
||||
|
||||
string[] asdf = [
|
||||
"GameAssembly.dll",
|
||||
"UnityPlayer.dll",
|
||||
"WinPixEventRuntime.dll",
|
||||
"steam_api64.dll",
|
||||
"steam_api.dll",
|
||||
"d3d11.dll",
|
||||
"d3d9.dll",
|
||||
"d3d8.dll",
|
||||
"ddraw.dll",
|
||||
"dxgi.dll",
|
||||
"winhttp.dll"
|
||||
];
|
||||
man.KnownDlls = asdf;
|
||||
|
||||
Plugin.Log.LogInfo("Hile patch successful.");
|
||||
}
|
||||
|
||||
static string TargetTypeName = "BootSequence";
|
||||
static string TargetMethodName = "set_CurrentState";
|
||||
static string Description = "Add BepInEx to allowed DLLs";
|
||||
static Type targetType = AccessTools.TypeByName(TargetTypeName);
|
||||
static MethodInfo targetMethod = AccessTools.Method(targetType, TargetMethodName);
|
||||
|
||||
static bool Prepare()
|
||||
{
|
||||
if (targetMethod == null)
|
||||
{
|
||||
Plugin.Log.LogWarning($"'{Description}' disabled. The type for this patch was not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
|
||||
return true;
|
||||
}
|
||||
|
||||
static MethodBase TargetMethod()
|
||||
{
|
||||
return targetMethod;
|
||||
}
|
||||
|
||||
static void Prefix(ref BootSequence __instance)
|
||||
{
|
||||
if (GenericConfig.HilePatch.Value && __instance.CurrentState == BootSequence.BootSequenceState.RECNET_CONNECTION) Patch();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user