Hi
I am looking into porting chocolate doom
http://www.chocolate-doom.org/wiki/inde ... 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.
dsdoom source
-
- Posts: 28
- Joined: Mon May 02, 2011 10:13 pm
Re: dsdoom source
source code for ds doom lives at
http://code.google.com/p/dsdoom/
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) );
#else
http://code.google.com/p/dsdoom/
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) );
#else
Re: dsdoom source
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.
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.
-
- Posts: 28
- Joined: Mon May 02, 2011 10:13 pm
Re: dsdoom source
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 ?
to get the source code to compile
![Wink ;-)](./images/smilies/icon_wink.gif)
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 ?
-
- Posts: 28
- Joined: Mon May 02, 2011 10:13 pm
Re: dsdoom source
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
http://www.megaupload.com/?d=JTKAFZCX
and modified source code
http://www.megaupload.com/?d=55O36YSO
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.
secondly I have got dsdoom running using the template for arm7 code (examples/nds/template/combined/arm7) heres the diff patch
http://www.megaupload.com/?d=JTKAFZCX
and modified source code
http://www.megaupload.com/?d=55O36YSO
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.
-
- Posts: 28
- Joined: Mon May 02, 2011 10:13 pm
Re: dsdoom source
changed DSgetUserName() to use
int nameLen = PersonalData->nameLen;
and
DS_USERNAME = (char)PersonalData->name & 255;
now I can display the user name at startup
next question how did I get the power led to blink I tried
ledBlink(0x30);
however that didnt work any ideas why it didnt ?
int nameLen = PersonalData->nameLen;
and
DS_USERNAME = (char)PersonalData->name & 255;
now I can display the user name at startup
![Wink ;-)](./images/smilies/icon_wink.gif)
ledBlink(0x30);
however that didnt work any ideas why it didnt ?
-
- Posts: 28
- Joined: Mon May 02, 2011 10:13 pm
Re: dsdoom source
in i_main.c at the start of main after powerOn(POWER_ALL); I removed these lines
REG_EXMEMCNT=0xe800;
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
irqInit(); // Enable our quintessential vblank interrupt
irqSet(IRQ_VBLANK, NULL);
irqEnable(IRQ_VBLANK);
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 ???
REG_EXMEMCNT=0xe800;
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
irqInit(); // Enable our quintessential vblank interrupt
irqSet(IRQ_VBLANK, NULL);
irqEnable(IRQ_VBLANK);
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 ???
Re: dsdoom source
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.
-
- Posts: 28
- Joined: Mon May 02, 2011 10:13 pm
Re: dsdoom source
thanks for the info ![Wink ;-)](./images/smilies/icon_wink.gif)
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
if(dslite){
setBrightness( 3, default_brightness + 1)
}
to replace the old DStoggleBrightness(); function in the dsdoom code
![Wink ;-)](./images/smilies/icon_wink.gif)
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
if(dslite){
setBrightness( 3, default_brightness + 1)
}
to replace the old DStoggleBrightness(); function in the dsdoom code
Who is online
Users browsing this forum: Ahrefs [Bot] and 83 guests