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

As @realWinterMute said check first if you ran "make instal"

Than, with no pkg-config available for now, to reach the include file of the lib, that is in a SDL subfolder, you have two options:

1. (The clean way)

add the SDL folder in the includes of the SDL header, i.e use:
Code:
#include "SDL/SDL.h"
instead of
Code:
#include "SDL.h"

The same for SDL_mixer SDL_ttf, etc,

2. (the tricky way, the one I use)

Modify the makefile to look in for header files in the SDL subfolder. here is how I do for my homebrew

Code:
export INCLUDE   :=   $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
           $(foreach dir,$(LIBDIRS),-I$(dir)/include),$(foreach dir,$(LIBDIRS),-I$(dir)/include/SDL) \
           -I$(CURDIR)/$(BUILD)

Regarding the problem with sf2dlib on Luma, I'm not using Boot9strap yet, but haven't received report of hb of mine not working on it. Please check one of the game using sf2dlib (Retrobattle for example). If it works maybe you only need to fix something. And remember to update Citro3d to the "next" branch on github, not the Master branch.

Last thing, in sf2dlib the first two letters mean "simple fast", The firsts 's' in SDL means "fast" too, but notice that there is no 'f' following :D.

Using SDL you'll reach no more than 30FPS.
 
Last edited by nop90,

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
After hours of debug, fixed a random NDSP sound problem happening with the Cias build of the games. The video thread was randomly conflicting (about 10% of times on my n3ds) with the ctrulib code that handles the NDSP init.

It wasn't a big issue because to make sound start there was the workaround of closing and reopening the 3ds lid. But it was annoying.

I'll update the build of all my SDL games in the next days.

Now there is only one bug to fix: calling SDL_SetVideoMode a second time crashes the app.
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Fixed the SDL_SetVideoMode bug too. :)

Now I can finish this:

smw1.png
smw2.png
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Offer to help get this autotoolised and upstreamed still stands
Thanks, I'm going to upload on github the private version of the lib in the next days, so you can check what I did.

Now that every bug is fixed it's time to finalize the port.

Now I have only little time because I'm in the middle of a home moving, but from monday start my holidays and I'll have time for coding.
 
  • Like
Reactions: cearp

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
@realWinterMute

now that finally I have some free time I fixed the configure script and updated the changes to github.

But I had to us a dirty workaround bacause I wasn't able to modify the build scripts to call Picasso to compile the shader file (in the video/n3ds folder), so I added the pre compiled file in the same folder and modified the configure.in and makefile.in adding a PREBUILDOBJECTS variable to add it to the objects file list for the 3ds.

If you have some time you could help me to fix this.

Another thing to fix is to compile the other SDL lib using the configure script. Tryed with SDL_ttf and the SDL lib is recognized, but when linking the SDL_ttf lib there are problems with some ctrulib. . I'm still trying to figure out the problem, but probably there are some flags missing. Please let me know if you have some hints to solve this.

Meanwhile I'm fixing SDL_Mixer to work with ogg and mp3 files. Finished to fix Ogg music playback (there where an array of 4k char declared inside a function causing a stack overflow. Now I declared it static amd solved the problem, but the fix isn't on github yet).

