示例#1
0
        public static bool Patch(ProcessManager process)
        {
            // try to load the offsets for this build
            if (!OffsetStore.TryGetOffset(process.Build, out var offsets))
            {
                return(false);
            }

            // check executable exists
            if (!File.Exists(process.ProcessPath))
            {
                return(false);
            }

            var patches = (PatchType[])Enum.GetValues(typeof(PatchType));

            foreach (var patch in patches)
            {
                if (!Patch(process.ProcessPath, patch, offsets))
                {
                    return(false);
                }
            }

            return(true);
        }
示例#2
0
        public CameraStatus LoadOffsets()
        {
            Loaded = Activated = false;

            // try to load the offsets for this build
            if (!OffsetStore.TryGetOffset(Process.Build, out Offsets))
            {
                return(CameraStatus.BuildNotFound);
            }

            // try to read the camera pointer
            if ((CameraPtr = Process.ReadPointer(Offsets.CurWorldFrame, Offsets.CameraOffset)) <= 0)
            {
                return(CameraStatus.CameraNotFound);
            }

            // push the pointer to the start of the fields
            CameraPtr += Offsets.CameraFieldOffset;

            try
            {
                // check the pointer isn't pointing an invalid region or not instantiated
                if (Process.Read <CSimpleCamera>(CameraPtr).Equals(default(CSimpleCamera)))
                {
                    return(CameraStatus.CameraNotFound);
                }

                // attemp to resolve the camera pattern and patch
                if (!Offsets.CalcThirdPerson.Resolve(Process))
                {
                    return(CameraStatus.PatternNotFound);
                }
            }
            catch (System.ComponentModel.Win32Exception)
            {
                return(CameraStatus.MemoryAccess);
            }

            Loaded             = true;
            DefaultRenderFlags = GetRenderFlags();
            DisableFreeMove();
            DisableFarclip();

            return(CameraStatus.OK);
        }