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 > Inline functions in ndslib

#38908 - Ethos - Fri Apr 01, 2005 10:54 pm

Anyone else find the inline functions of ndslib to be a pain?
I have to comment them out so that I can link my object files together or else I will get multiple definition errors!

Also I finally got the new environment into my eclipse setup....finally.

Check out the 64x64 tile (Mode0) functionality test.

BIN file
NDS file

#38923 - josath - Sat Apr 02, 2005 1:46 am

to fix this, simply do a search and replace for "inline" and replace with "static inline". I believe this is only an issue if you use .c files, not .cpp? (not sure).

#39030 - dovoto - Sun Apr 03, 2005 10:26 am

Hmm ..i thought i had corrected this issue. I will do a search and replace once again. Thanks
_________________
www.drunkencoders.com

#39090 - Ethos - Mon Apr 04, 2005 1:30 pm

Also in registers_alt.h:
should be

#include <NDS/jtypes.h>

and duplicate definition in jtypes.h of

typedef float float32;
typedef double float64;

#39091 - Ethos - Mon Apr 04, 2005 1:35 pm

Also in card.h

void cardReadEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype);
void cardWriteEeprom(uint32 address, uint8 *data, uint32 length, uint32 addrtype);

I don't believe they need addrtype = 2 in the prototype. (My compiler chokes)

and also even though I do not use it in registers_alt.h:

#define REG_TM1D (*(vu16*)0x4000104)
#define REG_TM1CNT (*(vu16*)0x4000106)

#39116 - Lino - Mon Apr 04, 2005 6:10 pm

I have a question, this is an error ?

Code:
void glResetMatrixStack(void)
{
  // stack overflow ack ?
  GFX_STATUS |= 1 << 15;

  // pop the stacks to the top...seems projection stack is only 1 deep??
  glMatrixMode(GL_PROJECTION);
  glPopMatrix(GFX_STATUS & (1<<13));
 
  // 31 deep modelview matrix
  glMatrixMode(GL_MODELVIEW);
  glPopMatrix(GFX_STATUS & (0x1F << 8));
}


The call glPopMatrix have always a value greater or equal of 256, it's possible?

#39122 - dovoto - Mon Apr 04, 2005 7:43 pm

Multiple definition of float types are removed.

Register_alt will not be updated nor maintained.

I am still looking into the inline issue.

We are considering going to strait C for the library to alleviate some of interfacing issues.

And yes reset was in error, it should be:
Code:
void glResetMatrixStack(void)
{
  // stack overflow ack ?
  GFX_STATUS |= 1 << 15;

  // pop the stacks to the top...seems projection stack is only 1 deep??
  glMatrixMode(GL_PROJECTION);
  glPopMatrix((GFX_STATUS>>13) & 1);
 
  // 31 deep modelview matrix
  glMatrixMode(GL_MODELVIEW);
  glPopMatrix((GFX_STATUS >> 8) & 0x1F);
}


supprised it worked at all :)

Thanks for the greate feedback..please keep it coming
_________________
www.drunkencoders.com

#39123 - Ethos - Mon Apr 04, 2005 8:31 pm

lol, maybe one day i'll switch to a C++ compiler :P

Oh and the inline functions that weren't changed are in system.h

#39124 - dovoto - Mon Apr 04, 2005 8:48 pm

Okay i moved ndslib to all c code so this should clear up a lot of the issues. I found the inlines you were speaking of in the process.

www.drunkencoders.com/temp/ndslib.zip

Please give this one a whirl and let me know...i will make it an official update after a bit of regression testing.

Thanks
_________________
www.drunkencoders.com

#39133 - Ethos - Mon Apr 04, 2005 11:47 pm

Beautiful!

It compiled clean, all I had to do was take one of the new ARM 7 main.cpp :)

#39154 - Lino - Tue Apr 05, 2005 6:09 am

ahh, it's fantastic :)). Thanks