Missing defines in libnds

Post Reply
User avatar
WeedleTheLiar
Posts: 2
Joined: Tue Jan 06, 2009 3:56 am

Missing defines in libnds

Post by WeedleTheLiar » Sun Jan 11, 2009 6:32 am

I tried to compile the following code:

Code: Select all

//////////////////////////////////////////////////////////////////////
// Demo1 ARM9 Code - Based on an example shipped with NDSLIB.
// Chris Double ([email protected])
//////////////////////////////////////////////////////////////////////

#include <nds.h>
#include <stdio.h>

int main(void)
{
  // Use the touch screen for output
  videoSetMode(0);
  videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
  vramSetBankC(VRAM_C_SUB_BG);
  SUB_BG0_CR = BG_MAP_BASE(31);  //nds/video.h

  // Set the colour of the font to White.
  BG_PALETTE_SUB[255] = RGB15(31,31,31);  

  consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); //nds/jtypes.h  

  printf("\n\n\tHello World!\n");
  while(1) {
    touchPosition touchXY = touchReadXY();
    printf("\x1b[10;0H");
    printf("Touch x = %d   \n", touchXY.px);
    printf("Touch y = %d   \n", touchXY.py);
  }
  return 0;
}
When I try to Make I get an error saying that SUB_BG0_CR and consoleInitDefault are not declared. They should be defined in video.h and arm9/console.h respectively according to the documentation I found here: http://takuto.info/libnds/arm9/main.html. In fact, if I define SUB_BG0_CR according to the documentation, that error disappears.

I installed devkitPro Updater 1.4.9 to Make this code. The odd thing is that I compiled this code properly about 6 months ago with an older version of devkitPro (I can't remember which version).
Does anyone know what this is about? Have some defines been removed in newer versions? If so, is there a change log or newer documentation somewhere?

Thanks for any help you can give.

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Missing defines in libnds

Post by Sylus101 » Sun Jan 11, 2009 10:14 am

Try the docs here:
http://libnds.devkitpro.org/

It's in background.h and must have been renamed:
REG_BG0CNT_SUB

I checked at http://takuto.info and it says libnds(20071023) Documentation so it must have been a mirror to docs of that version, which is now old.

Not sure on where a changelog may be...
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Missing defines in libnds

Post by WinterMute » Sun Jan 11, 2009 11:08 am

Unfortunately Chris Double's tutorials are badly out of date now. Please use the examples supplied by the installer for reference.

http://patater.com/manual may also be useful. Patater usually keeps up to date with releases.
Help keep devkitPro toolchains free, Donate today

Personal Blog

User avatar
WeedleTheLiar
Posts: 2
Joined: Tue Jan 06, 2009 3:56 am

Re: Missing defines in libnds

Post by WeedleTheLiar » Sun Jan 11, 2009 8:43 pm

Thanks guys, that should help.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests