Esempio n. 1
0
        public static bool FindLocation(ref int x, ref int y, ref int z, ref int facet)
        {
            LocationPointer locationPointer = Client.LocationPointer;
            ProcessStream   processStream   = Client.ProcessStream;

            if (processStream == null || locationPointer == null)
            {
                return(false);
            }
            processStream.BeginAccess();
            if (locationPointer.PointerX > 0)
            {
                processStream.Seek((long)locationPointer.PointerX, SeekOrigin.Begin);
                x = Client.Read(processStream, locationPointer.SizeX);
            }
            if (locationPointer.PointerY > 0)
            {
                processStream.Seek((long)locationPointer.PointerY, SeekOrigin.Begin);
                y = Client.Read(processStream, locationPointer.SizeY);
            }
            if (locationPointer.PointerZ > 0)
            {
                processStream.Seek((long)locationPointer.PointerZ, SeekOrigin.Begin);
                z = Client.Read(processStream, locationPointer.SizeZ);
            }
            if (locationPointer.PointerF > 0)
            {
                processStream.Seek((long)locationPointer.PointerF, SeekOrigin.Begin);
                facet = Client.Read(processStream, locationPointer.SizeF);
            }
            processStream.EndAccess();
            return(true);
        }
Esempio n. 2
0
        public static void Calibrate(int x, int y, int z)
        {
            Client.m_LocationPointer = (LocationPointer)null;
            ProcessStream processStream = Client.ProcessStream;

            if (processStream == null)
            {
                return;
            }
            byte[] buffer = new byte[12]
            {
                (byte)z,
                (byte)(z >> 8),
                (byte)(z >> 16),
                (byte)(z >> 24),
                (byte)y,
                (byte)(y >> 8),
                (byte)(y >> 16),
                (byte)(y >> 24),
                (byte)x,
                (byte)(x >> 8),
                (byte)(x >> 16),
                (byte)(x >> 24)
            };
            int ptrZ = Client.Search(processStream, buffer);

            if (ptrZ == 0)
            {
                return;
            }
            Client.m_LocationPointer = new LocationPointer(ptrZ + 8, ptrZ + 4, ptrZ, 0, 4, 4, 4, 0);
        }
Esempio n. 3
0
        /// <summary>
        /// Attempts to automatically calibrate the <see cref="FindLocation" /> method.
        /// </summary>
        /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
        public static void Calibrate(CalibrationInfo[] info)
        {
            m_LocationPointer = null;

            ProcessStream pc = ProcessStream;

            if (pc == null)
            {
                return;
            }

            int ptrX = 0, sizeX = 0;
            int ptrY = 0, sizeY = 0;
            int ptrZ = 0, sizeZ = 0;
            int ptrF = 0, sizeF = 0;

            for (int i = 0; i < info.Length; ++i)
            {
                CalibrationInfo ci = info[i];

                int ptr = Search(pc, ci.Mask, ci.Vals);

                if (ptr == 0)
                {
                    continue;
                }

                if (ptrX == 0 && ci.DetX.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetX, out ptrX, out sizeX);
                }

                if (ptrY == 0 && ci.DetY.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetY, out ptrY, out sizeY);
                }

                if (ptrZ == 0 && ci.DetZ.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetZ, out ptrZ, out sizeZ);
                }

                if (ptrF == 0 && ci.DetF.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetF, out ptrF, out sizeF);
                }

                if (ptrX != 0 && ptrY != 0 && ptrZ != 0 && ptrF != 0)
                {
                    break;
                }
            }

            if (ptrX != 0 || ptrY != 0 || ptrZ != 0 || ptrF != 0)
            {
                m_LocationPointer = new LocationPointer(ptrX, ptrY, ptrZ, ptrF, sizeX, sizeY, sizeZ, sizeF);
            }
        }
Esempio n. 4
0
        public static void Calibrate(CalibrationInfo[] info)
        {
            Client.m_LocationPointer = (LocationPointer)null;
            ProcessStream processStream = Client.ProcessStream;

            if (processStream == null)
            {
                return;
            }
            int coordPointer1 = 0;
            int coordSize1    = 0;
            int coordPointer2 = 0;
            int coordSize2    = 0;
            int coordPointer3 = 0;
            int coordSize3    = 0;
            int coordPointer4 = 0;
            int coordSize4    = 0;

            for (int index = 0; index < info.Length; ++index)
            {
                CalibrationInfo calibrationInfo = info[index];
                int             ptr             = Client.Search(processStream, calibrationInfo.Mask, calibrationInfo.Vals);
                if (ptr != 0)
                {
                    if (coordPointer1 == 0 && calibrationInfo.DetX.Length > 0)
                    {
                        Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetX, out coordPointer1, out coordSize1);
                    }
                    if (coordPointer2 == 0 && calibrationInfo.DetY.Length > 0)
                    {
                        Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetY, out coordPointer2, out coordSize2);
                    }
                    if (coordPointer3 == 0 && calibrationInfo.DetZ.Length > 0)
                    {
                        Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetZ, out coordPointer3, out coordSize3);
                    }
                    if (coordPointer4 == 0 && calibrationInfo.DetF.Length > 0)
                    {
                        Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetF, out coordPointer4, out coordSize4);
                    }
                    if (coordPointer1 != 0 && coordPointer2 != 0 && (coordPointer3 != 0 && coordPointer4 != 0))
                    {
                        break;
                    }
                }
            }
            if (coordPointer1 == 0 && coordPointer2 == 0 && (coordPointer3 == 0 && coordPointer4 == 0))
            {
                return;
            }
            Client.m_LocationPointer = new LocationPointer(coordPointer1, coordPointer2, coordPointer3, coordPointer4, coordSize1, coordSize2, coordSize3, coordSize4);
        }
