PDA

View Full Version : SDL for the Nintendo DS



GPF
November 3rd, 2005, 20:44
here is the precompiled libs and header files and a couple of examples for using SDL on the DS.
http://gpf.dcemu.co.uk/files/nds/NDSSDLlibs.rar
http://gpf.dcemu.co.uk/files/nds/NDSSDLexamples.rar

The SDL port is based off of SDL 1.2.3 so some work is need to upgrade it to the latest version, still needs sound support and filesystem support.

Here is all the source code for each library. thanks to WntrMute on #dsdev for the source to libpng and zlib

http://gpf.dcemu.co.uk/files/nds/NDSSDL.rar
http://gpf.dcemu.co.uk/files/nds/NDSSDL_image.rar
http://gpf.dcemu.co.uk/files/nds/NDSlibpng-1.2.8.rar
http://gpf.dcemu.co.uk/files/nds/NDSjpeg-6b.rar
http://gpf.dcemu.co.uk/files/nds/NDSzlib-1.2.2.rar
http://gpf.dcemu.co.uk/files/nds/NDSSDL_mixer.rar
http://gpf.dcemu.co.uk/files/nds/NDSSDL_ttf.rar
http://gpf.dcemu.co.uk/files/nds/NDSfreetype.rar
http://gpf.dcemu.co.uk/files/nds/NDSSDL_flic.rar
http://gpf.dcemu.co.uk/files/nds/NDSSDL_gfx.rar
http://gpf.dcemu.co.uk/files/nds/NDSSFont.rar

also
here is a port of SDL for the gba and a couple of examples based off the .diff file found at
http://suse.osuosl.org/people/uli/SDL/SDL-1.2.3-gba.patch

http://gpf.dcemu.co.uk/files/nds/gbaSDL.rar

soccerboi00
November 4th, 2005, 22:36
awesome! can't wait for all those sdl ports for the ds.

Toroman
November 9th, 2005, 12:18
Sorry about this newbie question but ¿where do i have to put SLDlib in order to be able to compile the examples?

I'm under linux and have set the enviroment variables for devkitarm, etc but I get "SDL.h no such file or directory".

My directory tree is ~\devkitpro\
PAlib
NDSSDLexamples
nds-examples
lSDL
libnds
libmirko
libgba
devkitARM

with lSDL containing headers and libraries.

Thanks in advance!

GPF
November 10th, 2005, 21:53
The makefiles are hardcoded to look for the header files
under devkitpro\libnds\include\SDL
with -D__NDS__ -I$(NDSLIB_INCLUDE)/SDL

some of the SDL libs require the -D__NDS__ define also

you can change the include line to point to where ever the include folder is located for your setup.

Troy

LTK
December 30th, 2005, 01:59
Many thanks GPF, I hope, xmas will bringme a NintendoDS.

LTK
December 31st, 2005, 03:31
I'm testing a few samples with devkirARM 17, and I'm getting some errors, what version of devkitARM do you recomends to me, in order to get better SDL suport?

LTK
January 2nd, 2006, 01:38
Compilation errors solved, but I cant get working in 16 bbp, isnt still suported?

GPF
January 3rd, 2006, 06:01
good question its been awhile since iv looked at my code :(

If you get it working or need to make changes to SDL to get something to work go ahead and send me the code and ill update the main libs for everyone.

Iv been extermely busy lately and havent been able to do much DS coding.

Troy(GPF)

LTK
January 3rd, 2006, 10:38
I'm gonna have a look to the code, ;-)

GPF
January 3rd, 2006, 18:03
cool, yeah it was a quick port and everything is using a mode6 background at 1024X512 or 512X512 , need to have it use different background modes based on the size of screen requested and doublebuffering needs to be implemented if I remember right. Sound code is nulled out and there is no filesystem access. And optimally someone could take my changes and upport to the latest SDL version :)

Troy(GPF)

LTK
January 3rd, 2006, 19:31
As I said, I'm gona have a look at the code, but, I think itś a bit out of my sight. I would like to port my others Dc ports to Ds, but one thing that dislikes me is the 4 mb of Ram,

DSPOWER
January 6th, 2006, 13:46
My idea is that we can port some of gp32 sdl or gp2x sdl to NDS, if we do that we can have the same scene, somebody have idea to do that. The idea is to have better video player, or more homebrew. Bye.

Durandle
January 7th, 2006, 17:26
Just trying to make a really simple MJPEG player port thats basd on SDL. However, it keeps throwing :

