Arduboy + LUFA + Splatmeme Printer - Is it possible?


#1

HEY Guys !
Any body here that can make a arduboy program that print a black and white piture (320x120) in Splatoon 2 (Nintendo Switch) with this thing ?
I saw a guy “shinyquagsires” made a program for teensy 2.0++ and they say it works whit a Arduino Leonardo board, and i was thinking that arduboy aktualy is a leonardo, right ?
and they use LUFA to simulate a gamepad to auto print pixel by pixel in the post area in Splatoon.
is this doable ?
look at the links below, so you se what i mean.




Arduboy Gamepad - Map buttons to keys!
(Pharap) #2

I’ve moved this to a new topic because it makes more sense as a new topic.


The thread on GBAtemp says

This allows you to use any atmega32u4 or at90usb1286 board

So theoretically it should be possible.

And looking at the code there might be an easier way than the method they’re describing.

In particular I would have thought it would be possible to change Splatmeme-Printer/Joystick.c to an .ino file and compile it on the Arduino IDE rather than needing MinGW and a makefile.


(Pharap) #3

I had a quick attempt at this.
I managed to get it down to just two errors, with one error seemingly depending on the other.

I think I can fix it, but I’d need to know what “the frequency of the unprescaled USB controller clock” is for the Arduboy.
Then I’d have to #define F_USB as that value.

Maybe someone else will know what the correct value is.


In case anyone does know the value and I’m not around, this is the code I ended up with:

I basically squashed LUFA’s USB driver section into Splatmeme printer and changed the <> includes to "" includes.
Hopefully none of the files I deleted were important, but if they are then they can just be grabbed from LUFA.

As it was I had a hard time getting all the files to upload because GitHub has a 100 file cap for GUI uploads.


#4

Wow ! You already in to a solution on this ?
I hope some one have that value u looking for.
Im a newbee in coding, just finished the Make your own game: part 9. So im probably not to any help for ya.
But one day, im gona be a real, live, coder :joy:


(Pharap) #5

I have no idea how close I am to a solution, but it’s progress at least.
I don’t know if there will be any other issues after the F_USB problem.

Even if I get the code to compile I can’t be sure it will work,
and I can’t test it because I don’t have Splatoon 2 and I don’t own a Switch.

Fortunately I’ve narrowed it down. I believe it must be one of two values, 8000000 or 16000000.

According to the docs:

The F_USB Parameter

This parameter indicates the raw input clock frequency to the USB module within the microcontroller in Hz. This may be very different on some platforms to the main CPU clock or other peripheral/bus clocks.

Note
On AVR8 platforms, this must be equal to 8000000 or 16000000.
On XMEGA platforms, this must be equal to a multiple of 6000000 from 6000000 to 48000000.
On UC3 platforms, this must be equal to a multiple of 12000000 from 12000000 to 48000000.

And I believe ATmega32u4 is classified as AVR8 (I’m assuming that means AVR 8-bit architecture).

It seems that 8000000 corresponds to 8Mhz and 16000000 corresponds to 16Mhz.

I believe the Arduboy’s CPU clock runs at 16Mhz, but I don’t know if F_USB should match the clock speed or not.
The makefile on that page says:

F_CPU = 8000000
F_USB = $(F_CPU)

So I’m going to assume yes, in which case I’m going to try 16000000.

Programming isn’t easy, but it’s almost always worth the effort.

If you have any programming questions don’t hesitate to ask.


#6

Thx that sound greate !
And i can happely be the test pilot of this code on the switch :+1:


(Kevin) #7

Oh interesting idea, I don’t know much about the switch hardware, I guess you can plug in an external keyboard and that is what this is using?


#8

Let me know if there is some thing that i can do or help out with to make this thing work.

When i tried to compile the .ino file it complained on som missing files in jostick.h and i found them in anoter folder/post on the net.

#include “LUFA/Drivers/Board/Joystick.h”
#include “LUFA/Drivers/Board/LEDs.h”
#include “LUFA/Drivers/Board/Buttons.h”
#include “LUFA/Platform/Platform.h”

I just signed in to the GitHub, ned to read more how to upload files, if you ned them ?

exit status 1
Error compiling for board Arduino Leonardo.


(Kevin) #9

Have you tried looking around if there are some libraries specifically for the Leonardo that might work?

This might be of help.


(Pharap) #10

I’ve got it to the point where I’m getting ‘conflicting type’ errors because two of the functions are defined differently.

However there are also some errors from other undeclared symbols
It looks like a lot of the behaviour is relying on certain symbols being defined before compilation even starts.
It’s probably possible to hack Arduboy’s boards.txt file to add those symbols, but it’s probably not an ideal solution.

It’s beginning to look like there’s probably no way around using the makefile, or at least a different IDE.


(Kevin) #11

If this library I linked above works with the Switch (I’m assuming the Switch accepts standard usb joysticks, or is it a proprietary protocol and that is the problem?)


(Scott R) #12

You can find a list of supported / known working usb devices here https://switchbrew.org/wiki/List_of_compatible_USB_devices

A little off topic. I’m not that familiar with the switch I bought one at release played Zelda for a few weekends then my Arduboy arrived as it’s collected dust since. I played Beat sabre on PS4 A few weeks ago but I’ve pretty much played only Arduboy games for the past couple of years.


(Pharap) #13

I would have assumed it used a proprietary protocol for controllers because the big games companies tend to be paranoid about people hacking their devices.
But then I’ve never done any homebrew stuff (partly because a lot of the tools are aimed at Linux environments), the closest I’ve come is ROM hacking and writing emulators (for consoles much simpler than the Switch).

Unfortunately it only names them and doesn’t give much technical information.

The “Hori Pokken Tournament Pro Pad” is what the Splatmeme Printer abuses.
The USB interface has support for more buttons than are on the actual device, and from what I gather Splatmeme somehow abuses that fact to send custom data to the Switch or something like that.

Want to donate it to me so I can play Mario Odyssey and Pokemon Sword? :P