Sooo, since we're accessing the video memory to blit an image on screen, I can easily understand how some things could go wrong if we try to blit something *outside* the screen.
In facts, with nem's function, only negative y's seem to be the problem and lead to a crash.
x's just seem to loop from one side of the screen to the other, and SCREENHEIGHT+ y's go weirdy weirdo after a certain value.
Hence this quick fix to nem's function :
Code: Select all
void pgBitBlt(unsigned long x,long y,unsigned long w,unsigned long h,unsigned long mag,const unsigned short *d)
{
	unsigned char *vptr0;		//pointer to vram
	unsigned char *vptr;		//pointer to vram
	unsigned long xx,yy,mx,my,sy,ry;
	const unsigned short *dd;
	
	////////////////////////////////
	// [Shito] Clip negative y's 
	ry = y ;
	sy = 0 ;
	
	if (y < 0)
	{
		ry = 0 ;
		sy = -y ;
		d+=w*sy ;
	}
	////////////////////////////////
	vptr0=pgGetVramAddr(x,ry);
	for (yy=sy; yy<h; yy++) {
		for (my=0; my<mag; my++) {
			vptr=vptr0;
			dd=d;
			for (xx=0; xx<w; xx++) {
					for (mx=0; mx<mag; mx++) {
						if (*dd != KEYCOLOR)				// [Shito] discard keycolor pixels
							*(unsigned short *)vptr=*dd;
						vptr+=PIXELSIZE*2;
					}
				dd++;
			}
			vptr0+=LINESIZE*2;
		}
		d+=w;
	}	
}Works fine on pspe, have yet to test it on my psp, but I just wanted to know : do you think I should also check the other edges, or since it doesn't seem to crash let's just leave at that and save us a little (*little*) cpu time ?
If you have an even easier solution, I'm begging of you, please go ahead and show me. :)
