This summer I decided to complete the SDL 1.2 port to 3ds started by @Rikku2000 in this thread: https://gbatemp.net/threads/sdl-for-3ds.374519/
After some months studying the SDL 1.2 internals and experimenting with the Citro3D lib, here is my version of the SDL lib for 3DS. The release number starts from 0.4 because the last Rikku version was v0.3.
In my version I tried to make a clean port, so when the port is completed, will be possible to easily merge it in the official SDL release (don't know if old v1.2.15 is maintained anymore, but I hope yes).
In my version I introduced a set of custom flags and functions to handle the 3ds hw peculiarity. Refer to the following post or to the github readme for details.
I'm porting only the base SDL lib, other libs (SDL_Image, SDL_TTF, SDL_Mixer) don't need any change to be compiled for 3DS, as long as SDLlib is correctly compiled and installed in your DevkitArm toolchain. To help people to compile and install the whole set of libraries, I'll provide later a set of makefiles.
I' hope that with this well known library available for the 3ds, we will see more and more developers coding for this console.
PS: After completing the SDL 1.2 port, I'm planning to reuse the code to finish the @xerpi port of SDL 2.0. I know a lot of people prefer SDL2, but I know SDL1.2 better.
Source code: https://github.com/nop90/SDL-3DS
v0.9 - (27/07/2017)
- reduced video thread priority to avoid conflicts with ctulib threads, mainly the NDSP handler one
- fixed a crash callingSDL_SetVideoMode a secont time, caused by not releasing the scene (shader ans Rendertargets) before loading it again with the new video mode
v0.8 - (29/05/2017)
- Fixed bottom screen zoom/positioning in dual screen mode
- Changed code to maintain screen aspect ratio using SDL_FITWIDTH or SDL_FITHEIGHT custom video flags
- Aligned mouse movement area to bottom screen visible part in dual screen mode
v0.7 - (07/04/2017)
- Video code reworked - GPU freezing highly reduced (played severals SDL games for long time on old and new 3ds without freezes)
- Fixed SDL_QUIT event triggering on closing the application from Home menu
- Fixed Audio and Video Therads to not acces DSP ang GPU on app pause and app exiting (SDL_QUIT)
- Udated to use tatest DevKitPro and ctrulib
- Using latest fix on Citro3d lib ("Next" branch on github) to reduce GPU freezes
- added SDL_net. Compiling but untested
v0.6 - (22/03/2017)
- Fixed Video Fickering
- Minor tunings
v0.5 - (17/02/2017)
- Fixed Audio, Threads and Timer (by @Wenting )
- Fixed Joystick
- Added 8bpp video mode (from @Wenting)
- Minor tuning
- Moved lib installation path from portilibs/armv6k to portilibs/3ds (reinslalling please delete the old lib and the include forlder by hand)
- Fixed the makefile for compiling the pica shader file
v0.4 - (30/01/2017)
Respect to Rikku's v0.3 the video device code was completly rewritten using C3D for the final rendering. This means that there is no need to rotate the screen anymore, both top and bottom screens are supported, there are no limits to video sizes (with possibility to HW stretching the video to the 3ds screen size) and there are four available video modes (RGBA8, RGB8, RGB565, RGB5A1).
Note that the internal drawing routines aren't HW acelerated, C3DS is used only for the final blitting from the videobuffer to the HW framebuffer, allowing for HW screen scaling. So do not expect high farmerate using this lib. Maybe I'll add some optimizations to one of the next releases, but this lib is for simplify the developement on the 3ds, if you need performance there are other low level tools available.
At the moment the video part is almost completed, the input part is at 50% and the sound device is under developement (so no sound support yet)
Run make install on the provided Makefile.n3ds. This will compile the lib and instal it in the portlibs directory of your devkitarm toolchain.
To use the lib remember to declare all the libraries dependencies in you makefile ( at least -lSDL -lcitro3d -lctru , for other dependencies refer to the standard SDL 1.2 documentation).
To Do List
Retroguru games using SDL 1.2 for 3DS (closed source)
Game Engines and Emulators using SDL 1.2 for 3DS
List of Homebrews using SDL 1.2 for 3DS
Last edited by nop90,