Esempio n. 5
0
        /// <summary>
        /// Reads the current <paramref name="x" />, <paramref name="y" />, and <paramref name="z" /> from memory based on a <see cref="Calibrate">calibrated memory location</see>.
        /// <seealso cref="Calibrate" />
        /// <seealso cref="ProcessStream" />
        /// <returns>True if the location was found, false if not</returns>
        /// </summary>
        public static bool FindLocation(ref int x, ref int y, ref int z, ref int facet)
        {
            LocationPointer lp = LocationPointer;
            ProcessStream   pc = ProcessStream;

            if (pc == null || lp == null)
            {
                return(false);
            }

            pc.BeginAccess();

            if (lp.PointerX > 0)
            {
                pc.Seek(lp.PointerX, SeekOrigin.Begin);
                x = Read(pc, lp.SizeX);
            }

            if (lp.PointerY > 0)
            {
                pc.Seek(lp.PointerY, SeekOrigin.Begin);
                y = Read(pc, lp.SizeY);
            }

            if (lp.PointerZ > 0)
            {
                pc.Seek(lp.PointerZ, SeekOrigin.Begin);
                z = Read(pc, lp.SizeZ);
            }

            if (lp.PointerF > 0)
            {
                pc.Seek(lp.PointerF, SeekOrigin.Begin);
                facet = Read(pc, lp.SizeF);
            }

            pc.EndAccess();

            return(true);
        }
Esempio n. 6
0
        /// <summary>
        /// Attempts to calibrate the <see cref="FindLocation" /> method based on an input <paramref name="x" />, <paramref name="y" />, and <paramref name="z" />.
        /// <seealso cref="FindLocation" />
        /// <seealso cref="ProcessStream" />
        /// </summary>
        /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
        public static void Calibrate(int x, int y, int z)
        {
            m_LocationPointer = null;

            ProcessStream pc = ProcessStream;

            if (pc == null)
            {
                return;
            }

            byte[] buffer = new byte[12];

            buffer[0] = (byte)z;
            buffer[1] = (byte)(z >> 8);
            buffer[2] = (byte)(z >> 16);
            buffer[3] = (byte)(z >> 24);

            buffer[4] = (byte)y;
            buffer[5] = (byte)(y >> 8);
            buffer[6] = (byte)(y >> 16);
            buffer[7] = (byte)(y >> 24);

            buffer[8]  = (byte)x;
            buffer[9]  = (byte)(x >> 8);
            buffer[10] = (byte)(x >> 16);
            buffer[11] = (byte)(x >> 24);

            int ptr = Search(pc, buffer);

            if (ptr == 0)
            {
                return;
            }

            m_LocationPointer = new LocationPointer(ptr + 8, ptr + 4, ptr, 0, 4, 4, 4, 0);
        }
Esempio n. 7
0
        /// <summary>
        ///     Attempts to automatically calibrate the <see cref="FindLocation" /> method.
        /// </summary>
        /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
        public static void Calibrate(CalibrationInfo[] info)
        {
            m_LocationPointer = null;

            ProcessStream pc = ProcessStream;

            if (pc == null)
            {
                return;
            }

            int ptrX = 0, sizeX = 0;
            int ptrY = 0, sizeY = 0;
            int ptrZ = 0, sizeZ = 0;
            int ptrF = 0, sizeF = 0;

            for (int i = 0; i < info.Length; ++i)
            {
                CalibrationInfo ci = info[i];

                int ptr = Search(pc, ci.Mask, ci.Vals);

                if (ptr == 0)
                {
                    continue;
                }

                if (ptrX == 0 && ci.DetX.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetX, out ptrX, out sizeX);
                }

                if (ptrY == 0 && ci.DetY.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetY, out ptrY, out sizeY);
                }

                if (ptrZ == 0 && ci.DetZ.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetZ, out ptrZ, out sizeZ);
                }

                if (ptrF == 0 && ci.DetF.Length > 0)
                {
                    GetCoordDetails(pc, ptr, ci.DetF, out ptrF, out sizeF);
                }

                if (ptrX != 0 && ptrY != 0 && ptrZ != 0 && ptrF != 0)
                {
                    break;
                }
            }

            if (ptrX != 0 || ptrY != 0 || ptrZ != 0 || ptrF != 0)
            {
                m_LocationPointer = new LocationPointer(ptrX, ptrY, ptrZ, ptrF, sizeX, sizeY, sizeZ, sizeF);
            }
        }
