A Nintendo Switch (CFW) sys-module that allows users to remote control their Switch via local WiFi or USB, as well as read and write to a game's memory. This can be used to create bots for games and other fun automation projects.
This is a C++ rewrite of the original sys-botbase and usb-botbase with support for ACNH removed, tick-precise Pokémon Automation's controller commands added, and reduced heap use.
It is designed to be backwards compatible with existing SysBot.NET implementations, though backwards compatibility can be disabled by sending configure enableBackwardsCompat 0
or by setting g_enableBackwardsCompat
in source and building the project.
With backwards compatibility disabled, WiFi and USB connections client-side can be simplified: read and send operations can be looped while there's data available, both connections send raw data (no decoding or endian conversion needed), both expect \r\n
as a line terminator.
New structure should make the sys-module easier to maintain and extend, as well as make it easier to add new features.
- Send fast, asynchronous, tick-precise controller commands
Commands:
cqControllerState {hex-encoded controller command struct}
: Enqueues the specified controller state into the schedule queue. The command struct is a hex-encodedControllerCommand
struct. Seeinclude/controllerCommands.h
for details.cqCancel
: Cancel all pending controller commands and set the controller state back to neutral.cqReplaceOnNext
: Declare that the next command should atomically replace the entire command schedule.
This differs fromcqCancel + cqControllerState
in that the transition from the current schedule to the new command happens without returning the controller to the neutral state. Meaning if buttonA
is being held down by the existing command schedule and is replaced with a new command that also holdsA
, the buttonA
will be held throughout and never released.
Example usecase: SV sandwich making. If the current schedule is holdingA
to hold an ingredient and it needs to change directions, acqReplaceOnNext + new command
can be used to replace the path with the new path without ever releasingA
as doing so will drop the ingredient.
- Set controller state
- Simulate button press, hold, and release
- Simulate touch screen drawing
- Simulate keyboard input
- Read/write x amount bytes of consecutive memory from RAM based on:
- Absolute memory address
- Address relative to main nso base
- Address relative to heap base
- Capture current screen and return as JPG
- Added text file logging to
atmosphere/contents/43000000000B/log.txt
for debugging purposes. - It will always log on error, exception, or during/after generally important operations. More verbose logging can be enabled by sending
configure enableLogs 1
.
This project was created for the purpose of development for bot automation. The creators and maintainers of this project are not liable for any damages caused or bans received. Use at your own risk.
- Download latest release and extract into the root of your Nintendo Switch SD card.
- Open the
config.cfg
located inatmosphere/contents/43000000000B
using your favorite text editor. - Change text to
usb
if you want to connect using USB, orwifi
if you want to connect using a local TCP connection. Defaults towifi
. - Restart your Switch. If the right Joy-Con glows blue like shown, sys-botbase is installed correctly.
- Follow SysBot's usb-botbase setup guide if you want to use USB.
- Clone this repository.
- Get devkitPro.
- Run
MSys2
, usepacman -S switch-dev libnx switch-libjpeg-turbo devkitARM
. To easily update installed packages in the future, usepacman -Syu
. - Open the
.sln
with Visual Studio 2022 and build the solution. Alternatively, can runMSys2
,cd
to the cloned repository, andmake
(can optionally append-j$(nproc)
) to build the project.
- Big thank you to jakibaki for a great sys-module base to learn and work with, as well as being helpful on the ReSwitched Discord!
- Thanks to RTNX on Discord for bringing to my attention a nasty little bug that would very randomly cause RAM poking to go bad and the switch (sometimes) crashing as a result.
- Thanks to Anubis for stress testing!
- Thanks to FishGuy for the initial USB-Botbase implementation.
- Thanks to Mysticial for the tick-precise controller input template, testing, and debugging.