public static void Start()
        {
            try
            {
                IL2Method method = Assemblies.a["Assembly-CSharp"].GetClass("VRC_EventDispatcherRFC").GetMethod("TriggerEvent");

                if (method == null)
                {
                    new Exception();
                }

                pTriggerEvent = IL2Ch.Patch(method, typeof(patch_EventManager).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: EventManager");
            }
            catch
            {
                ConSole.Error("Patch: EventManager");
            }
            try
            {
                IL2Method method = Assemblies.a["Assembly-CSharp"].GetClass("RoomManagerBase").GetMethod("OnConnectedToMaster");

                if (method == null)
                {
                    new Exception();
                }

                pOnConnectToMaster = IL2Ch.Patch(method, typeof(patch_EventManager).GetMethod("patch_method2", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: EventManager [JoinRoom]");
            }
            catch
            {
                ConSole.Error("Patch: EventManager [JoinRoom]");
            }
        }
Esempio n. 2
0
 public static float GetAxis(string axisName)
 {
     if (methodGetAxis == null)
     {
         methodGetAxis = Instance_Class.GetMethod("GetAxis");
         if (methodGetAxis == null)
         {
             return(default);
 internal IL2Patch(IL2Method targetMethod, IntPtr newMethod) : base(newMethod)
 {
     ptr          = newMethod;
     TargetMethod = targetMethod;
     // OriginalMethod = *(IntPtr*)TargetMethod.ptr.ToPointer();
     IL2Import.VRC_CreateHook(*(IntPtr *)targetMethod.ptr.ToPointer(), newMethod, out OriginalMethod);
     // Console.WriteLine("T1: " + ptr + " | T2: " + targetMethod.ptr + " | T3: " + OriginalMethod);
 }
Esempio n. 4
0
        public static bool Method(string name, IL2Type il2type, ref IL2Method il2method)
        {
            if (il2method == null)
            {
                il2method = il2type.GetMethod(name);
            }

            return(il2method != null);
        }
 public static double CalculateServerDeltaTime(double timeInSeconds, double previousTimeInSeconds)
 {
     if (methodCalculateServerDeltaTime == null)
     {
         methodCalculateServerDeltaTime = Instance_Class.GetMethods().First(
             x =>
             x.GetReturnType().Name == "System.Double" &&
             x.GetParameters().Length == 2
             );
         if (methodCalculateServerDeltaTime == null)
         {
             return(default);
 public static DateTime GetNetworkDateTime()
 {
     if (methodGetNetworkDateTime == null)
     {
         methodGetNetworkDateTime = Instance_Class.GetMethods().First(x => x.GetReturnType().Name == "System.DateTime");
         if (methodGetNetworkDateTime == null)
         {
             return(DateTime.Now);
         }
     }
     return(methodGetNetworkDateTime.Invoke().Unbox <DateTime>());
 }
        public static int?GetOwnerId(GameObject obj)
        {
            if (methodGetOwnerId == null)
            {
                methodGetOwnerId = Instance_Class.GetMethods().First(x => x.GetReturnType().Name == "System.Nullable<System.Int32>");
                if (methodGetOwnerId == null)
                {
                    return(null);
                }
            }

            return(methodGetOwnerId.Invoke(IntPtr.Zero, new IntPtr[] { obj.ptr })?.Unbox <int>());
        }
Esempio n. 8
0
        public static Player[] GetAllPlayers()
        {
            if (methodGetAllPlayers == null)
            {
                methodGetAllPlayers = Instance_Class.GetMethods().First(x => x.GetReturnType().Name == "VRC.Player[]" && x.HasFlag(IL2BindingFlags.METHOD_STATIC));
                if (methodGetAllPlayers == null)
                {
                    return(null);
                }
            }

            return(methodGetAllPlayers.Invoke().UnboxArray <Player>());
        }
        public static void Start()
        {
            try
            {
                IL2Method method = Assemblies.a["Assembly-CSharp"].GetClass("VRC_EventLog").GetProperties().First(x => x.GetGetMethod().GetReturnType().Name == "System.Boolean" && x.GetGetMethod().HasFlag(IL2BindingFlags.METHOD_STATIC)).GetGetMethod();
                pPatch[2] = IL2Ch.Patch(method, typeof(patch_Network).GetMethod("patch_method3", BindingFlags.Static | BindingFlags.NonPublic));

                method    = Assemblies.a["Assembly-CSharp"].GetClass("SteamNetworkingManager", "VRC.Steam").GetProperties().First(x => x.GetGetMethod().HasFlag(IL2BindingFlags.METHOD_STATIC) && x.GetGetMethod().GetReturnType().Name == "System.Boolean").GetGetMethod();
                pPatch[3] = IL2Ch.Patch(method, typeof(patch_Network).GetMethod("patch_method4", BindingFlags.Static | BindingFlags.NonPublic));
            }
            catch
            {
                ConSole.Error("Patch: Network");
            }
        }
Esempio n. 10
0
        public static float GammaToLinearSpace(float value)
        {
            if (methodGammaToLinearSpace == null)
            {
                methodGammaToLinearSpace = Instance_Class.GetMethod("GammaToLinearSpace");
                if (methodGammaToLinearSpace == null)
                {
                    return(0);
                }
            }

            IL2Object result = methodGammaToLinearSpace.Invoke(new IntPtr[] { value.MonoCast() });

            if (result == null)
            {
                return(default);
        public static void Start()
        {
            try
            {
                IL2Method method = PortalTrigger.Instance_Class.GetMethod("OnTriggerEnter");
                if (method == null)
                {
                    throw new Exception();
                }

                pPortalJoin = IL2Ch.Patch(method, typeof(patch_NoPortal).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: No Portal Join");
            }
            catch
            {
                ConSole.Error("Patch: No Portal Join");
            }
        }
Esempio n. 12
0
        public static void Start()
        {
            try
            {
                IL2Method method = Assemblies.a["Photon3Unity3D"].GetClass("EnetPeer", "ExitGames.Client.Photon").GetMethod("EnqueueOperation");
                if (method == null)
                {
                    throw new Exception();
                }

                pPhotonPeer = IL2Ch.Patch(method, typeof(patch_PhotonSerilize).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: Photon Serilize");
            }
            catch
            {
                ConSole.Error("Patch: Photon Serilize");
            }
        }
        public static void Start()
        {
            try
            {
                IL2Method method = IL2Cmds.GetAssembly("VRCSDKBase").GetClass("VRC_EventHandler", "VRC.SDKBase").GetMethod("InternalTriggerEvent");
                if (method == null)
                {
                    throw new Exception();
                }

                pGlobalEvents = IL2Ch.Patch(method, typeof(patch_GlobalEvents).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: Global Events");
            }
            catch
            {
                ConSole.Error("Patch: Global Events");
            }
        }
        public static void Start()
        {
            try
            {
                IL2Method method = Assemblies.a["VRCCore-Standalone"].GetClass("API", "VRC.Core").GetMethod("SendRequestInternal");
                if (method == null)
                {
                    throw new Exception();
                }

                pInvisMode = IL2Ch.Patch(method, typeof(patch_InvisAPI).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: InvisAPI");
            }
            catch
            {
                ConSole.Error("Patch: InvisAPI");
            }
        }
        public static void Start()
        {
            try
            {
                IL2Method method = UiAvatarList.Instance_Class.GetMethod("Update");

                if (method == null)
                {
                    new Exception();
                }

                pUpdate = IL2Ch.Patch(method, typeof(patch_AvatarTools).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: Avatar Tools");
            }
            catch
            {
                ConSole.Error("Patch: Avatar Tools");
            }
        }
        public static void Start()
        {
            IL2Method method = null;

            try
            {
                method = Assemblies.a["Assembly-CSharp"].GetClass("UserInteractMenu").GetMethod("Update");
                if (method == null)
                {
                    new Exception();
                }

                pAvatarStealer = IL2Ch.Patch(method, typeof(patch_AvatarSteal).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: Avatar Stealer");
            }
            catch
            {
                ConSole.Error("Patch: Avatar Stealer");
            }
        }
Esempio n. 17
0
        public unsafe static IntPtr CreateDelegate <T>(Delegate function, T instance, IL2Type klass = null)
        {
            if (klass == null)
            {
                klass = Instance_Class;
            }

            var obj = IL2Import.il2cpp_object_new(klass.ptr);

            if (instance == null || (typeof(T) == typeof(IntPtr) && (IntPtr)(object)instance == IntPtr.Zero))
            {
                var runtimeStaticMethod = Marshal.AllocHGlobal(8);
                *(IntPtr *)runtimeStaticMethod = function.Method.MethodHandle.GetFunctionPointer();
                *((IntPtr *)obj + 2)           = function.Method.MethodHandle.GetFunctionPointer();
                *((IntPtr *)obj + 4)           = IntPtr.Zero;
                *((IntPtr *)obj + 5)           = runtimeStaticMethod;
                return(obj);
            }

            IL2Method ctor          = klass.GetMethod(".ctor");
            GCHandle  handle1       = GCHandle.Alloc(instance);
            var       runtimeMethod = Marshal.AllocHGlobal(80);

            //methodPtr
            *((IntPtr *)runtimeMethod) = function.Method.MethodHandle.GetFunctionPointer();
            byte paramCount = (byte)(function.Method.GetParameters()?.Length ?? 0);

            //Parameter count
            *((byte *)runtimeMethod + 75) = 0; // 0 parameter_count

            //Slot (65535)
            *((byte *)runtimeMethod + 74) = 0xFF;
            *((byte *)runtimeMethod + 73) = 0xFF;

            *((IntPtr *)obj + 2) = function.Method.MethodHandle.GetFunctionPointer();
            *((IntPtr *)obj + 4) = obj;
            *((IntPtr *)obj + 5) = runtimeMethod;
            *((IntPtr *)obj + 7) = GCHandle.ToIntPtr(handle1);

            return(obj);
        }
Esempio n. 18
0
        public static void Start()
        {
            try
            {
                // ----------------- [ Update ] --------------------------- //
                IL2Method method = UdonBehaviour.Instance_Class.GetMethod("Update");

                if (method == null)
                {
                    new Exception();
                }

                pList[0] = IL2Ch.Patch(method, typeof(patch_NoUdon).GetMethod("patch_method_0", BindingFlags.Static | BindingFlags.NonPublic));

                // ----------------- [ LateUpdate ] --------------------------- //
                method = UdonBehaviour.Instance_Class.GetMethod("LateUpdate");

                if (method == null)
                {
                    new Exception();
                }

                pList[1] = IL2Ch.Patch(method, typeof(patch_NoUdon).GetMethod("patch_method_1", BindingFlags.Static | BindingFlags.NonPublic));

                // ----------------- [ FixedUpdate ] --------------------------- //
                method = UdonBehaviour.Instance_Class.GetMethod("FixedUpdate");

                if (method == null)
                {
                    new Exception();
                }

                pList[2] = IL2Ch.Patch(method, typeof(patch_NoUdon).GetMethod("patch_method_2", BindingFlags.Static | BindingFlags.NonPublic));
                ConSole.Success("Patch: NO-Udon");
            }
            catch
            {
                ConSole.Error("Patch: NO-Udon");
            }
        }
        internal static void Start()
        {
            try
            {
                IL2Method method = Assemblies.a["Assembly-CSharp"].GetClass("LocomotionInputController").GetMethod("Update");
                if (method == null)
                {
                    throw new Exception();
                }

                update = IL2Ch.Patch(method, typeof(Threads).GetMethod("patch_Control_Thread_Update", BindingFlags.Static | BindingFlags.NonPublic));
                if (update == null)
                {
                    throw new Exception();
                }

                ConSole.Debug("Is success patch #1");
            }
            catch
            {
                ConSole.Debug("Not working patch #1");
            }

            try
            {
                IL2Method method = Assemblies.a["Assembly-CSharp"].GetClass("VRCApplication").GetMethod("OnApplicationQuit");
                if (method == null)
                {
                    throw new Exception();
                }

                IL2Ch.Patch(method, typeof(BlazeManager).GetMethod("OnApplicationQuit", BindingFlags.Static | BindingFlags.NonPublic));

                ConSole.Debug("Is success patch #2 [FixFastQuit]");
            }
            catch
            {
                ConSole.Debug("Not working patch #2 [FixFastQuit]");
            }
        }
Esempio n. 20
0
        public static Object[] FindObjectsOfTypeAll(Type type)
        {
            if (methodFindObjectsOfTypeAll == null)
            {
                methodFindObjectsOfTypeAll = Instance_Class.GetMethods()
                                             .Where(x => x.Name == "FindObjectsOfTypeAll")
                                             .First(x => x.GetReturnType().Name == "UnityEngine.Object[]");
                if (methodFindObjectsOfTypeAll == null)
                {
                    return(null);
                }
            }

            IL2TypeObject typeObject = IL2GetType.IL2Typeof(type);

            if (typeObject == null)
            {
                return(null);
            }

            return(methodFindObjectsOfTypeAll.Invoke(new IntPtr[] { typeObject.ptr }).UnboxArray <Object>());
        }
 public static IL2Patch Patch(IL2Method targetPtr, MethodInfo newPtr) => new IL2Patch(targetPtr, newPtr.MethodHandle.GetFunctionPointer());
        public static void Start()
        {
            IL2Method method = VRC.Player.Instance_Class.GetMethod("OnNetworkReady");

            try
            {
                unsafe
                {
                    var    disasm      = new Disassembler(*(IntPtr *)method.ptr, 16, ArchitectureMode.x86_64, unchecked ((ulong)(*(IntPtr *)method.ptr).ToInt64()), true, Vendor.Intel);
                    var    instruction = disasm.Disassemble().First(x => x.ToString().StartsWith("jmp "));
                    IntPtr addr        = new IntPtr((long)instruction.Offset + instruction.Length + instruction.Operands[0].LvalSDWord);

                    VRC.Player.methodUpdateModeration = VRC.Player.Instance_Class.GetMethods().First(x => *(IntPtr *)x.ptr == addr);
                    if (VRC.Player.methodUpdateModeration == null)
                    {
                        throw new Exception();
                    }

                    // UpdateModeration()

                    disasm = new Disassembler(*(IntPtr *)VRC.Player.methodUpdateModeration.ptr, 0x1000, ArchitectureMode.x86_64, unchecked ((ulong)(*(IntPtr *)VRC.Player.methodUpdateModeration.ptr).ToInt64()), true, Vendor.Intel);
                    // disasm.Disassemble().ToList().ForEach(x => { Console.WriteLine(x.ToString()); });
                    var instructions = disasm.Disassemble().TakeWhile(x => x.Mnemonic != ud_mnemonic_code.UD_Iint3);

                    foreach (var instruction1 in instructions)
                    {
                        if (!instruction1.ToString().StartsWith("call "))
                        {
                            continue;
                        }

                        try
                        {
                            addr   = new IntPtr((long)instruction1.Offset + instruction1.Length + instruction1.Operands[0].LvalSDWord);
                            method = ModerationManager.Instance_Class.GetMethods().First(x => *(IntPtr *)x.ptr == addr);

                            if (method.GetParameters().Length != 1 || method.GetReturnType().Name != "System.Boolean")
                            {
                                continue;
                            }

                            if (method.GetParameters()[0].typeName != "System.String")
                            {
                                continue;
                            }

                            pAntiBlock = IL2Ch.Patch(method, typeof(patch_AntiBlock).GetMethod("patch_method", BindingFlags.Static | BindingFlags.NonPublic));
                            break;
                        }
                        catch { continue; }
                    }
                }

                foreach (var ass in BlazeSDK.Main.listAssembly)
                {
                    ConSole.Debug(ass.FullName);
                }

                if (pAntiBlock == null)
                {
                    throw new Exception();
                }

                ConSole.Success("Patch: Anti-Block");
            }
            catch
            {
                ConSole.Error("Patch: Anti-Block");
            }
        }
 public static IL2Patch Patch(IL2Method targetPtr, IntPtr newPtr) => new IL2Patch(targetPtr, newPtr);