This is a framework that runs on Teensy 2.0++ that allows you to make automated controllers for the Switch
I put this section up front because I really appreciated all the work people had put before me to make this possible. This project is inspired by and adapted from Automatically throws snowballs in The Legend of Zelda: Breath of the Wild by emulating a controller on a Teensy++ v2.0.
Thanks to bertrandom and contributors to snowball-thrower, the code is much easier to work with. So I could make this framework possible without knowing too much about how joy-cons communicate with the Switch.
Also mentioned in snowball-thrower:
Thanks to Shiny Quagsire for his Splatoon post printer and progmem for his original discovery.
I cleaned up the code from Shiny Quagsire's printer and snowball thrower, and I took bertrandom's command structure and made it into a more generic framework.
Let's get to it!
First thing you will need is LUFA. Download the library, extract its content and rename the folder LUFA
in the project root directory.
Once you have LUFA, follow one of the instructions below to setup the environment
- Linux Users: Instructions
- MacOS Users: Instructions This is currently unavailable. If you know how to run avr-gcc on a mac, please contribute!
- Windows Users: Instructions
These instructions should contain all the links to the tools that you will need.
In this step, I will show you how to write a script from scratch. However, it might be more helpful to just look at one of the test_xxx.c
scripts. Please refer to the complete reference for details of each function. If you are already familiar with programming, especially in C, this should be very easy.
- Open
src/my_hello_world.c
and write the following
/*Include ASIS and ASIS utilities*/
#include "asis.h"
#include "asis_util.h"
/* Main Function */
void asis_sys_main(void){
//Next step goes here
}
- Now you have setup an ASIS script that does nothing. Inside
{ }
of the main function, write
uasis_sync_from_controller_menu();//This utility functions contains
//several instructions to sync
//the controller from menu
asis_d_pad(ASIS_D_PAD_RIGHT,5);//Press the D-pad right for 5 cycles
asis_wait_ms(500); //Wait for 500 ms
asis_click(ASIS_BUTTON_A); //Click the A button
asis_wait_s(1); //Wait for 1 second
uasis_home(); //Utility function to press home
- All done! This script sync the controller, then press right and A to go into settings, then press home to return to main menu! You can now follow the next steps to compile and run it.
- The name of this script is
my_hello_world
. If you used another name, it is the file name insrc
folder without.c
- Open
makefile
, Set the variableASIS_SCRIPT
to the name of your script (without .c) - In your shell, execute
make
- You can find the built binaries in
build/
- If you want to turn off the LED indication, comment out
ASIS_LED = -DLED_ENABLE
in the makefile. This will disable the LEDs when running the script. However, the LED will still flash when an overflow is detected.
You want to flash this file: build/asis_script_<YOUR SCRIPT NAME>.hex
If you are using a Teensy like me, you can find the tool and instructions on their website.