public static bool FindLocation(ref int x, ref int y, ref int z, ref int facet) { Ultima.LocationPointer locationPointer = Client.LocationPointer; System.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(System.ProcessStream pc, byte[] buffer) { int length = 4096 + (int)buffer.Length; pc.BeginAccess(); byte[] numArray = new byte[length]; int num = 0; while (true) { pc.Seek((long)(4194304 + num * 4096), SeekOrigin.Begin); if (pc.Read(numArray, 0, length) != length) { break; } for (int i = 0; i < 4096; i++) { bool flag = true; for (int j = 0; flag && j < (int)buffer.Length; j++) { flag = buffer[j] == numArray[i + j]; } if (flag) { pc.EndAccess(); return(4194304 + num * 4096 + i); } } num++; } pc.EndAccess(); return(0); }
private static void GetCoordDetails(System.ProcessStream pc, int ptr, byte[] dets, out int coordPointer, out int coordSize) { pc.Seek((long)(ptr + dets[0]), SeekOrigin.Begin); coordPointer = Client.Read(pc, (int)dets[1]); if (dets[2] < 255) { pc.Seek((long)coordPointer, SeekOrigin.Begin); coordPointer = Client.Read(pc, (int)dets[2]); } if (dets[3] < 255) { pc.Seek((long)(ptr + dets[3]), SeekOrigin.Begin); coordPointer = coordPointer + Client.Read(pc, (int)dets[4]); } coordSize = dets[5]; }
public static int Search(System.ProcessStream pc, byte[] mask, byte[] vals) { if ((int)mask.Length != (int)vals.Length) { throw new Exception(); } int length = 4096 + (int)mask.Length; pc.BeginAccess(); byte[] numArray = new byte[length]; int num = 0; while (true) { pc.Seek((long)(4194304 + num * 4096), SeekOrigin.Begin); if (pc.Read(numArray, 0, length) != length) { break; } for (int i = 0; i < 4096; i++) { bool flag = true; for (int j = 0; flag && j < (int)mask.Length; j++) { flag = (numArray[i + j] & mask[j]) == vals[j]; } if (flag) { pc.EndAccess(); return(4194304 + num * 4096 + i); } } num++; } pc.EndAccess(); return(0); }
private static void GetCoordDetails(ProcessStream pc, int ptr, byte[] dets, out int coordPointer, out int coordSize) { pc.Seek(ptr + dets[0], SeekOrigin.Begin); coordPointer = Read(pc, dets[1]); if (dets[2] < 0xFF) { pc.Seek(coordPointer, SeekOrigin.Begin); coordPointer = Read(pc, dets[2]); } if (dets[3] < 0xFF) { pc.Seek(ptr + dets[3], SeekOrigin.Begin); coordPointer += Read(pc, dets[4]); } coordSize = dets[5]; }
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[] mask, byte[] vals) { if (mask.Length != vals.Length) throw new Exception(); const int chunkSize = 4096; int readSize = chunkSize + mask.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 < mask.Length; ++k) ok = ((read[j + k] & mask[k]) == vals[k]); if (ok) { pc.EndAccess(); return 0x400000 + (i * chunkSize) + j; } } } pc.EndAccess(); return 0; }