public static byte[] GetPokeCommand(ulong offset, byte[] data, RWMethod method, bool usb) { switch (method) { case RWMethod.Heap when !usb: return(SwitchCommand.Poke((uint)offset, data)); case RWMethod.Heap when usb: return(SwitchCommand.PokeRaw((uint)offset, data)); case RWMethod.Main: return(SwitchCommand.PokeMain(offset, data)); case RWMethod.Absolute: return(SwitchCommand.PokeAbsolute(offset, data)); default: return(SwitchCommand.Poke((uint)offset, data)); } }
public static byte[] GetPeekCommand(ulong offset, int count, RWMethod method, bool usb) { switch (method) { case RWMethod.Heap when !usb: return(SwitchCommand.Peek((uint)offset, count)); case RWMethod.Heap when usb: return(SwitchCommand.PeekRaw((uint)offset, count)); case RWMethod.Main: return(SwitchCommand.PeekMain(offset, count)); case RWMethod.Absolute: return(SwitchCommand.PeekAbsolute(offset, count)); default: return(SwitchCommand.Peek((uint)offset, count)); } }
public ulong FollowMainPointer(long[] jumps) { lock (_sync) { var cmd = SwitchCommand.FollowMainPointer(jumps); SendInternal(cmd); // give it time to push data back Thread.Sleep(1 + UI_Settings.GetThreadSleepTime()); var buffer = new byte[17]; var _ = ReadInternal(buffer); var bytes = Decoder.ConvertHexByteStringToBytes(buffer); return(BitConverter.ToUInt64(bytes, 0)); } }
public byte[] ReadBytes(uint offset, int length) { lock (_sync) { var cmd = SwitchCommand.PeekRaw(offset, length); SendInternal(cmd); // give it time to push data back Thread.Sleep((length / 256) + 100); var buffer = new byte[length]; var _ = ReadInternal(buffer); //return Decoder.ConvertHexByteStringToBytes(buffer); return(buffer); } }
public void WriteBytes(byte[] data, uint offset) { if (data.Length > MaximumTransferSize) { WriteBytesLarge(data, offset); } else { lock (_sync) { SendInternal(SwitchCommand.Poke(offset, data)); // give it time to push data back Thread.Sleep((data.Length / 256) + UI_Settings.GetThreadSleepTime()); } } }
public void WriteBytes(byte[] data, uint offset) { if (data.Length > MaximumTransferSize) { WriteBytesLarge(data, offset); } else { lock (_sync) { AndroidUSBUtils.CurrentInstance.WriteToEndpoint(SwitchCommand.PokeRaw(offset, data)); // give it time to push data back Thread.Sleep((data.Length / 256) + 100); } } }
public byte[] ReadBytes(uint offset, int length) { if (length > MaximumTransferSize) { return(ReadBytesLarge(offset, length)); } lock (_sync) { var cmd = SwitchCommand.Peek(offset, length); SendInternal(cmd); // give it time to push data back Thread.Sleep((length / 256) + UI_Settings.GetThreadSleepTime()); var buffer = new byte[(length * 2) + 1]; var _ = ReadInternal(buffer); return(Decoder.ConvertHexByteStringToBytes(buffer)); } }
public byte[] ReadBytes(uint offset, int length) { if (length > MaximumTransferSize) { return(ReadBytesLarge(offset, length)); } lock (_sync) { byte[] cmd = SwitchCommand.PeekRaw(offset, length); AndroidUSBUtils.CurrentInstance.WriteToEndpoint(cmd); // give it time to push data back Thread.Sleep((length / 256) + 100); byte[] buffer = AndroidUSBUtils.CurrentInstance.ReadEndpoint(length); return(buffer); } }