Follow

Dear Ruby devs and game devs. I have a crazy announcement I want to share. Please boost.

Last week I released A Dark Room to the Nintendo Switch. Within the game, I also shipped a Ruby interpreter and a code editor as an Easter Egg.

*This Easter Egg effectively turns every consumer spec-ed Nintendo Switch into a Ruby Machine.*

1. Download A Dark Room from the US/EU.
2. Connect a USB keyboard and press the “~” key.
3. Follow the onscreen instructions.

Here’s the proof. This is a Nintendo Switch, running A Dark Room, which allows you to execute Ruby code. The Ruby code in this video is a Quine that executes Ruby code.

@amirrajan nintendo developer agreement violation lawsuit in 4... 3... 2...
hackers exploiting switch trough this game in 2.. 1..
@hj @amirrajan
> hackers exploiting switch trough this game

don't they already have full unpatchable control through Nvidia Tegra BootRom?
@rin @amirrajan nintendo is said to release newer switch models so it could be patched, and current method is somewhat inconvenient.

@hj @rin stop with the knee jerk FUD. I've researched this. And again, let me worry about that. You go build cool stuff on the device. K?

@amirrajan @rin it's nintendo we're talking about. I'm not spreading FUD, but my switch got banned from all online services including e-shop for running CFW once for like 5 minutes and playing shareware DOOM on it :^)

@hj @rin friend. Take. A. Look. At. Fuze.

And again let me worry about this. You don't have to.

@hj @rin I'll take that as "I stand corrected. Sorry".

@hj @rin @amirrajan

Welp guess we saw who was right and who was wrong now.

@rin @hj @amirrajan They released a new hardware revision where this is fixed. If you buy a new switch it will be patched.

(Old switches are still unpatchable and good though 😄)

@hj there is precedence for this: take a look at Fuze: fuze.co.uk/nintendo-switch.htm

Also. Stop living in this world of fear. A kid's eyes would have lit up seeing this. And that is my intent/motivation.

PS: Let me worry about that. Go forth and create awesome crazy things.

@hj @amirrajan Well actually, you cannot do JIT on the Switch so apart if you find some bugs in the interpreter to give you read/write primitive (and a way to break ASLR), it's not going to be exploitable 🤷

And even if you get to this point, you will not have access to anything interesting from there.

@thog @hj correct. And all this runs in user land on top of it (yes, I did do an immense amount of pen testing).

And again. FUZE literally does this but with Q Basic. Go make magic happen with Ruby.

@amirrajan @hj I wonder if we could make mastodon run with that 🤔

@thog @hj I didn't expose any http methods to this Ruby runtime outside of http_get("some url") which returns plain text.

So mostly useless.

@amirrajan Holy shit that's really fucking cool! Can't wait to mess with this!

@noirscape here is the source code for some of the stuff within the game. Feel free to monkey patch as needed: github.com/amirrajan/power-ove

@amirrajan@ruby.social just tried it. one of the best easter eggs i've ever seen in a game :)

@glitch source code to help with your video game making journey: github.com/amirrajan/power-ove

I've included parts of A Dark Room source in there too so you can "mod" it.

@glitch and if you need anything else added to it, I'll throw it up there for reference.

@amirrajan the browser version is very good for time killing, my respect

@vaartis yep! The Switch version is highly tuned for "active" play. Pacing is different and there is a much much deeper narrative (since it's assumed that the player is more attentive).

There is always a non-trivial decision to make or task to do on the Switch version.

@amirrajan does the ruby interpreter have graphics and input so one could make another game inside ruby?

@amirrajan don't have a way to connect a keyboard to an undocked switch, so no video, but here's a pic!

@amirrajan ill probably play the game, too, since it looks neat, i just heard ruby interpreter + engine on the switch and got excited

@amirrajan tried "$layout.toast 2+2" and...this doesn't seem right :<

@amirrajan (that white blob in the middle DOES say 4 for the record)

@amirrajan i love a dark room already and this is just next tier as hell, omg

@amirrajan holy crap that’s awesome. I wonder if Nintendo will pull it?

@amirrajan Do you mind if I post about this on twitter or are you trying to keep it on the down low?

@debugninja keeping on the DL right now. But feel free to “carefully” spread the word

@debugninja you let me worry about that and go build awesome stuff

@amirrajan Oh my god I am downloading this the second I get home. Thank you for this!
@amirrajan this is going to get pulled off the eshop by nintendo the second they hear about it

@phoenix @amirrajan He already mentioned in the comments that he tested it thoroughly

@john @amirrajan still doesn't change the fact that he broke his agreement with nintendo, not even mentioning all the mruby rces out there

@phoenix @john and literally Also. Like... do you want to be right? Do you want this taken down? What do you gain from that? Go build cool things with it, maybe teach a kid how to code, and stop with the doom and gloom 🤷‍♂️

@amirrajan @john you misunderstand, fuze is a dedicated tool explicitly approved by nintendo, they're not sneaking in any unapproved potentially unsafe ACE. Trust me, I'm 100% for homebrew on consoles, but being in the scene for so long has turned me into a realist. I know nintendo won't like this one bit. Do you really think that some kid is going to find this easter egg in your game and decide to learn a high level programming language? If you want kids to learn to code and build things, this definitely isn't the way to do it, FUZE is a great example of how it should be done if you have to do it on a console at all. Kids should be given the freedom of a computer, not the restrictions of a game console. I don't want to be right! I want people to be able to do whatever they want on their hardware! But that's just how it is. I do have to thank you for at least trying.

@phoenix @amirrajan @john my first thought was also “oh shit this is definitely getting taken down” so i bought it from the website asap :p

@phoenix @amirrajan Welp, forget what I said... FUZE isn't even out for the switch... seems like Nintendo got rid of it? Not too sure

@phoenix @amirrajan I'm pretty sure it is sandboxed heavily... there are other programs for the switch fuze.co.uk/nintendo-switch.htm

@amirrajan
Aaaaa it does work! Thank you so much for this, I never thought I was going to be able to really do homebrew stuff on my Switch! (At least, not without screwing over my significant other who likes playing online.)
A hello world program running o…

@amirrajan holy shit lol. I’m not a programmer but I do own a switch and that’s cool as hell.

Sign in to participate in the conversation
Ruby.social

A Mastodon instance for Rubyists & friends