correction to the new affine bg handling: parameters must be reset to the last user-specified value before scanline 0.

This commit is contained in:
zeromus 2009-02-01 01:28:34 +00:00
parent d66fd4ab85
commit 869f56bf41
3 changed files with 52 additions and 3 deletions

View File

@ -1704,8 +1704,8 @@ FORCEINLINE void rot_scale_op(GPU * gpu, u8 * dst, u16 H, s32 X, s32 Y, s16 PA,
u32 i;
s32 auxX, auxY;
x.val = X + (s32)H;
y.val = Y + (s32)H;
x.val = X;
y.val = Y;
for(i = 0; i < LG; ++i)
{
@ -3232,6 +3232,21 @@ void GPU_ligne(NDS_Screen * screen, u16 l)
{
GPU * gpu = screen->gpu;
//here is some setup which is only done on line 0
if(l == 0) {
for(int num=2;num<=3;num++)
{
BGxPARMS * parms;
if (num==2)
parms = &(gpu->dispx_st)->dispx_BG2PARMS;
else
parms = &(gpu->dispx_st)->dispx_BG3PARMS;
parms->BGxX = gpu->affineInfo[num-2].x;
parms->BGxY = gpu->affineInfo[num-2].y;
}
}
//cache some parameters which are assumed to be stable throughout the rendering of the entire line
gpu->currLine = (u8)l;
u16 mosaic_control = T1ReadWord((u8 *)&gpu->dispx_st->dispx_MISC.MOSAIC, 0);
@ -3310,7 +3325,11 @@ bool gpu_loadstate(std::istream* is)
return !is->fail();
}
void GPU::setAffineStart(int layer, int xy, u32 val)
{
if(xy==0) affineInfo[layer-2].x = val;
else affineInfo[layer-2].y = val;
}
//here is an old bg mosaic with some old code commented out. I am going to leave it here for a while to look at it
//sometimes in case I find a problem with the mosaic.

View File

@ -722,7 +722,12 @@ struct GPU
SpriteRenderFunct spriteRender;
void __setFinalColorBck(u8 *dst, u16 color, u8 x, bool opaque);
void setAffineStart(int layer, int xy, u32 val);
struct AffineInfo {
AffineInfo() : x(0), y(0) {}
u32 x, y;
} affineInfo[2];
void renderline_checkWindows(u16 x, bool &draw, bool &effect) const;

View File

@ -2432,6 +2432,31 @@ static void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
switch(adr)
{
case REG_DISPA_BG2XL:
MainScreen.gpu->setAffineStart(2,0,val);
break;
case REG_DISPA_BG2YL:
MainScreen.gpu->setAffineStart(2,1,val);
break;
case REG_DISPB_BG2XL:
SubScreen.gpu->setAffineStart(2,0,val);
break;
case REG_DISPB_BG2YL:
SubScreen.gpu->setAffineStart(2,1,val);
break;
case REG_DISPA_BG3XL:
MainScreen.gpu->setAffineStart(3,0,val);
break;
case REG_DISPA_BG3YL:
MainScreen.gpu->setAffineStart(3,1,val);
break;
case REG_DISPB_BG3XL:
SubScreen.gpu->setAffineStart(3,0,val);
break;
case REG_DISPB_BG3YL:
SubScreen.gpu->setAffineStart(3,1,val);
break;
case 0x04000600:
GFX_FIFOcnt(val);
return;