Nintendo DS target

18 replies to this topic
Posted 1+ years ago #2

Maybe you should modify mojo.nds.cpp with your own name and license detail.

And perhaps look at including and extending the gxtkObject rather than duplicate Mark's implementation (which as far as I'm aware is not free)?

Posted 1+ years ago #3

ok, will do

I dont know much about C++
How would I include the gxtkObject without giving away its source? should I compile it and then include it? How would I do that?

Posted 1+ years ago #4

It may not be possible but I was thinking you could do something like the following:

#include "mojo.glfw.cpp"

class ndsApp : public gxtkApp{

... add / override only nds specific bits to your class, inherit everything else ...

and then have the nds target create a ndsApp instead of a gxtkApp.

But I suspect if Mark is OK with your current approach you should be fine...

Posted 1+ years ago #6

yesh same bloke

It should be ok, i guess, no-one has asked me to stop.

everything works except sound BTW

just make sure you only use power of 2 images

millisecs() doesnt work i dont think...

Posted 1+ years ago #7

Looks cool but compiling trans errors out here with an "Identifier 'transCode' not found" message in line 71 of nds.monkey.

Posted 1+ years ago #8

oh yes, all you have to do is change 'app.transCode' to 'transCode'

the only problem is that it has a memory leak, when you start using 'New' it eventually crashes.
WHen you create an app that just draws to the screen and doesnt use 'New' it doesnt crash.

Its most unfortunate, maybe if a smarter person than myself could take a look at the code they might be able to fix it.

I put gcCollect in the code but to no avail.

Posted 1+ years ago #9

Thanks, I got it working. I compiled a small test game, copied the nds file onto my flash card and ran it on the DS. Just like that. I dig it :D I guess it can't be used for commercial purposes but it's still pretty dang cool!

A few things I noticed:

The update rate is capped at 30 fps(?).

Rendering needs to be done in reverse order.

The DS seems pretty feeble in the memory department; if I load more than three 256x256 textures then all remaining textures go white. So if you want to do a game on this device it looks like you'd need to do some hefty tiling.

Posted 1+ years ago #10

oh there is another addition,
edit mojo.nds.cpp
so that
is at the bottom of all drawsurface commands.
then the drawing order will be fixed.

yes I didnt bother fixing the update rate because of the memory leak issue :)

BTW do you have a DSi or a DS?
The DS only has 4MB of RAM whereas the DSi has about 16 I think,

maybe the additional RAM is needed to run a game?

Posted 1+ years ago #11

This is very cool, I've started to use devkitPro for NDS development but I would love to be able to develop for the NDS with an 'official' indie SDK.

I wonder why Nintendo haven't released one, although I have been living under a rock for a while *lol*

Keep up the good work!

Posted 1+ years ago #12

It's a regular DS, and yeah I saw it only has 512kb of texture memory so no wonder :P The texture converter is set in nds.monkey to 32 bit rgba so I tried to change the flag to 4 bit, but all that gave me was garbled gfx unfortunately :/

Posted 1+ years ago #13

ok I created a little space invaders app and It creates a bullet every frame
so 30 bullets are being created per second.
Its been running for a while with no crash, so its not a memory leak,

I think it was me trying to access a lot of objects from a stringmap and monkey was creating NEW strings in the generated C++ code, this must have outgrown the 4MB's of RAM and caused the crash,

the garbage collection doesnt collect all garbage every frame (I think)

so this could be why it takes 4-5 seconds of running time until the RAM ran out,

well thats my best guess

Posted 1+ years ago #14

are string stored in a heap or stack? maybe the max size is too big for the nds

Posted 1+ years ago #15

May someone please re-upload this? I have a DS I know this target won't work with the newer versions of monkey, and honestly I can make a small adjustment to bring this more up to date depending on the language it's written in, what is it? Anything like C++ or VB6? Those are my two favorite languages apart from monkey. =]

Posted 1+ years ago #16

Its C++

I did some coding on the DS in C for a laugh and ran into a possible reason it could be crashing,

The DS has a tiny stack, so when you create a new struct or thing on the stack (equivalent of local variable) and its too big it will crash.

Ill try to re-up it later as its not on this pc

Posted 1+ years ago #17

Did you forget, or you can't find the target on your computer? Sorry... I'm a little anxious but I don't want to rush you.

Posted 1+ years ago #18

oh ok sorry i forget, tomorrow i will do it