示例#1
0
        public unsafe override void OnApplicationStart()
        {
            Config.LoadConfig();

            IL2CPP_Class API2    = NET_SDK.SDK.GetClass("VRC.Core", "API");
            IL2CPP_Class Amp     = NET_SDK.SDK.GetClass("AmplitudeSDKWrapper", "AmplitudeWrapper");
            IL2CPP_Class WS      = NET_SDK.SDK.GetClass("Transmtn", "WebsocketPipeline"); //Thanks Zoey#9420 for pointing out Websockets
            var          oldhwid = VRC.Core.API.DeviceID;

            H.Patch(API2.GetProperty("DeviceID").GetGetMethod(), AccessTools.Method(typeof(Main), "DeviceID"));
            H.Patch(Amp.GetMethod("InitializeDeviceId"), AccessTools.Method(typeof(Main), "DeviceID1"));
            H.Patch(Amp.GetMethods(x => x.Name == "LogEvent" && x.GetParameterCount() == 4 && NET_SDK.IL2CPP.il2cpp_type_get_name(x.GetParameters()[2].Ptr).Equals("System.Int64")).First(), AccessTools.Method(typeof(Main), "LogEvent"));
            var original = *(IntPtr *)WS.GetMethod("ProcessPipe").Ptr;

            HookMethod((IntPtr)(&original), Marshal.GetFunctionPointerForDelegate(new Action <IntPtr, IntPtr>(ProcessPipeFix)));
            ProcessCall = Marshal.GetDelegateForFunctionPointer <ProcessFix>(original);

            if (Config.CFG.ConsolePrint)
            {
                HVHLogger.Log("Old HWID:");
                HVHLogger.Log(oldhwid);
                HVHLogger.Log("New HWID:");
                HVHLogger.Log(VRC.Core.API.DeviceID);
            }
        }
示例#2
0
        unsafe public static IL2CPP_Object ObjectIntPtrToIL2CPPObject(IntPtr obj, string klass)
        {
            IL2CPP_Class klassobj = SDK.GetClass(klass);

            if (klassobj != null)
            {
                return(ObjectIntPtrToIL2CPPObject(obj, klassobj.Ptr));
            }
            return(null);
        }
示例#3
0
        unsafe public static IntPtr Create_UnityAction(IntPtr function)
        {
            if (UnityAction == null)
            {
                UnityAction = SDK.GetClass("UnityEngine.Events.UnityAction");
            }
            if (UnityAction == null)
            {
                return(IntPtr.Zero);
            }
            var obj = IL2CPP.il2cpp_object_new(UnityAction.Ptr);
            var o   = Marshal.AllocHGlobal(8);

            *(IntPtr *)o         = function;
            *((IntPtr *)obj + 2) = function;
            *((IntPtr *)obj + 4) = IntPtr.Zero;
            *((IntPtr *)obj + 5) = o;
            return(obj);
        }
示例#4
0
        public static IL2CPP_Class GetClass(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            IL2CPP_Class klass      = null;
            var          assemblies = GetAssemblies();

            for (int i = 0; i < assemblies.Length; i++)
            {
                var asm = assemblies[i];
                klass = asm.GetClass(ptr);
                if (klass != null)
                {
                    return(klass);
                }
            }
            return(klass);
        }