/// <summary> /// Writes a Vector3 to memory. /// </summary> /// <param name="v">HQMVector to write</param> /// <param name="address"> The address of the vector to write.</param> public static void WriteHQMVector(HQMVector v, int address) { int bytesWritten = 0; byte[] buffer = new byte[12]; float[] posArray = new float[] { v.X, v.Y, v.Z }; Buffer.BlockCopy(posArray, 0, buffer, 0, buffer.Length); WriteProcessMemory((int)hockeyProcessHandle, address, buffer, buffer.Length, ref bytesWritten); }
/// <summary> /// Reads a Vector3 from memory /// </summary> /// <param name="address">The address of the Vector3 to write</param> /// <returns>HQMVector </returns> public static HQMVector ReadHQMVector(int address) { int bytesRead = 0; byte[] buffer = new byte[12]; ReadProcessMemory((int)hockeyProcessHandle, address, buffer, buffer.Length, ref bytesRead); float[] posArray = new float[3]; Buffer.BlockCopy(buffer, 0, posArray, 0, buffer.Length); HQMVector v = new HQMVector(posArray[0], posArray[1], posArray[2]); return(v); }