c:/devkitPro/msys/home/Troy.Davis/prj/SDL/source/joystick/nds/SDL_sysjoystick.c:48: undefined reference to `keysInit'

at me... which doesn't make much sense...

GPF
January 8th, 2006, 01:13
newer version of the libnds dont use that function anymore, just go ahead and comment out the line and recompile the SDL lib. or use an old version of libnds :(

Ill try to update the lib for the future next time i get a chance.

Troy(GPF)

Durandle
January 8th, 2006, 18:34
I just cut the code out to get it working, thanks...

I've been working on adding file support (RWOps or whatever its called). I *thought* it would be a simple case of changing all fopen, fread, fseek and fclose to the FAT_ versions. It all compiles (apart from one line I had to comment out, but that was an error check so thought it didn't matter) and works... but I *think* its not reading any data. Its not like I'm an expert coder or anything :D

If it is just a case of changing those commands and I've just done something wrong, maybe you could see your way to doing it? Took me 10 minutes to change them... but wouldn't know if I'd screwed something up.

If your busy I understand :) Just would be nice to see a complete SDL port sometime soon... would make port stuff even easier than it already is ^_^

GPF
January 8th, 2006, 21:24
would be glad to help out and take a look at the code, send me a PM with a link to your source and ill look at it or stop by #dcemu and #mellowdsdev, I'm usually at least idling there and will get your message. Unfortunetly I don't have a gbamp or flashcard so I can't test on hardware and im not familiar with the FAT_ libraries yet. One of these days Ill setup a donation site so someone can send me a card/money for one :)

Troy(GPF)

GPF
March 2nd, 2006, 00:04
with the help of parrot on #dsdev, He's has merged the existing code into the SDL 1.2.9 branch and I wrote a new Makefile and fixed a couple things.

I will release soon, its has the same functionallity still, but lib seems smaller.

Was looking through some other OS ports of SDL's existing code and there may be a way of using interupts to play audio instead of needing a threading library on the ds , just is going to take some time to figure that out.

Troy(GPF)

GinaWrite
April 26th, 2006, 15:46
Hi,

I downloaded the precompiled files and the examples. What does this strange warning mean?

# make
rectmain.c
linking rectSDL.elf
/opt/local/devkitpro/devkitARM/bin/../lib/gcc/arm-elf/4.0.2/../../../../arm-elf/lib/thumb/interwork/libg.a(signalr.o): In function `_kill_r':
: warning:
built ... rectSDL.arm9
Nintendo DS rom tool 1.24 - Oct 27 2005 12:18:42 by Rafael Vuijk (aka DarkFader)
built ... rectSDL.nds
dsbuild 1.21 - Oct 27 2005
using default loader
built ... rectSDL.ds.gba

When I try to run the examples on my NDS, I get as far as "NDS_SetVideoMode Setting mode to ..." and it freezes at that point.

Thanks,

GPF
April 26th, 2006, 23:02
the newest version of devkitpro R18 doesnt seem to work with SDL lib. I have downgraded back to R17 for now so I can continue working.

some things I tried that at least got stuff compiled and maybe working I don't remember now
add -DNO_SIGNAL_H to your SDL lib makefile and
comment out this line
fprintf(stderr,"Setting mode %dx%d (ndsmode %d)\n", width, height,this->hidden->ndsmode);

in SDL_ndsvideo.c and rebuild the library.

Troy(GPF)

m4c0
January 6th, 2009, 12:35
Are these changes merged into SDL source tree? I've downloaded and compiled SDL 1.2.13, but I don't know how updated that code is...

Slappy
August 17th, 2009, 13:56
Hi
I tried to download SDL libs but the archive is corrupt.
Is there another mirror?

I got CRC check error on libfreetype.a, libjpeg.a and libSDL_gfx.a.

Slappy
August 17th, 2009, 16:16
Hi
I tried to download SDL libs but the archive is corrupt.
Is there another mirror?

I got CRC check error on libfreetype.a, libjpeg.a and libSDL_gfx.a.

So I had to build everything by myself :confused:

But everything was fine except this error:

d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c: In function 'NDS_VideoInit':
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:172: warning: implicit declaration of function 'powerON'
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:199: error: 'SUB_BG0_CR' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:199: error: (Each undeclared identifier is reported only once
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:199: error: for each function it appears in.)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:218: warning: implicit declaration of function 'consoleInitDefault'
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c: In function 'NDS_SetVideoMode':
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:249: error: 'BG3_CR' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:250: error: 'BG3_XDX' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:251: error: 'BG3_XDY' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:252: error: 'BG3_YDX' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:253: error: 'BG3_YDY' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:254: error: 'BG3_CX' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:255: error: 'BG3_CY' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:263: error: 'BG2_CR' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:264: error: 'BG2_XDX' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:265: error: 'BG2_XDY' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:266: error: 'BG2_YDX' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:267: error: 'BG2_YDY' undeclared (first use in this function)
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c: In function 'NDS_FlipHWSurface':
d:/uniza/nds/SDL/source/video/nds/SDL_ndsvideo.c:377: error: 'DISP_Y' undeclared (first use in this function)
make[1]: *** [SDL_ndsvideo.o] Error 1
make: *** [build] Error 2

I solved it by adding

#include "D:\uniza\devkitPro\libnds\include\nds\registers_al t.h"

to the

D:\uniza\nds\SDL\source\video\nds\SDL_ndsvideo.c

But dunno whether it is correct, maybe someone should check it.

cid_high
December 7th, 2009, 11:31
Hello,

First of all, thank you for your contribution with the SDL port. I am doing my final university project and I want to port a game made with SDL to the Nintendo DS. The problem is that this game uses the SDL_Net functionality and I think it hasn't be ported yet. I'm thinking in porting it myself, but I wanted to know if you or someone else was still interested it his project before start, or if someone knows if it has be ported somewhere else. Thank you everyone for your help.

protomank
December 11th, 2009, 15:37
Hello.

I am interested in porting a project of mine (a megaman like game engine) to Nintendo DS. As it uses SDL, I've tried to use libnds+SDL, but it fails with errors in linker error pointing that libSDL.a have no PowerON (even using the tip above). Seems like libnds 1.3 and SDL are not compatible.
(this is on linux)

So, my question is, does anyone here have a compelte libnds+SDL enviroenment?
Can you please provide me what versions of the packages are you using?
Or maybe you can create a big zip and provide me with it? :D