Homebrew [Release] SDL-3DS 1.2.15 - Simple DirectMedia Layer for 3DS

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Made another little fix to maintain the screen aspect ratio when using the custom video flags SDL_FITWIDTH or SDL_FITHEIGHT.

And released a port of neopop, a NeoGeop Pocket Emulator using SDL 1.2 (release here) that I ported and compiled yesterday night in less than an hour.

This lib works really fine :lol:.
 
Last edited by nop90,

Billy Acuña

Well-Known Member
Member
Joined
Oct 10, 2015
Messages
3,126
Trophies
1
Age
31
XP
3,701
Country
Mexico
Made another little fix to maintain the screen aspect ratio when using the custom video flags SDL_FITWIDTH or SDL_FITHEIGHT.

And released a port of neopop, a NeoGeop Pocket Emulator using SDL 1.2 (release here) that I ported and compiled yesterday night in less than an hour.

This lib works really fine [emoji38].
The link sends me into the Hermes's thread :(

Edit: nvm, found it :)
 
Last edited by Billy Acuña,

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Released Sqrxz3 by retroguru, ported to 3DS using the SDL lib.

Release link in the OP or in my signature.

Happy retrogaming.
 
  • Like
Reactions: cearp
D

Deleted User

Guest
If we have this. We can now have a port of OpenTTD maybe ? This would be awesome
There is already a port of openTTD on android with SDL.
 

bennyman123abc

Well-Known Member
Member
Joined
Mar 21, 2013
Messages
920
Trophies
1
Age
22
Location
Alton, IL
XP
1,201
Country
United States

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

Changelog

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)

Installation

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).

Known Bugs

-

To Do List

- Fix mouse/stylus support
- Tune everithing

Retroguru games using SDL 1.2 for 3DS (closed source)

View attachment 84019 Hermes - Ported by @Nop90 Released at REVISION 2017, SAARBRÜCKEN (GBATemp Link)

View attachment 84021 Sqrxz3 - Ported by @Nop90 (GBATemp Link)

Emulators using SDL 1.2 for 3DS

View attachment 88517 NeoPop - Ported by @Nop90 (GBATemp Link)

List of Homebrews using SDL 1.2 for 3DS

View attachment 79229 SDLPal - Ported by @Wenting (GBATemp Link)
View attachment 79230 Meritous - Ported by @nop90 (GBATemp link)
View attachment 79314 Opentyrian - Ported by @nop90 (GBATemp link)
View attachment 79968 Xrich - Ported by @nop90 (GBATemp link)
View attachment 81578 Hex a Hop - Ported by @nop90 (GBATemp link)
View attachment 82024 Supertux Milestone 1 - Ported by @nop90 (GBATemp link)
View attachment 81392 KETM - Ported by @nop90 (wip)
View attachment 82025 Zelda 3T - Ported by @nop90 (wip)
View attachment 84052 Maze of Galious - Ported by @nop90 (GBATemp link)
View attachment 92066 Amphetamine - Ported by @nop90 (GBATemp link)
Yay! OpenTTD on 3DS is finally a possibility! Thanks for this! :D
 

bennyman123abc

Well-Known Member
Member
Joined
Mar 21, 2013
Messages
920
Trophies
1
Age
22
Location
Alton, IL
XP
1,201
Country
United States
I don't think it's posible. Not enough cpu power.
The Wii had enough CPU power for OpenTTD and the Wii only had something like a 729 MHz CPU. And that was PowerPC. The O3DS has a 268 MHz processor while the N3DS has a 804 MHz processor. If the O3DS isn't powerful enough, then the N3DS definitely is.
 
  • Like
Reactions: Pandaxclone2

Pepepuhn

Active Member
Newcomer
Joined
Sep 30, 2013
Messages
30
Trophies
0
Age
36
XP
326
Country
Germany
I can't compile it. I get the following error:
Code:
./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for ‘_XData32’
 SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
                 ^
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
I can't compile it. I get the following error:
Code:
./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for ‘_XData32’
 SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
                 ^

Are you compiling for 3ds or for Apple x11?

Dont run the configure script, use directly the makefile.n3ds
 

realWinterMute

Well-Known Member
Member
Joined
Feb 24, 2011
Messages
117
Trophies
1
XP
553
Country
Are you compiling for 3ds or for Apple x11?

Dont run the configure script, use directly the makefile.n3ds

It would be good to get this fixed and be able to use the configure script to do all this properly and get it upstreamed. It would make maintenance much easier and remove the need to modify some of the other SDL based libraries - once you have working configure and sdl-config scripts some stuff basically just works. It's also worth mentioning that running a specific makefile isn't at all an obvious way to do this.

This is why I tried to encourage you to do that from the beginning.
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
It would be good to get this fixed and be able to use the configure script to do all this properly and get it upstreamed. It would make maintenance much easier and remove the need to modify some of the other SDL based libraries - once you have working configure and sdl-config scripts some stuff basically just works. It's also worth mentioning that running a specific makefile isn't at all an obvious way to do this.

This is why I tried to encourage you to do that from the beginning.

I understand why you proposed that and I spent some of my time to learn how autotools and pkg-config work.
I'm about at 95% of the work on a private branch of the sources, to finish the work I need only to find a way to compile the shader in the automake script and fix something in the pkg-config file.

But at the moment I'm not motivated to continue. 3ds homebrew scene is almost dead, no one but me will maintain this lib and my time is very limited now.

