forked from zombieb/undead-universal-patch-il2cpp
48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using HarmonyLib;
|
|
using System.Reflection;
|
|
|
|
namespace undead_universal_patch_il2cpp.BasePatches
|
|
{
|
|
[HarmonyPatch]
|
|
public class ImageSignaturePatch
|
|
{
|
|
public static string TargetTypeName = "Images";
|
|
public static string TargetMethodName = "VerifySignature";
|
|
public static string Description = "Image signature patch";
|
|
public static Type targetType = AccessTools.TypeByName(TargetTypeName);
|
|
public static MethodBase targetMethod = targetType.GetMethod(TargetMethodName);
|
|
|
|
public static bool Prepare()
|
|
{
|
|
if (!GenericConfig.ImageSignaturePatch.Value) return false;
|
|
if (targetType == null)
|
|
{
|
|
Plugin.Log.LogWarning($"'{Description}' disabled. The type for this patch was not found.");
|
|
return false;
|
|
}
|
|
if (targetMethod == null)
|
|
{
|
|
Plugin.Log.LogWarning($"'{Description}' disabled. The method for this patch was not found.");
|
|
return false;
|
|
}
|
|
|
|
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
|
|
return true;
|
|
}
|
|
|
|
public static MethodBase TargetMethod() => targetMethod;
|
|
|
|
public static bool Prefix(ref bool __result)
|
|
{
|
|
Plugin.Log.LogDebug("Verified image signature");
|
|
__result = true;
|
|
return false;
|
|
}
|
|
}
|
|
}
|