mirror of
https://github.com/kwsch/NHSE.git
synced 2026-10-01 14:26:38 -05:00
Added support for USB-botbase (#299)
Only for player item injection at this time; no sync / toggle between modes
This commit is contained in:
@@ -9,7 +9,7 @@ namespace NHSE.Injection
|
||||
public static class SwitchCommand
|
||||
{
|
||||
private static readonly Encoding Encoder = Encoding.UTF8;
|
||||
private static byte[] Encode(string command) => Encoder.GetBytes(command + "\r\n");
|
||||
private static byte[] Encode(string command, bool addrn = true) => Encoder.GetBytes(addrn ? command + "\r\n" : command);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the virtual controller from the bot. Allows physical controllers to control manually.
|
||||
@@ -66,5 +66,13 @@ public static class SwitchCommand
|
||||
/// <param name="data">Data to write</param>
|
||||
/// <returns>Encoded command bytes</returns>
|
||||
public static byte[] Poke(uint offset, byte[] data) => Encode($"poke 0x{offset:X8} 0x{string.Concat(data.Select(z => $"{z:X2}"))}");
|
||||
|
||||
/// <summary>
|
||||
/// (Without return) Requests the Bot to send <see cref="count"/> bytes from <see cref="offset"/>.
|
||||
/// </summary>
|
||||
/// <param name="offset">Address of the data</param>
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user