PDA

View Full Version : SDL 1.2.9 for devkitpro r19



GPF
June 13th, 2006, 06:13
ok updated my sourcecode on site
http://gpf.dcemu.co.uk/ndsSDL.shtml

added doublebuffering support and fixed some errors that prevent it working with r19 using the new arm-eabi-gcc.


unfortunetly now doublebuffering is on all the time and it uses 1mb of system memory.

in video/nds/SDL_ndsvideo.c NDS_SetVideoMode function this enabled the doublebuffering


this->hidden->secondbufferallocd=1;
backBuffer=(u16*)malloc(1024*512*2);
current->pixels = backBuffer;

change to


this->hidden->secondbufferallocd=0;
//backBuffer=(u16*)malloc(1024*512*2);
current->pixels = frontBuffer;

to disable doublebuffering and recompile the lib.

if someone has a fix to this let me know. I thought that the NDS_AllocHWSurface(...) would be called and i used to have the malloc defined in there but for a couple of SDL ports they were never calling that function so i moved it into the NDS_SetVideoMode function.

Also a lot of work need to be done to allocated VRAM better, right now 8bit video uses a mode6 1024X512 background
and 16bit video uses mode5 515X512 background. So if you using a smaller screen it shouldnt need to allocate so much VRAM and the doublebuffering memory could be moved into VRAM instead of main ram.

Thanks,
Troy(GPF)

LTK
June 16th, 2006, 12:30
Great news!! are you planning to release a precompiled zip? I´m having some troubles when compiling on r19 devkit.

thanks a lot.

GPF
June 17th, 2006, 02:27
yeah eventually, ill do that.

Finally got some sound to work with SDL lib today, its occasionally sound like music even lol. Its going to need to move to use a custom arm7 binary for streaming the sound cause right now without a way from the arm9 side to know if the currently playing buffer is done or its current playing position which has to be done from the arm7 with timers and/or fifos/ipc.

Troy(GPF)

LTK
June 17th, 2006, 12:20
Amazing!! great work!

tk1
September 20th, 2006, 18:01
Hi,

I have great interest in using SDL on the DS. However, I cannot seem to figure out how to build the project (and I don't see any binaries).

There is a configure script, but that fails for multiple reasons. First, there is no README file, which it requires. Then, it cannot find gcc (since I am using devkitpro, which uses arm-eabi-gcc.exe). To solve this, I set the CC env variable to the devkitARM eabi compiler, but the script fails with "C compiler cannot create executables".

What am I missing?

I am using the latest devkitPRO (r19) with cygwin on windows.

Sektor
September 21st, 2006, 14:01
You don't need to use configure, I don't think it's setup for DS. You should be able to just run make or make -f makefile.ds.

tk1
September 21st, 2006, 18:11
Ok, I used the Makefile.ds, but it complained about missing kosstdio.h, so I downloaded the kos library, modified the makefile to see it, and tried again.

There are a lot of warnings, the most serious looked like:


src/video/nds/SDL_ndsvideo.c: In function 'NDS_CreateDevice':
src/video/nds/SDL_ndsvideo.c:138: warning: implicit declaration of function 'memset'
src/video/nds/SDL_ndsvideo.c:138: warning: incompatible implicit declaration of
built-in function 'memset'

Looking in /c/devkitPro/devkitARM/arm-eabi/include, it seems as though memset is in string.h, not stdlib.h. I added an include for string.h.

The the build failed with:


src/video/nds/SDL_ndsvideo.c: In function 'NDS_FlipHWSurface':
src/video/nds/SDL_ndsvideo.c:414: error: 'DISP_Y' undeclared (first use in this
function)

Grepping devkitpro finds DISP_Y defined in "nds/registers_alt.h". Modify SDL_ndsvideo.c to include it, and the build finally works, but with lots of warnings. Most warnings are about changing the width or signedness of method parameters.

Unfortunately, I have to go to work so I don't have time to try the lib to see if it is works.

It is interesting that I had to modify the makefile to include kosstdio.h, but I did not have to actaully link in the library. Perhaps a missing IFDEF?

GPF
September 21st, 2006, 23:07
Ok, I used the Makefile.ds, but it complained about missing kosstdio.h, so I downloaded the kos library, modified the makefile to see it, and tried again.

There are a lot of warnings, the most serious looked like:


src/video/nds/SDL_ndsvideo.c: In function 'NDS_CreateDevice':
src/video/nds/SDL_ndsvideo.c:138: warning: implicit declaration of function 'memset'
src/video/nds/SDL_ndsvideo.c:138: warning: incompatible implicit declaration of
built-in function 'memset'

Looking in /c/devkitPro/devkitARM/arm-eabi/include, it seems as though memset is in string.h, not stdlib.h. I added an include for string.h.

The the build failed with:


src/video/nds/SDL_ndsvideo.c: In function 'NDS_FlipHWSurface':
src/video/nds/SDL_ndsvideo.c:414: error: 'DISP_Y' undeclared (first use in this
function)

Grepping devkitpro finds DISP_Y defined in "nds/registers_alt.h". Modify SDL_ndsvideo.c to include it, and the build finally works, but with lots of warnings. Most warnings are about changing the width or signedness of method parameters.

Unfortunately, I have to go to work so I don't have time to try the lib to see if it is works.

It is interesting that I had to modify the makefile to include kosstdio.h, but I did not have to actaully link in the library. Perhaps a missing IFDEF?

the file loading code is in C:\dev\devkitPro\msys\home\GPF\prj\SDL-1.2.9\src\file\SDL_rwops.c
and its hardcoded to use my romfs port lib or fatlib based on a #define FAT being existing or not

the memset message is just a warning so i never bothered with it.

and the DISP_Y changed in devkitpro/libnds 19b so either include the altregister heacer or change the name.

Im currently working with streaming sound with a custom arm7 code, but still needs a lot of work.

Troy(GPF)

Wezwee
April 12th, 2007, 13:38
Appologies on reviving this topic, But I cannot get this SDL port to compile. I'm using DevkitARM r20 and on compiling (under the XP command prompt) I get:

make: arm-elf-gcc: Command not found
make: *** [src/audio/nds/SDL_ndsaudio.o] Error 127


Does it work with r20? I also tried DevkitARM r19a and got the same error.

Any help is much appreciated :)

GPF
April 12th, 2007, 16:31
need devkitarm/bin added to your path, also you need to run make -f Makefile.ds which uses arm-eabi-gcc . Probably need to make some code changes to get it to work with r20.

I have a newer version that works with r20 but requires a custom arm7 code to be used for sound streaming, that I am still working on.

Troy(GPF)