Nintendo 3DS port

Hi everyone!

I was thinking about bringing SDL2 to the 3DS homebrew scene (using the DevKitPro toolchain). There is already an existing port of SDL1.2 for that same toolchain.

I have already went ahead, forked the main repo and worked on it a bit to get a feel on how much work it is going to be. So far I have taken care of the thread, timer, power and filesystem modules which mostly seem to pass the respective tests.
If anyone is interested in checking it out/contributing, you can find the fork here!

Progress might be slow as my work and studies greatly limit my free time.

Feel free to share any suggestion/feedback!

2 Likes

Ah, 3DS. I actually played mine just yesterday. It’s a great little machine and the autostereoscopic capabilities are always fun, even if they’re way too finicky in terms of angle adjustment.

Way back in 2016, when I first started my first game, I always dreamed of porting it to 3DS. Sure enough, I found that 1.2 port and added it to my master to do list… At least, to see how much I’d have to cut to make the downgrade happen.

That was five years ago now. It’s no longer the newest Nintendo system–not even the newest Nintendo handheld, if you count the Switch. The last publisher-backed release for the system was now a couple of years ago, and as far as I could tell from my thirty seconds of research just now, there are only a handful of indie titles scheduled for the system at this point.

So the question is: would there really be any interest for something like this?

Though I did find a 2021 article that indicates that the system is actually still quite well-played, ultimately it would need to be well-developed-for instead for an SDL2 port to find much use. I really kind of expected it to retain a decent-sized niche among indies who wanted to take advantage of the autostereoscopic features, or even motion control.

Long story short, let me put it this way: I, for one, would be interested in at least playing around with this, but I’m a nobody (lol). Unless you mostly want to do this for fun (which is legit!), I would make sure you can get some other developers onboard.

Now, as far as suggestions, the obvious ones that come to mind are to include additional features for stereoscopic display, motion control and mic input. I think for stereoscopic display, you have two options:

  1. Add additional parameter for some overloads (well, in C you can’t overload, so I guess new functions) of the Blit functions to set a depth parameter.
  2. Have a function that sets the depth for all blits.

I think option 2 is the better option because it has a smaller footprint in the API, because it would be easier for porting (especially if the default is zero), and because most 2D games display things in layers anyway. You would just be able to set a depth, draw all your background stuff, set another depth, draw your main stuff, set a third depth, draw all your foreground stuff.

You’ll also need to make sure you take into account the system close sensor–I don’t know how the 3DS handles it, but you may be able to detect it and generate a new SDL event type so the dev can handle it however they want. For example, on DS, Trace Memory used it for a puzzle, and New Super Mario Bros used it to play sound effects.

There are also probably a lot of other pieces of the 3DS Operating System that you could integrate, like the battery sensor and I’m not sure what else.

Hope this helps!

First of all, thank you for the reply.

I really like your ideas. I think I saw something in the service I was using for battery state (PTMU) about getting the ‘Shell state’ which I think refers to whether the console is open or closed. I also have some ideas for the microphone and motion control using their respective services.

As for why such a port when there is the Nintendo Switch out. It’s honestly just a passion project, I’m doing this for fun – the 3DS is one of my favourite consoles – and I think it can be a great experience to learn more about the console and the internals of SDL. So this is more of a fun project on the side, because I know my schedule does not allow me to work full time on it.

Hi,
I am interested in the 3DS version.
What is the current state?
V

Hi,

To be quite honest, I’ve been really caught up in work lately, haven’t really had time to give it much thought.

So far, I got these modules working: audio, filesystem, joystick, power, thread and timer. So I’m able to read inputs, monitor battery, play audio, etc.
My main hurdles right now are the lack of time and the lack of knowledge about the video module.

Not very usable right now, unless you’re looking for a UI-free music player I suppose.

Hi @Petruska!
Do I understand correctly, that all your changes are already upstream? At least, that’s the impression I get by looking at the repo in github.

Anyway, the reason why I’m writing in this thread, is that I might soon find myself in a similar position: there’s a SDL 1.2 port for the Nintendo Wii, and I’d like to update it to SDL 2 at least. I’m wondering if I should try to merge the SDL master branch into the Wii’s port branch, or if it’s better to start from a clean SDL 2 and rewrite the various Wii modules one by one (I thing that this is the road you took).

Anyway, if there are people interesting in working on a SDL2 port for the Wii, please get in touch, it would be nice to collaborate.

I would 100% recommend this path. Even discounting the concerns of moving LGPL code from SDL1 into SDL2’s zlib-licensed codebase, the internals of SDL2 are wildly different from SDL1, to the point where starting over is going to be easier than migrating the existing code.

1 Like