forked from zombieb/undead-universal-patch-il2cpp
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Reflection;
|
|
using HarmonyLib;
|
|
using undead_universal_patch_il2cpp.Core;
|
|
|
|
namespace undead_universal_patch_il2cpp.Patches
|
|
{
|
|
[HarmonyPatch]
|
|
public class RegistrationPatch
|
|
{
|
|
static bool Prepare()
|
|
{
|
|
if (!GenericConfig.RegistrationPatch.Value) return false;
|
|
|
|
Type unityEngineType = AccessTools.TypeByName("UnityEngine.PlayerPrefs");
|
|
MethodInfo getMethod = unityEngineType.GetMethod("GetInt", [typeof(string), typeof(int)]);
|
|
|
|
return unityEngineType != null && getMethod != null;
|
|
}
|
|
|
|
static MethodInfo TargetMethod()
|
|
{
|
|
Type tutorialManagerType = AccessTools.TypeByName("UnityEngine.PlayerPrefs");
|
|
return tutorialManagerType.GetMethod("GetInt", [ typeof(string), typeof(int) ]);
|
|
}
|
|
|
|
static void Postfix(ref string key, ref int defaultValue, ref int __result)
|
|
{
|
|
if (key.StartsWith("IncompleteRegistration-"))
|
|
{
|
|
__result = 0;
|
|
Plugin.Log.LogInfo("Detour'd IncompleteRegistration pref key");
|
|
}
|
|
}
|
|
}
|
|
}
|