Esempio n. 8
0
        /// <summary>
        ///     Attempts to calibrate the <see cref="FindLocation" /> method based on an input <paramref name="x" />,
        ///     <paramref
        ///         name="y" />
        ///     , and <paramref name="z" />.
        ///     <seealso cref="FindLocation" />
        ///     <seealso cref="ProcessStream" />
        /// </summary>
        /// <returns>The calibrated memory location -or- 0 if it could not be found.</returns>
        public static void Calibrate(int x, int y, int z)
        {
            m_LocationPointer = null;

            ProcessStream pc = ProcessStream;

            if (pc == null)
            {
                return;
            }

            var buffer = new byte[12];

            buffer[0] = (byte)z;
            buffer[1] = (byte)(z >> 8);
            buffer[2] = (byte)(z >> 16);
            buffer[3] = (byte)(z >> 24);

            buffer[4] = (byte)y;
            buffer[5] = (byte)(y >> 8);
            buffer[6] = (byte)(y >> 16);
            buffer[7] = (byte)(y >> 24);

            buffer[8] = (byte)x;
            buffer[9] = (byte)(x >> 8);
            buffer[10] = (byte)(x >> 16);
            buffer[11] = (byte)(x >> 24);

            int ptr = Search(pc, buffer);

            if (ptr == 0)
            {
                return;
            }

            m_LocationPointer = new LocationPointer(ptr + 8, ptr + 4, ptr, 0, 4, 4, 4, 0);
        }
 public static void Calibrate(CalibrationInfo[] info)
 {
     Client.m_LocationPointer = (LocationPointer) null;
       ProcessStream processStream = Client.ProcessStream;
       if (processStream == null)
     return;
       int coordPointer1 = 0;
       int coordSize1 = 0;
       int coordPointer2 = 0;
       int coordSize2 = 0;
       int coordPointer3 = 0;
       int coordSize3 = 0;
       int coordPointer4 = 0;
       int coordSize4 = 0;
       for (int index = 0; index < info.Length; ++index)
       {
     CalibrationInfo calibrationInfo = info[index];
     int ptr = Client.Search(processStream, calibrationInfo.Mask, calibrationInfo.Vals);
     if (ptr != 0)
     {
       if (coordPointer1 == 0 && calibrationInfo.DetX.Length > 0)
     Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetX, out coordPointer1, out coordSize1);
       if (coordPointer2 == 0 && calibrationInfo.DetY.Length > 0)
     Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetY, out coordPointer2, out coordSize2);
       if (coordPointer3 == 0 && calibrationInfo.DetZ.Length > 0)
     Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetZ, out coordPointer3, out coordSize3);
       if (coordPointer4 == 0 && calibrationInfo.DetF.Length > 0)
     Client.GetCoordDetails(processStream, ptr, calibrationInfo.DetF, out coordPointer4, out coordSize4);
       if (coordPointer1 != 0 && coordPointer2 != 0 && (coordPointer3 != 0 && coordPointer4 != 0))
     break;
     }
       }
       if (coordPointer1 == 0 && coordPointer2 == 0 && (coordPointer3 == 0 && coordPointer4 == 0))
     return;
       Client.m_LocationPointer = new LocationPointer(coordPointer1, coordPointer2, coordPointer3, coordPointer4, coordSize1, coordSize2, coordSize3, coordSize4);
 }
 public static void Calibrate(int x, int y, int z)
 {
     Client.m_LocationPointer = (LocationPointer) null;
       ProcessStream processStream = Client.ProcessStream;
       if (processStream == null)
     return;
       byte[] buffer = new byte[12]
       {
     (byte) z,
     (byte) (z >> 8),
     (byte) (z >> 16),
     (byte) (z >> 24),
     (byte) y,
     (byte) (y >> 8),
     (byte) (y >> 16),
     (byte) (y >> 24),
     (byte) x,
     (byte) (x >> 8),
     (byte) (x >> 16),
     (byte) (x >> 24)
       };
       int ptrZ = Client.Search(processStream, buffer);
       if (ptrZ == 0)
     return;
       Client.m_LocationPointer = new LocationPointer(ptrZ + 8, ptrZ + 4, ptrZ, 0, 4, 4, 4, 0);
 }