So probably it's not worth to add the 3ds lib to the official SDL repository
 

Pepepuhn

Active Member
Newcomer
Joined
Sep 30, 2013
Messages
30
Trophies
0
Age
36
XP
326
Country
Germany
Thx, that worked.
But now I have trouble including SDL in my project:

devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/bin/ld: cannot find -lSDL
 

realWinterMute

Well-Known Member
Member
Joined
Feb 24, 2011
Messages
117
Trophies
1
XP
553
Country
I understand why you proposed that and I spent some of my time to learn how autotools and pkg-config work.
I'm about at 95% of the work on a private branch of the sources, to finish the work I need only to find a way to compile the shader in the automake script and fix something in the pkg-config file.

But at the moment I'm not motivated to continue. 3ds homebrew scene is almost dead, no one but me will maintain this lib and my time is very limited now.

So probably it's not worth to add the 3ds lib to the official SDL repository

Did you use this stuff by any chance? https://github.com/WinterMute/SDL/commit/9a9e00dfc6ba141f4bb556fc945e1e8a2aca20b5

I wouldn't mind having a go at sorting out the shader from automake if you like. I still have some experiments towards that goal kicking around somewhere but I lost interest because the port wasn't really working at the time.

I think it's worth trying to get it upstreamed rather than letting all your hard work go to waste. Even if 3DS homebrew is a bit dead atm it may well pick up in the future. Getting this out to a wider audience might even get more people to have a go.
 
  • Like
Reactions: Pandaxclone2

Pepepuhn

Active Member
Newcomer
Joined
Sep 30, 2013
Messages
30
Trophies
0
Age
36
XP
326
Country
Germany
No, I don't think I used this stuff.
The actual thing is: I recently switched to Luma3ds, but somehow my old homebrew stuff, which was written with sf2dlib doesnt work anymore with the new homebrew menu 2.0. I just get a black screen.
So I figured, updating all the libraries would be the solution. But now I see that sf2dlib is not supported anymore and I am looking for a decent simple 2d-library.
 

realWinterMute

Well-Known Member
Member
Joined
Feb 24, 2011
Messages
117
Trophies
1
XP
553
Country
Thx, that worked.
But now I have trouble including SDL in my project:

devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/bin/ld: cannot find -lSDL
No, I don't think I used this stuff.
The actual thing is: I recently switched to Luma3ds, but somehow my old homebrew stuff, which was written with sf2dlib doesnt work anymore with the new homebrew menu 2.0. I just get a black screen.
So I figured, updating all the libraries would be the solution. But now I see that sf2dlib is not supported anymore and I am looking for a decent simple 2d-library.

Sorry for the confusion, I was replying to @nop90 there, that isn't related to your issue.

If you're using a standard devkitPro 3ds template (or something based on one) then you can just add $(PORTLIBS) to the LIBDIRS line here https://github.com/devkitPro/3ds-examples/blob/master/templates/application/Makefile#L59. Make sure you ran `make -f makefile.n3ds install` after building SDL though.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • ZeroT21 @ ZeroT21:
    it wasn't a question, it was fact
  • BigOnYa @ BigOnYa:
    He said he had 3 different doctors apt this week, so he prob there. Something about gerbal extraction, I don't know.
    +1
  • ZeroT21 @ ZeroT21:
    bored, guess i'll spread more democracy
  • LeoTCK @ LeoTCK:
    @K3Nv2 one more time you say such bs to @BakerMan and I'll smack you across the whole planet
  • K3Nv2 @ K3Nv2:
    Make sure you smack my booty daddy
    +1
  • LeoTCK @ LeoTCK:
    telling him that my partner is luke...does he look like someone with such big ne
    eds?
  • LeoTCK @ LeoTCK:
    do you really think I could stand living with someone like luke?
  • LeoTCK @ LeoTCK:
    I suppose luke has "special needs" but he's not my partner, did you just say that to piss me off again?
  • LeoTCK @ LeoTCK:
    besides I had bigger worries today
  • LeoTCK @ LeoTCK:
    but what do you know about that, you won't believe me anyways
  • K3Nv2 @ K3Nv2:
    @BigOnYa can answer that
  • BigOnYa @ BigOnYa:
    BigOnYa already left the chat
  • K3Nv2 @ K3Nv2:
    Biginya
  • BigOnYa @ BigOnYa:
    Auto correct got me, I'm on my tablet, i need to turn that shit off
  • K3Nv2 @ K3Nv2:
    With other tabs open you perv
  • BigOnYa @ BigOnYa:
    I'm actually in my shed, bout to cut 2-3 acres of grass, my back yard.
  • K3Nv2 @ K3Nv2:
    I use to have a guy for that thanks richard
  • BigOnYa @ BigOnYa:
    I use my tablet to stream to a bluetooth speaker when in shed. iHeartRadio, FlyNation
  • K3Nv2 @ K3Nv2:
    While the victims are being buried
  • K3Nv2 @ K3Nv2:
    Grave shovel
  • BigOnYa @ BigOnYa:
    Nuh those goto the edge of the property (maybe just on the other side of)
  • K3Nv2 @ K3Nv2:
    On the neighbors side
    +1
  • BigOnYa @ BigOnYa:
    Yup, by the weird smelly green bushy looking plants.
    K3Nv2 @ K3Nv2: https://www.the-sun.com/news/10907833/self-checkout-complaints-new-target-dollar-general-policies...