INTERNAL REWRITE! server configs

This commit is contained in:
2025-08-12 03:10:25 -04:00
parent 1c51b37a7c
commit 7fc0d6c5b0
23 changed files with 645 additions and 564 deletions

View File

@@ -1,36 +1,31 @@
using System;
using System.Reflection;
using System.Reflection;
using HarmonyLib;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.Config;
namespace undead_universal_patch_il2cpp.Patches
{
[HarmonyPatch]
public class RegistrationPatch
{
static bool Prepare()
{
if (!GenericConfig.RegistrationPatch.Value) return false;
static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes(
PatchConfig.RegistrationPatch,
"Registration patch (to be vetted, might not work)",
"UnityEngine.PlayerPrefs",
"GetInt"
);
Type unityEngineType = AccessTools.TypeByName("UnityEngine.PlayerPrefs");
MethodInfo getMethod = unityEngineType.GetMethod("GetInt", [typeof(string), typeof(int)]);
static bool Prepare() => patchResult.Success;
return unityEngineType != null && getMethod != null;
}
static MethodInfo TargetMethod()
{
Type tutorialManagerType = AccessTools.TypeByName("UnityEngine.PlayerPrefs");
return tutorialManagerType.GetMethod("GetInt", [ typeof(string), typeof(int) ]);
}
static MethodInfo TargetMethod() => patchResult.Method;
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");
UniversalPatchPlugin.Log.LogInfo("Detour'd IncompleteRegistration pref key");
}
}
}
}
}