View unanswered posts | View active topics It is currently Wed Jan 16, 2019 11:13 am

Reply to topic  [ 54 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
 dsdoom source 
Author Message

Joined: Mon May 02, 2011 10:13 pm
Posts: 28

I am looking into porting chocolate doom ... olate_Doom

to the ds (mainly so I can understand nds and doom better), I have looked at the source for chocolate doom and it uses libsdl to access all low level hardware (inputs / screen etc) how does dsdoom handle this via libnds I assume ? is the source code of dsdoom available ? so I can try and understand how libnds is used with PrBoom.

Tue May 03, 2011 8:59 am

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
yes and yes

Tue May 03, 2011 8:10 pm

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
source code for ds doom lives at

I am trying to compile it using the latest libnds, any ideas on how to solve this error message

gba_nds_fat.c:312:8: error: 'IPC' undeclared (first use in this function)

which is refering to this bit of code

#ifdef NDS
return (
( ( (IPC->rtc_hours > 11 ? IPC->rtc_hours - 40 : IPC->rtc_hours) & 0x1F) << 11) |
( (IPC->rtc_minutes & 0x3F) << 5) |
( (IPC->rtc_seconds >> 1) & 0x1F) );

Tue May 03, 2011 10:09 pm
User avatar

Joined: Fri Oct 19, 2007 10:57 pm
Posts: 107
Location: Costa Rica
The IPC structure is no longer present in libnds since quite a few releases ago.

These lines seem to be related to the date & time of the device. Today you can obtain that info using standard C functions (time, localtime, mktime, strftime, you get the idea).

I think you'll need to spend some quality time with dsdoom's sources, to substitute IPC stuff with the "new" functions (hehe)...

Also, I think you'll do considerably good to yourself, and us all, if you convert this project to an ARM9 project. Any ARM7-only functionality, as of today, is now provided with the ARM9 template, so you shouldn't have any significant problems converting to it.

Tue May 03, 2011 10:47 pm
Profile WWW

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
I replaced arm7/arm7_main.cpp with the default one from examples /examples/nds/template/combined/arm7

to get the source code to compile ;-) however its crashs at this line

DSgetUserName(); // essential, retrieves username via Fifo buffer.

is their any examples on how to talk to the arm7 or how DSgetUserName(); was used in the old libnds ?

Fri May 06, 2011 10:47 am

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
sorry DSgetUserName(); is called and defined within i_main.c (not libnds) this function uses fifo messages to get the ds user name. is there a defined way of doing this in libnds 1.5.0 ? or do I need to follow examples/nds/userfifo and setup my own message structurer ?

secondly I have got dsdoom running using the template for arm7 code (examples/nds/template/combined/arm7) heres the diff patch

and modified source code

however wifi is not working (its not compiled in, I had to comment it out in config.h) and sound effects are not working ;-( also open close / lid detection is commented out. apart from wifi these issuse are because I am not talking to arm7 properly. any help / pointer on how to do the following would gratefully recieved (I think they all need to be done via arm7)

1) get ds user name
2) get lid close / open detect working
3) blink standby led (when lid is closed)
4) get sound effects working again

the source above has been tested with the first level of doom1 shareware with no sound game play is a bit flat, hopefully I will be able to fix this with a little help.

Sun May 08, 2011 9:55 pm

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
changed DSgetUserName() to use

int nameLen = PersonalData->nameLen;


DS_USERNAME[i] = (char)PersonalData->name[i] & 255;

now I can display the user name at startup ;-) next question how did I get the power led to blink I tried


however that didnt work any ideas why it didnt ?

Mon May 09, 2011 10:29 pm

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
in i_main.c at the start of main after powerOn(POWER_ALL); I removed these lines


irqInit(); // Enable our quintessential vblank interrupt

now ledBlink(0x30) works ok, and keyHeld() works correctly ie lid open / close detect is working again and I can run within the doom game again. Does anyone understand why remove these lilne effects ledblink or keyheld functions ???

Tue May 10, 2011 9:13 am

Joined: Thu Jul 02, 2009 1:19 pm
Posts: 352
Lid detect and led blinking require arm7/arm9 communications. These are established before main is called in current versions on libnds. The lines you removed were interfering with that setup. Primarily irqinit was causing problems but you are correct in removing the rest as well.

Tue May 10, 2011 12:08 pm

Joined: Mon May 02, 2011 10:13 pm
Posts: 28
thanks for the info ;-)

In the new libnds I can use setBrightness( int screen, int level) to set the brightness of both screens

but how can I tell the difference between a ds and dslite using the new libnds code ? also how can I find out the default brightness value at startup ?

I want to do something like this

setBrightness( 3, default_brightness + 1)

to replace the old DStoggleBrightness(); function in the dsdoom code

Tue May 10, 2011 10:34 pm
Display posts from previous:  Sort by  
Reply to topic   [ 54 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at Fast, secure and Free Open Source software downloads