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); }
public static int Search(ProcessStream pc, byte[] mask, byte[] values) { if (mask.Length != values.Length) { // TODO: maybe we need better exception here? throw new Exception(); } const int chunkSize = 4096; int readSize = chunkSize + mask.Length; pc.BeginAccess(); var read = new byte[readSize]; for (int i = 0; ; ++i) { pc.Seek(0x400000 + (i * chunkSize), SeekOrigin.Begin); int count = pc.Read(read, 0, readSize); if (count != readSize) { break; } for (int j = 0; j < chunkSize; ++j) { bool ok = true; for (int k = 0; ok && k < mask.Length; ++k) { ok = ((read[j + k] & mask[k]) == values[k]); } if (ok) { pc.EndAccess(); return(0x400000 + (i * chunkSize) + j); } } } pc.EndAccess(); return(0); }
public static int Search(ProcessStream pc, byte[] mask, byte[] vals) { if (mask.Length != vals.Length) { throw new Exception(); } int count = 4096 + mask.Length; pc.BeginAccess(); byte[] buffer = new byte[count]; int num = 0; while (true) { pc.Seek((long)(4194304 + num * 4096), SeekOrigin.Begin); if (pc.Read(buffer, 0, count) == count) { for (int index1 = 0; index1 < 4096; ++index1) { bool flag = true; for (int index2 = 0; flag && index2 < mask.Length; ++index2) { flag = ((int)buffer[index1 + index2] & (int)mask[index2]) == (int)vals[index2]; } if (flag) { pc.EndAccess(); return(4194304 + num * 4096 + index1); } } ++num; } else { break; } } pc.EndAccess(); return(0); }
public static int Search(ProcessStream pc, byte[] buffer) { const int chunkSize = 4096; int readSize = chunkSize + buffer.Length; pc.BeginAccess(); byte[] read = new byte[readSize]; for (int i = 0;; ++i) { pc.Seek(0x400000 + (i * chunkSize), SeekOrigin.Begin); int count = pc.Read(read, 0, readSize); if (count != readSize) { break; } for (int j = 0; j < chunkSize; ++j) { bool ok = true; for (int k = 0; ok && k < buffer.Length; ++k) { ok = (buffer[k] == read[j + k]); } if (ok) { pc.EndAccess(); return(0x400000 + (i * chunkSize) + j); } } } pc.EndAccess(); return(0); }
public static int Search(ProcessStream pc, byte[] buffer) { int count = 4096 + buffer.Length; pc.BeginAccess(); byte[] buffer1 = new byte[count]; int num = 0; while (true) { pc.Seek((long)(4194304 + num * 4096), SeekOrigin.Begin); if (pc.Read(buffer1, 0, count) == count) { for (int index1 = 0; index1 < 4096; ++index1) { bool flag = true; for (int index2 = 0; flag && index2 < buffer.Length; ++index2) { flag = (int)buffer[index2] == (int)buffer1[index1 + index2]; } if (flag) { pc.EndAccess(); return(4194304 + num * 4096 + index1); } } ++num; } else { break; } } pc.EndAccess(); return(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); }