#75584 - jandujar - Tue Mar 14, 2006 11:42 am
Hello people,
I hope somebody can help me with this.
I have created a function that opens a nds file and then shows it's icon.
But I have a problem, the function works con Desmume, but does not work on others emus or hardware.
I think, it's a palette error.
Can somebody help me? (I use PAlib)
I call the function with:
_________________
http://jandujar.homelinux.com
http://www.dsrobot.com
I hope somebody can help me with this.
I have created a function that opens a nds file and then shows it's icon.
But I have a problem, the function works con Desmume, but does not work on others emus or hardware.
I think, it's a palette error.
Can somebody help me? (I use PAlib)
Code: |
void nds_icon_create_sprite(u8 screen,u8 sprite,u8 palette,u8* nds_file,u8 x, u8 y){ u8 puntero[4]; puntero[0]=nds_file[104]; puntero[1]=nds_file[105]; puntero[2]=nds_file[106]; puntero[3]=nds_file[107]; u32 mipuntero; mipuntero=puntero[3]<<24 | puntero[2]<<16 | puntero[1]<<8 | puntero[0]; u8 tile[512]; u8 paleta[32]; mipuntero+=32; int i; for(i=0;i<512;i++){ tile[i]=nds_file[mipuntero+i]; } mipuntero+=512; for(i=0;i<32;i++){ paleta[i]=nds_file[mipuntero+i]; } if(screen==0){ PA_LoadPal16(PAL_SPRITE0, palette,(void*)paleta); PA_CreateSprite (0, sprite, (void*)tile, OBJ_SIZE_32X32,0,0,x,y); }else{ //screen==1 PA_LoadPal16(PAL_SPRITE1, palette,(void*)paleta); PA_CreateSprite (1, sprite, (void*)tile, OBJ_SIZE_32X32,0,0,x,y); } } |
I call the function with:
Code: |
#include "ejemplo_nds.h" // ->bin2o int main(){ PA_Init(); // Initializes PA_Lib PA_InitVBL(); // Initializes a standard VBL nds_icon_create_sprite(1,0,0,(u8*)ejemplo_nds,0,0); while(1){ PA_WaitForVBL(); } } |
_________________
http://jandujar.homelinux.com
http://www.dsrobot.com