36 lines
1,017 B
C#
36 lines
1,017 B
C#
using System.Reflection;
|
|
using HarmonyLib;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
[InitializeOnLoad]
|
|
public static class VRCFAllowRootFeatures
|
|
{
|
|
static VRCFAllowRootFeatures()
|
|
{
|
|
var harmony = new Harmony("gay.lilyy.VRCFAllowRootFeatures");
|
|
var avatarHookType = AccessTools.TypeByName("VF.Hooks.VRCFuryAvatarHook");
|
|
|
|
if (avatarHookType == null)
|
|
{
|
|
Debug.LogError("FeatureFinder type not found");
|
|
return;
|
|
}
|
|
|
|
var method = AccessTools.Method(avatarHookType, "AllowRootFeatures");
|
|
if (method == null)
|
|
{
|
|
Debug.LogError("AllowRootFeatures method not found");
|
|
return;
|
|
}
|
|
|
|
var prefix = typeof(VRCFAllowRootFeatures).GetMethod(nameof(Prefix), BindingFlags.Static | BindingFlags.NonPublic);
|
|
harmony.Patch(method, prefix: new HarmonyMethod(prefix));
|
|
}
|
|
|
|
private static bool Prefix(object gameObject, ref bool __result)
|
|
{
|
|
__result = true;
|
|
return false;
|
|
}
|
|
}
|