#154576 - Rajveer - Fri Apr 18, 2008 1:37 pm
I'm going to combine the libnds functions gluTexLoadPal, glTexLoadPal and getNextPaletteSlot to make my own palette loading function to store them in bank F. I'm not sure how getNextPaletteSlot works though:
specifically the "if( result+count > 0x10000 ) // VRAM_F - VRAM_E" line (so it's 6890000h - 6880000h right?) If I wanted to make sure it was within VRAM F, I'd just do VRAM_G - VRAM_F and compare result+count to 0x4000 (6894000h - 6890000h) right? That all I have to do?
EDIT: It's working, I just wanted somebody to reassure me that I wasn't somehow doing something to the VRAM that I shouldn't be, but everything seems to be ok so sorry for taking forum space! :D
Code: |
//---------------------------------------------------------------------------------
int getNextPaletteSlot(u16 count, uint8 format) { //--------------------------------------------------------------------------------- // ensure the result aligns on a palette block for this format uint32 result = alignVal(glGlob->nextPBlock, 1<<(4-(format==GL_RGB4))); // convert count to bytes and align to next (smallest format) palette block count = alignVal( count<<1, 1<<3 ); // ensure that end is within palette video mem if( result+count > 0x10000 ) // VRAM_F - VRAM_E return -1; glGlob->nextPBlock = result+count; return (int)result; } |
specifically the "if( result+count > 0x10000 ) // VRAM_F - VRAM_E" line (so it's 6890000h - 6880000h right?) If I wanted to make sure it was within VRAM F, I'd just do VRAM_G - VRAM_F and compare result+count to 0x4000 (6894000h - 6890000h) right? That all I have to do?
EDIT: It's working, I just wanted somebody to reassure me that I wasn't somehow doing something to the VRAM that I shouldn't be, but everything seems to be ok so sorry for taking forum space! :D