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 > libFB with devkitPro r20 and new libnds

#118024 - Primetime00 - Fri Feb 09, 2007 4:35 am

Anyone have libFB working for the new toolchain and libnds?
I'm just trying to draw a rectangle.
Seems to work fine in the emulator, but two blank screens on the DS.

Code:

    powerON(POWER_ALL_2D);
    irqSet(IRQ_VBLANK, 0);
    irqEnable(IRQ_VBLANK);
   
    fb_init();
    fb_drawRect(6, 6, 60, 60, RGB15(31,31,31));
    swiWaitForVBlank();
    fb_swapBuffers();
    while(1)
    {   
        swiWaitForVBlank();
    }


Thanks
-RYan

#118027 - tepples - Fri Feb 09, 2007 5:08 am

Tried ORing your color value with 0x8000? That turns on the alpha bit. Any pixel without the alpha bit turned on just shows the layer beneath, which is usually just the value of BG_PALETTE[0] unless you've turned on more than one layer.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#118048 - Primetime00 - Fri Feb 09, 2007 1:11 pm

Unfortunately that still only gives me 2 blanks. Still works in the emulator.
Maybe I'll try it later with devkit r19.

-RYan

#118062 - DragonMinded - Fri Feb 09, 2007 5:30 pm

I don't have r20 so I can't tell you why this isn't working, but you don't need to OR the bits due to libFB managing that for you.
_________________
Enter the mind of the dragon.

http://dragonminded.blogspot.com

Seriously guys, how hard is it to simply TRY something yourself?

#118067 - Primetime00 - Fri Feb 09, 2007 6:57 pm

Yeah, I kind of thought so. I've tried it on r19, and I am getting the same results. So I'm going to revert back to the older libnds and check if it works with that.

-Ryan

#118072 - DragonMinded - Fri Feb 09, 2007 8:29 pm

When I have the time, I plan on testing out r20, and I can see why it's not working...

For now, I am actually posting from the lab room at school, no time ;P
_________________
Enter the mind of the dragon.

http://dragonminded.blogspot.com

Seriously guys, how hard is it to simply TRY something yourself?

#118180 - Primetime00 - Sat Feb 10, 2007 9:39 pm

ok, it seems to work now.
Just replace
Code:
irqSet(IRQ_VBLANK, 0);

with
Code:
irqInit();


That seems to fix the problem. So libFB works with both r20 and the new libnds.

-RYan

#118182 - Lick - Sat Feb 10, 2007 10:30 pm

Primetime00 wrote:
ok, it seems to work now.
Just replace
Code:
irqSet(IRQ_VBLANK, 0);

with
Code:
irqInit();


That seems to fix the problem. So libFB works with both r20 and the new libnds.

-RYan


You should not replace it, but put in front of it. :)
_________________
http://licklick.wordpress.com

#118200 - wintermute - Sun Feb 11, 2007 12:50 am

Indeed.

irqInit() is needed to initialise the interrupt system.

irqEnable(IRQ_VBLANK); is probably better than irqSet(IRQ_VBLANK, 0); though - the second may not enable the interrupt. The vblank interrupt must be enabled for swiWaitForVBlank() to operate as expected.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#118229 - Primetime00 - Sun Feb 11, 2007 7:21 am

ah, ok
Thanks

-RYan