Rgarding Ogg Vorbis decoding, noticed that the devkitpro 3ds portlibs on github (https://github.com/devkitPro/3ds_portlibs) use the standard version of the Tremor lib, that doesn't work for the 3ds (same stack problem I think). It should be used the low mem version that works fine.
 

realWinterMute

Well-Known Member
Member
Joined
Feb 24, 2011
Messages
117
Trophies
1
XP
558
Country
@nop90

You have a PR :P

I had a quick try with SDL_ttf after compiling & installing with my changes but it doesn't like --host=arm-none-eabi as is. Too late here now to fiddle much more tonight though.

It's possible to adjust the stack size with libctru by declaring __stacksize__ in your code

Code:
const unsigned int __stacksize__ = 64 * 1024;

will set a 64K stack (default is 32K)
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
@nop90

You have a PR :P

I had a quick try with SDL_ttf after compiling & installing with my changes but it doesn't like --host=arm-none-eabi as is. Too late here now to fiddle much more tonight though.

It's possible to adjust the stack size with libctru by declaring __stacksize__ in your code

Code:
const unsigned int __stacksize__ = 64 * 1024;

will set a 64K stack (default is 32K)

Thank you very much @realWinterMute . Looking at the script to build the pica shader I wasn't too far from the solution, but I'm not experienced in writing shell scripts and was making a lot of small mistakes.

Just submitted a small change in che configure.in script: had to move the compiling position of the pica file before the n3ds video driver c file-

About SDL_ttf, with your changes it complies without problems running it's configure script.

Now I'm going to write a makefile like the one for the portlibs to build the SDL lib and download and build the other libs. probably I'll add a makefile with a subset of the potlibs needed by the SDL libs.
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Committed a makefile to build the SDL lib with autotools and download and build the other SDL libs (SDL_ttf, SDL_mixer, SDL_image, SDL_net, SDL_audio, SDL_gfx).

The configure.in for SDL_image and SDL_gfx need to be fixed.

The script can't recognize my cross compile configuration (my pc is windows 7 64bit), so for these libs I used a preformatted makefile. Don't know if it works on a linux os.

Next week I'll add an options to build the dependancies too from the same makefile, but now I want to work on SDL2.
 
  • Like
Reactions: cearp

realWinterMute

Well-Known Member
Member
Joined
Feb 24, 2011
Messages
117
Trophies
1
XP
558
Country
Committed a makefile to build the SDL lib with autotools and download and build the other SDL libs (SDL_ttf, SDL_mixer, SDL_image, SDL_net, SDL_audio, SDL_gfx).

Actually, could you do me a favour and PR these to https://github.com/devkitPro/3ds_portlibs.

I still have a couple more things to do to get things reasonably clean with the portlibs setup - for instance that arm-none-eabi-pkg-config script should be in the portlibs bin directory & not copied around other source repos.

For now it's probably best to grab your SDL 1.2 source tree & build that first.

I'd also like to try and sort out some proper dependencies with the packages as well as have a look at which libraries are actually suited to the 3DS rather than just piling a load of partially ported and untested things in there. That'll also save you from having to deal with other dependencies.

Ideally your SDL port can get upstreamed though :) Is there any chance you can sort out a diff against https://github.com/SDL-mirror/SDL/tree/SDL-1.2 ?

The configure.in for SDL_image and SDL_gfx need to be fixed.

The script can't recognize my cross compile configuration (my pc is windows 7 64bit), so for these libs I used a preformatted makefile. Don't know if it works on a linux os.

I can have a look at sorting the configury for those soon.


Next week I'll add an options to build the dependancies too from the same makefile, but now I want to work on SDL2.

That'll be nice :)

Thanks for moving to the autotools setup btw, it's much appreciated.
 
Last edited by realWinterMute,

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Actually, could you do me a favour and PR these to https://github.com/devkitPro/3ds_portlibs.

I opened a PR where I added libmikmod (tested it thoug SDL_mixer and works fine) and changed tremor lib to the low mwmory branch. Hope this is ok for you, I'm having a lot of problem with the standard branch.

With this two changes, the portlibs makefile has all the dependecies I'm using at the moment o build the SDL libs (I'm working on adding some more).

Now I'm going to add the SDL libs but don't know if it's better to instal them in the portlibs/3ds folder with the main SDL lib or use the armv6k folder, like for the other porlibs

Ideally your SDL port can get upstreamed though :) Is there any chance you can sort out a diff against https://github.com/SDL-mirror/SDL/tree/SDL-1.2 ?

I can make a diff of the two package, but in the last versiones I maintained the code as clean as possible and I know exactly the files I changed, so I could fork the SDL reppository and send a PR with the changes. probably I'll do it next week. Now I'm with a very bad internet connection.
 
  • Like
Reactions: Joel16

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Xdqwerty @ Xdqwerty: good night