jboldiga
Joined: 20 Jun 2005 Posts: 27
|
Posted: Tue Jun 21, 2005 11:20 am Post subject: Am I going crazy? (probably) |
|
|
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. |
|