public void Initialize(IDeviceRW device) { Device = device; InitialSeed = Device.ReadUInt32(SFMTAddressSeed); SFMTAddressIndex = SFMTAddressStart + 0x9C0; SFMT = new SFMT(InitialSeed); CurrentSeed = InitialSeed; FrameCount = 0; }
public G7GameStateSM(IDeviceRW device) : base(device) { Main.SFMTAddressSeed = 0x325A3878; // [1.2: 0x325A3878] [1.1: ??] [1.0: ???] Main.SFMTAddressStart = 0x33195B7C; // [1.2: 0x33195B88] [1.1: ???] [1.0 0x33195B7C] Main.Initialize(Device); SOS.SFMTAddressSeed = 0x30038C44; SOS.SFMTAddressStart = 0x30038C44; SOS.Initialize(Device); }
public static long FindSequenceFirst(this IDeviceRW device, byte[] seq, ulong offset, ulong length, uint scanSize = 0x10000, long pid = -1) { var end = offset + length; var hop = scanSize - (uint)seq.Length + 1; // for each check, include enough from last sequence for overlap for (var i = offset; i < end; i += hop) { var data = device.Read(i, scanSize, pid); var index = IndexOfBytes(data, seq); if (index >= 0) { return((long)i + index); } } return(-1); }
// Scan public static IEnumerable <ulong> FindSequences(this IDeviceRW device, byte[] seq, ulong offset, ulong length, uint maxScan = 0x10000, long pid = -1) { var end = offset + length; var hop = maxScan - (uint)seq.Length + 1; // for each check, include enough from last sequence for overlap for (var i = offset; i < end; i += hop) { var data = device.Read(i, maxScan, pid); var index = IndexOfBytes(data, seq); if (index < 0) { continue; } yield return(i + (ulong)index); } }
public static void WriteInt16(this IDeviceRW device, short value, ulong offset) { var data = BitConverter.GetBytes(value); device.Write(data, offset); }
public static byte ReadByte(this IDeviceRW device, ulong offset) => device.Read(offset, 1)[0];
public static short ReadInt16(this IDeviceRW device, ulong offset) { var data = device.Read(offset, 2); return(BitConverter.ToInt16(data, 0)); }
public static int ReadInt32(this IDeviceRW device, ulong offset) { var data = device.Read(offset, 4); return(BitConverter.ToInt32(data, 0)); }
public static long ReadInt64(this IDeviceRW device, ulong offset) { var data = device.Read(offset, 8); return(BitConverter.ToInt64(data, 0)); }
public static void WriteByte(this IDeviceRW device, byte value, ulong offset) => device.Write(new [] { value }, offset);
public G7GameStateUSUM(IDeviceRW device) : base(device) { Main.SFMTAddressSeed = 0x32663BF0; Main.SFMTAddressStart = 0x330D35D8; Main.Initialize(Device); }
protected G7GameState(IDeviceRW device) => Device = device;