forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Am I going crazy? (probably)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jboldiga



Joined: 20 Jun 2005
Posts: 27

PostPosted: Tue Jun 21, 2005 11:20 am    Post subject: Am I going crazy? (probably) Reply with quote

Soo today I decided to muck around with some PSP dev stufff and I managed to compile Nem's hello world (yay!) but I wasnt satified so I got a cool little image of Link @ 300x170 res. I modified the hello code to load a non-interleaved image (raw data) but everytime I ran it the image was greyscale. Here is the function:

Code:

void pgBitBlt32(unsigned int x,unsigned int y,unsigned int w,unsigned int h,unsigned int mag,const unsigned int *d)
{
   unsigned char *vptr0;      //pointer to vram
   unsigned char *vptr;      //pointer to vram
   unsigned long xx,yy,mx,my;
   const unsigned char *ddr, *ddg, *ddb;
   
   vptr0=pgGetVramAddr(x,y);
   ddr=(const unsigned char*)d;
   ddg=ddr+(w*h);
   ddb=ddg+(w*h);
      
   for (yy=0; yy<h; yy++) {
      for (my=0; my<mag; my++) {
         vptr=vptr0;
         for (xx=0; xx<w; xx++) {
            for (mx=0; mx<mag; mx++) {
               unsigned short pixel;
               unsigned char  r, g, b;
               r = ((*ddr) >> 3); ddr++;
               g = ((*ddg) >> 3); ddg++;
               b = ((*ddb) >> 3); ddb++;
               pixel = ((r) | (g << 5) | (b << 10)); //| (1 << 15));
               *(unsigned short *)vptr=pixel;
               vptr+=PIXELSIZE*2;
            }
         }
         vptr0+=LINESIZE*2;   
      }
   }
   
}


now if you look in particular at the line
Code:

ddg=ddr+(w*h);
ddb=ddg+(w*h);


when I put constant values of (300*170), the image showed up fine, if I left it as w*h it was greyscale. I called the function like so:
Code:

pgBitBlt32(0,0,300,170,1,image_seclogo);


What the hell is going on??? Tried on the pspe AND on my physical PSP, same results on both. Do you think its the compiler??

Note: I am using the ps2 tool chain with the elf patch for psp.

Thanks in advance.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group