gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Cant get project working with newest devkitpro

#102965 - ChronoDK - Mon Sep 18, 2006 8:35 am

I'm having trouble getting my project working with the latest devkitpro. It's a nine month old project, that I'm finally having the time to resurrect. It compiles and gives me a working .nds on devkitarm_r17 with ndslib up to release 20060201. After that, it stops working. It still compiles without errors (after changing BG_CR to BGCTRL), but the .nds just freezes.

I'm thinking it might have something to do with the makefiles, or perhaps something with the binary spritedata as the game seems to freeze when the sprites are initialized. Unfortunatly I don't know much about those things, especially makefiles, so I can't fix it myself :-(

I can continue to work on it with the old devkitpro, but I would really like to use the latest release.

If someone has the time to look at it, please do. The whole project with source and data is here:
http://chrono.moogle.dk/ninja_engine.zip

Don't know how good the code is, but feel free to use it in your own projects. No credit needed.


Last edited by ChronoDK on Sat Sep 23, 2006 8:53 pm; edited 1 time in total

#102979 - headspin - Mon Sep 18, 2006 12:15 pm

You may want to handle the sprites the way the latest libnds example does. Check out the examples\nds and use the templates in there. Then build your project back part by part by introducing your original source files and testing as you go. Use the console to output to see whats going on so you can track down possible errors.

There probably isn't much chance of someone fixing your code, your probably better off trying yourself, but someone might be kind enough.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#103031 - ChronoDK - Mon Sep 18, 2006 8:23 pm

I know, it's a long shot. But hey, maybe someone will be kind enough :-)

I did try to slowly introduce the code to the new devkitpro, and something goes wrong when I get to the sprites. That is why I suspect the makefile might be the problem.

But the examples for libnds does the same thing I do, so looking at them didn't help much unfortunatly.

#103677 - ChronoDK - Sat Sep 23, 2006 7:45 pm

I tried again, and this time I got it narrowed down to these few lines:

Code:

oam = &gameworld->sprite_control->OAMCopy[oamIndex];

// Set up the sprite's OAM entry attributes
if (rotate) {
      rotation_index = gameworld->sprite_control->getRotIndex();
      oam->attribute[0] = ATTR0_COLOR_16 | ATTR0_SQUARE | ATTR0_ROTSCALE;
      if (width == height && width < 64) //for square sprites less than 64 pixels wide
         oam->attribute[1] = width * 1024 | ATTR1_ROTDATA(rotation_index);
      else if (width == height && width == 64)//for 64 pixels wide square sprites
         oam->attribute[1] = 48 * 1024 | ATTR1_ROTDATA(rotation_index);
   }
   else {
      rotation_index = 0;
      oam->attribute[0] = ATTR0_COLOR_16 | ATTR0_SQUARE;
      if (width == height && width < 64) //for square sprites less than 64 pixels wide
         oam->attribute[1] = width * 1024;
      else if (width == height && width == 64)//for 64 pixels wide square sprites
         oam->attribute[1] = 48 * 1024;
   }


It's from my sprite class constructor. If I comment out the big if-else thing the program runs with devkitPro R19 (but the sprites wont work then of course).

Has something changed with the way the sprite attributes are set? Or is there another problem?

#103703 - Lick - Sat Sep 23, 2006 11:35 pm

What is the ' * 1024' part supposed to do? (And why isn't attribute[2] set?)

- Lick
_________________
http://licklick.wordpress.com

#103740 - ChronoDK - Sun Sep 24, 2006 9:18 am

Thank you! Attribute 2 is set later on with this:

oam->attribute[2] = ATTR2_PALETTE(pal) | attr2 | gfx;

Where attr2 was a u16. I changed it to u32 and now it works :D

I don't think I would have figured that out, if you hadn't asked. Strange thing that it worked when I commented the other part out.

#103798 - Lick - Sun Sep 24, 2006 6:21 pm

Wow.. Great. Glad it helped!! ;D

- Lick
_________________
http://licklick.wordpress.com