Nintendo DS target

Monkey Targets Forums/User Targets/Nintendo DS target

slenkar(Posted 2011) [#1]
http://www.mediafire.com/?gvc9ktfen23vwam

ask any questions here

(you can only use PNG images that are power of 2)

(you must install, mingw,devkitpro,and nitroengine for DS)


skid(Posted 2011) [#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)?


slenkar(Posted 2011) [#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?


skid(Posted 2011) [#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...


ENAY(Posted 2011) [#5]
Hi Slenkar,

Just noticed your posts here:-

http://devkitpro.org/viewtopic.php?f=6&t=2687

and here:-

http://www.monkeycoder.co.nz/Community/posts.php?topic=800

and realised it's the same you :)

Didn't realise you were also into DS coding. Good luck with that, will be interesting to see what you come up with. Although as Skid and people on the other forum are saying, I presume it's ok for you to do this conversion?


slenkar(Posted 2011) [#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...


ErikT(Posted 2011) [#7]
Looks cool but compiling trans errors out here with an "Identifier 'transCode' not found" message in line 71 of nds.monkey.


slenkar(Posted 2011) [#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.


ErikT(Posted 2011) [#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.


slenkar(Posted 2011) [#10]
oh there is another addition,
in:Monkey\modules\mojo\native
edit mojo.nds.cpp
so that
g_depth++;
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?


TeaBoy(Posted 2011) [#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!


ErikT(Posted 2011) [#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 :/


slenkar(Posted 2011) [#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


slenkar(Posted 2012) [#14]
are string stored in a heap or stack? maybe the max size is too big for the nds


time-killer-games(Posted 2013) [#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. =]


slenkar(Posted 2013) [#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


time-killer-games(Posted 2013) [#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.


slenkar(Posted 2013) [#18]
oh ok sorry i forget, tomorrow i will do it


slenkar(Posted 2013) [#19]
sorry for the delay
does this work?
https://www.dropbox.com/sh/xv89fn6wp93ok1g/mpDbZ9SP1Z/nds