How to use ShinyQuagsire's Splatoon 2 Post Printer

Discussion in 'Switch - Hacking & Homebrew' started by dj505, Aug 2, 2017.

  1. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    !!! This is an outdated thread! Plese use this one instead. !!!

    Disclaimer: This is not an easy guide to use! It's not as simple as placing some files in certain spots and running "make"; there are certain things you need to install, environment variables you need to set, etc. A *lot* of troubleshooting will most likely be necessary. I'm happy to help if you need some assistance, however.


    Seeing as nobody else has made a guide like this, and I've figured out how to get it running, I figured I'd make a guide to help out. This guide is not for beginners; you'll need at least a bit of knowledge on how to add programs to your path, use the command line, etc. This is also assuming you're using Windows.

    If you have a device that uses chips like the ATMega328,
    this project will not work. You need a USB HID compatible microcontroller.

    For those who don't know, this is the post printer:
    Warning: Spoilers inside!
    It uses a Teensy 2.0++ (and possibly other microcontrollers with USB HID compatible AVRs, such as the ATMega32u4) to mimic a Hori Pokken pad for the WiiU, which now works on the Switch due to update 3.0.0 allowing more controllers to be used.

    You'll need:

    Hardware:
    - A Teensy 2.0++ (the one with the AT90USB1286)
    - A USB C male to USB female adapter like this one, brand doesn't really matter long as it works with the Switch
    - A Nintendo Switch
    - Splatoon 2

    Software:
    - Teensy Loader (Windows binary)
    - LUFA
    - Atmel AVR 8-bit and 32-bit GNU Toolchain (You'll need to create an account on the site to download)
    - The Splatoon 2 post printer, of course (Hit "Clone or download" and download a .zip)
    - If you have an ATMega32u4 board, use this repo instead for the post printer. Also, here's a much more up-to-date repo.
    - Python 2.7 (Not Python 3)
    - GIMP 2
    - MinGW (the .exe installer)

    Section 1: Preparation

    First, you'll need to get all the software installed and everything.
    1. Download the Teensy Loader
    2. Download and install Python 2.7.
    3. Download and install Atmel's AVR 8-bit Toolchain (extract this to a folder like C:\development\AVR-Toolchain or something)
    4. Download and install GIMP. (Seeing a pattern here?)
    5. Download and install MinGW. If it wants to install any addons for the program itself, say yes.
    6. Create a folder somewhere on your PC (I made mine in C:\development\SwitchFightstick)
    7. Open up the .zip file for the post printer (whould be called Switch-Fightstick-master.zip) and open the folder inside that so you can see all the files. Extract all those into the folder you made in the last step. Delete the "image.c" file since you'll be making a new one later.
    8. Open up your system PATH by hitting the windows key and searching for "Edit the system environment variables", clicking "Environment variables...", and double clicking "Path" in the bottom system variables section.
    9. Open up Windows Explorer and find the folder where you installed the AVR toolchain in step 3. Once there, find the "bin" folder and go into that. Then copy your current path by clicking the top bar, selecting it all, and hitting ctrl+C.
    10. Go back to the Path window you opened in step 7 and hit "New". Paste the directory to the toolchain's bin folder there. While you're there, also add the directory "C:\Python27" (without quotes) to make sure Python will work properly. Apply and exit. You'll also need to add C:\MinGW\bin to your path.
    11. Browse to the folder where you extracted the atual post printer, and open up the LUFA zip file. Find the folder inside the zip file titled "Build", open it, find the "LUFA" folder inside that and copy it to the same directory as the post printer
    12. If you're using an ATMega32u4 board, open the makefile in a text editor (preferably Notepad++) and replace the "MCU = at90usb1286" with "MCU = atmega32u4"
    Section 2: Preparing the image for printing
    1. Open up GIMP and hit ctrl+N to make a new canvas. Make it 320px wide and 120px tall.
    2. Paste your image onto this new canvas and resize it to fit however you want.
    3. On the top toolbar, select "Image" then hit "Mode" and select "Indexed". When the window pops up, hit "Use black and white (1 bit) pallet", and make sure dithering is set to normal. Your image should now be in just black and white, no grey or anything in between.
    4. Hit File > Export As... and export the image as "raw image data (.data)" and save it inside the post printer's folder alongside all the other files. Name it whatever you want, as long as it ends in ".data".
    5. Open up a command window and browse to the post printer's folder. Next you'll want to run the command "python bin2c.py [name of your image] > image.c". If successful, nothing will happen in the command line itself, but you should have a new file called "image.c"
    6. Run the command "make all". If you did everything correctly, it should now compile!
    Section 3: Actually running it from the Teensy

    I don't actually have my Teensy yet (ordered it last night), but I do have some experience using similar boards in the past. The following may not be 100% accurate, but it should be close enough that you can get it to work if I mistype something.
    1. Plug in your Teensy 2.0++ and open the Teensy Loader.
    2. Extract the .exe file to the post printer's directory. Don't run it.
    3. Open a command window and navigate to the post printer's directory.
    4. Run the command "teensy_loader_cli -mmcu=at90usb1286 -w Joystick.hex". If nothing happens, try pressing the button on the Teensy.
    5. Make sure your Switch is charged fully; this will take a while. Like, an hour or more. It's not very fast, but still faster than doing it by hand.
    6. Open Splatoon 2 and go over to the post box. Select the smallest pencil with L. Hold up and right until the cursor is at the very top right corner, then press left and down once each. The cursor won't look like it moved. This is because the cursor actually goes one pixel out outside the boundaries, and pusing left and down brings to exactly the corner. You can tell by pressing left or down again; it should move instead of staying still. Just put it back to the corner again.
    7. Now you should be able to unplug your Teensy, plug your USB C to USB adapter into the Switch (in handheld mode), plug in the Teensy, and go! The reason you need to do it in handheld mode is because there are sync issues when just using the dock's USB ports in docked mode.
    If I made a mistake in any portion of this guide, please correct me! The above should get it working properly, but if it doesn't I need to know what I wrote wrong and what to correct. Again, I don't actually have my Teensy board itself so I can't fully test it, but I was able to successfully do sections 1 and 2.

    Anyone who has a Teensy 2.0++ and is willing to test this, please do and let me know if it works!

    @FierceDeityLink1 and @_______ have confirmed this works with atmega32u4 boards!
     
    Last edited by dj505, Aug 25, 2017
  2. LightOffPro

    LightOffPro Member

    Newcomer
    26
    42
    Jun 10, 2016
    Portugal
    This is dope as fuck, but it's very unlikely that the average user will buy a Teensy 2.0 just for this.
    Still, very interesting concept! If i had the hardware for this, would definitely try it out.
     
    Xanthe likes this.
  3. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    I definitely did haha. It's fun messing with stuff like this. I think cheaper microcontrollers like the ATMega32u4 might work, but I don't have one and don't want to waste money on one that might not work
     
  4. _______

    _______ GBAtemp Regular

    Member
    183
    75
    May 13, 2016
    Japan
    If its pre-compiled .hex file, then no it won't work on an ATMega board.
     
  5. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Well when you actually use the makefile, you can choose your target platform by editing it. I'm sure if I were to select an ATMega32u4 or another USB HID compatible chip, it would output an appropriate file.
     
  6. dpad_5678

    dpad_5678 GBAtemp's Memelord

    Member
    1,728
    1,274
    Nov 19, 2015
    United States
    Well if we can get the SC, it would probably be port-able to Atmega32u4-based Arduino boards and clones such as the Micro/Pro Micro and Trinket. That's if it those boards are powerful enough for that.
     
  7. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    The project itself is open source, as well as the library it uses (LUFA - Lightweight USB Framework for AVRs) so it should be possible. From what I've read, LUFA should support any USB HID compatible chip to some degree
     
  8. Heran Bago

    Heran Bago Where do puyo come from?

    Member
    3,018
    441
    Nov 6, 2005
    United States
    Foggy California
    Awesome. You should cross-post this in the tutorials section.
     
  9. _______

    _______ GBAtemp Regular

    Member
    183
    75
    May 13, 2016
    Japan
    Thought it was closed as the OP mentioned .hex file. Then maybe it can, I should try it.
     
  10. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    I am the OP haha. Yeah, I guess it depends on what board you compile it for. You get a hex file for the AT90USB1286 chip, not sure about any others as I haven't tried.

    There's a tutorials section? TIL. Gonna cross post this there in the morning! Thanks for letting me know!
     
    Last edited by dj505, Aug 3, 2017
  11. _______

    _______ GBAtemp Regular

    Member
    183
    75
    May 13, 2016
    Japan
    - EDIT - Apparently this project was a fork of another project that use an atmega32u4. Things will be much easier then,
     
    Last edited by _______, Aug 3, 2017
  12. MegaMagikarp

    MegaMagikarp Newbie

    Newcomer
    7
    3
    Mar 25, 2015
    United States
    I'm glad someone with relating knowledge did a write up. I wanted to try this before but wasn't sure where to start. Couldn't find helpful example on the internet about LUFA usage. Will look into this when I get a chance. (I have a Arduino instead of teensy tho, not sure if I can get it to work)
     
  13. _______

    _______ GBAtemp Regular

    Member
    183
    75
    May 13, 2016
    Japan
    It was a forked project originally using an atmega32u4. So we should be able to get it work on an Arduino.
     
  14. Jayro

    Jayro MediCat USB and Mini Windows 10 Developer

    Member
    GBAtemp Patron
    Jayro is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    5,212
    2,851
    Jul 23, 2012
    United States
    Octo Canyon
    Pretty neat, but this is waaaaaaaaaaay too complicated for me to setup just to post a few 2 color dithered pictures. I'd rather print them out on printer paper, and trace them to the tablet.
     
    TotalInsanity4 likes this.
  15. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Ok, so it does compile for the atmega32u4 family, but you need avrdude or something to flash the resulting .hex file as the Arduino IDE won't load it. It should still work.
     
  16. _______

    _______ GBAtemp Regular

    Member
    183
    75
    May 13, 2016
    Japan
    Tho it does compile, I can't get it to work with my Arduino Leonardo r3 somehow. (Plugged onto Switch and nothing happened. Maybe might was broken, donno) Uno use atmega328p which is not supported so I can't try that.
     
  17. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Maybe there's a button or something that needs to be hit... Maybe try plugging it in then pressing the reset button?
     
  18. studio1b

    studio1b Advanced Member

    Newcomer
    58
    29
    Mar 14, 2009
    United States
    NEW YORK CITY
    wrong post
     
    Last edited by studio1b, Aug 4, 2017
  19. _______

    _______ GBAtemp Regular

    Member
    183
    75
    May 13, 2016
    Japan
    I tried those of course. I didn't read the source entirely tho, but what I can see there is you don't need to interact with it since the action was pre-coded.

    In general you can't with this project. But with LUFA library in theory you can of course.
     
  20. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    525
    120
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Ah, not sure why it's not working then. I'll be able to test it properly once my Teensy arrives, but until then I have no way to troubleshoot :/

    Edit: Are you using the dock's USB hub or a USB C to A adapter?
     
    Last edited by dj505, Aug 4, 2017