mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-22 16:37:30 -05:00
USB changes and updated de item list (#318)
* Update README.md
* Added USB functionality
* Updated readme
* Revert README.md changes
* Remove unnecessary lib dependencies
only directly referenced by injection project
* Minor clean
handle compiler/roslyn messages
* Update README.md
* added a null check and a usb-botbase-safe poke function
* Revert "Update README.md"
This reverts commit e106a62b0d.
* Created new de item list using https://github.com/berichan/NH_CreationEngine
Co-authored-by: Kurt <kaphotics@gmail.com>
This commit is contained in:
parent
93c78a15bf
commit
f0eef1a0db
File diff suppressed because it is too large
Load Diff
|
|
@ -74,5 +74,13 @@ public static class SwitchCommand
|
|||
/// <param name="count">Amount of bytes</param>
|
||||
/// <returns>Encoded command bytes</returns>
|
||||
public static byte[] PeekRaw(uint offset, int count) => Encode($"peek 0x{offset:X8} {count}", false);
|
||||
|
||||
/// <summary>
|
||||
/// (Without return) Sends the Bot <see cref="data"/> to be written to <see cref="offset"/>.
|
||||
/// </summary>
|
||||
/// <param name="offset">Address of the data</param>
|
||||
/// <param name="data">Data to write</param>
|
||||
/// <returns>Encoded command bytes</returns>
|
||||
public static byte[] PokeRaw(uint offset, byte[] data) => Encode($"poke 0x{offset:X8} 0x{string.Concat(data.Select(z => $"{z:X2}"))}", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +78,8 @@ public void Disconnect()
|
|||
if (SwDevice.IsOpen)
|
||||
{
|
||||
IUsbDevice? wholeUsbDevice = SwDevice as IUsbDevice;
|
||||
wholeUsbDevice?.ReleaseInterface(0);
|
||||
if (wholeUsbDevice != null)
|
||||
wholeUsbDevice?.ReleaseInterface(0);
|
||||
SwDevice.Close();
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +155,7 @@ public void WriteBytes(byte[] data, uint offset)
|
|||
{
|
||||
lock (_sync)
|
||||
{
|
||||
SendInternal(SwitchCommand.Poke(offset, data));
|
||||
SendInternal(SwitchCommand.PokeRaw(offset, data));
|
||||
|
||||
// give it time to push data back
|
||||
Thread.Sleep((data.Length / 256) + 100);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user