applied namechanges of GPU.h into the .c (bitfield=>bits), fixed BG0_3D corrupting 2D background

This commit is contained in:
mightymax 2007-01-11 14:42:00 +00:00
parent 66a6a53327
commit ec21670868
2 changed files with 32 additions and 30 deletions

View File

@ -138,7 +138,7 @@ u16 WinBG=0;
}
// Let's prepare the field for WINDOWS implementation
LayersEnable[0] = gpu->dispBG[0] && (cnt->BG0_Enable || (WinBG & 0x1));
LayersEnable[0] = gpu->dispBG[0] && (cnt->BG0_Enable || (WinBG & 0x1)) && !gpu->dispCnt.bits.BG0_3D ;
LayersEnable[1] = gpu->dispBG[1] && (cnt->BG1_Enable || (WinBG & 0x2)) ;
LayersEnable[2] = gpu->dispBG[2] && (cnt->BG2_Enable || (WinBG & 0x4)) ;
LayersEnable[3] = gpu->dispBG[3] && (cnt->BG3_Enable || (WinBG & 0x8)) ;
@ -154,15 +154,14 @@ u16 WinBG=0;
/* selection sort*/
for (i=0;i<4;i++)
{
/* weighted priorities: first drawn/not drawm, then set priority bits,
then the num the higher the value the lower the priority */
/* weighted priorities: first drawn/not drawm, then set priority bits, then the num */
/* the higher the value the lower the priority */
u8 curPrio = gpu->bgCnt[gpu->ordre[i]].bits.Priority*4 + (LayersEnable[gpu->ordre[i]]?16:0) + gpu->ordre[i] ;
for (q=i+1;q<4;q++)
{
u8 lookingPrio = gpu->bgCnt[gpu->ordre[q]].bits.Priority*4 + (LayersEnable[gpu->ordre[q]]?16:0) + gpu->ordre[q] ;
/* if the one we are looking for is of higher priority then the
current selected, swap them
note: higher value = lower priority */
/* if the one we are looking for is of higher priority then the current selected, swap them */
/* note: higher value = lower priority */
if (lookingPrio > curPrio)
{
/* swap the order */
@ -188,6 +187,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
{
BOOL LayersEnable[5];
u16 WinBG=0;
int i ;
struct _DISPCNT * cnt = &gpu->dispCnt.bits;
gpu->dispCnt.val = p;
@ -239,6 +239,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
gpu->sprEnable = cnt->OBJ_Enable;
GPU_setBGProp(gpu, 3, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 14));
GPU_setBGProp(gpu, 2, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 12));
GPU_setBGProp(gpu, 1, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 10));
@ -251,7 +252,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
log::ajouter("------------------");
for(u8 i = 0; i < gpu->nbBGActif; ++i)
{
sprintf(logbuf, "bg %d prio %d", gpu->ordre[i], gpu->bgCnt[gpu->ordre[i]].bits.Priority);
sprintf(logbuf, "bg %d prio %d", gpu->ordre[i], gpu->bgCnt[gpu->ordre[i]].bitfield.Priority);
log::ajouter(logbuf);
}
log::ajouter("_________________");
@ -267,7 +268,7 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p)
int lastPriority = cnt->Priority, mode;
gpu->bgCnt[num].val = p;
GPU_resortBGs(gpu) ; /* is allready done in GPU_setBGProb */
GPU_resortBGs(gpu) ;
if(gpu->core == GPU_SUB) {
gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_BBG);
@ -524,7 +525,7 @@ INLINE BOOL renderline_checkWindowInside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL
if (gpu->dispCnt.bits.Win0_Enable) /* highest priority */
{
if (((gpu->WINDOW_XDIM[0].val) && (gpu->WINDOW_YDIM[0].val)) &&
((((x >= gpu->WINDOW_XDIM[0].bits.start) && (x < gpu->WINDOW_XDIM[0].bits.end)) /* || (gpu->WINDOW_XDIM[1].bits.end==0)*/)
((((x >= gpu->WINDOW_XDIM[0].bits.start) && (x < gpu->WINDOW_XDIM[0].bits.end)) /* || (gpu->WINDOW_XDIM[1].bitfield.end==0)*/)
&&(y >= gpu->WINDOW_YDIM[0].bits.start) && (y < gpu->WINDOW_YDIM[0].bits.end)))
{
switch (bgnum) {
@ -566,7 +567,7 @@ INLINE BOOL renderline_checkWindowInside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL
if (gpu->dispCnt.bits.Win1_Enable) /* mid priority */
{
if (((gpu->WINDOW_XDIM[1].val) && (gpu->WINDOW_YDIM[1].val)) &&
((((x >= gpu->WINDOW_XDIM[1].bits.start) && (x < gpu->WINDOW_XDIM[1].bits.end)) /* || (gpu->WINDOW_XDIM[1].bits.end==0)*/)
((((x >= gpu->WINDOW_XDIM[1].bits.start) && (x < gpu->WINDOW_XDIM[1].bits.end)) /* || (gpu->WINDOW_XDIM[1].bitfield.end==0)*/)
&&(y >= gpu->WINDOW_YDIM[1].bits.start) && (y < gpu->WINDOW_YDIM[1].bits.end)))
{
switch (bgnum) {
@ -620,7 +621,7 @@ INLINE BOOL renderline_checkWindowOutside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL
if (gpu->dispCnt.bits.Win0_Enable) /* highest priority */
{
if (((gpu->WINDOW_XDIM[0].val) && (gpu->WINDOW_YDIM[0].val)) &&
((((x >= gpu->WINDOW_XDIM[0].bits.start) && (x < gpu->WINDOW_XDIM[0].bits.end)) /* || (gpu->WINDOW_XDIM[1].bits.end==0)*/)
((((x >= gpu->WINDOW_XDIM[0].bits.start) && (x < gpu->WINDOW_XDIM[0].bits.end)) /* || (gpu->WINDOW_XDIM[1].bitfield.end==0)*/)
&&(y >= gpu->WINDOW_YDIM[0].bits.start) && (y < gpu->WINDOW_YDIM[0].bits.end)))
{
} else
@ -664,7 +665,7 @@ INLINE BOOL renderline_checkWindowOutside(GPU *gpu, u8 bgnum, u16 x, u16 y, BOOL
if (gpu->dispCnt.bits.Win1_Enable) /* mid priority */
{
if (((gpu->WINDOW_XDIM[1].val) && (gpu->WINDOW_YDIM[1].val)) &&
((((x >= gpu->WINDOW_XDIM[1].bits.start) && (x < gpu->WINDOW_XDIM[1].bits.end)) /* || (gpu->WINDOW_XDIM[1].bits.end==0)*/)
((((x >= gpu->WINDOW_XDIM[1].bits.start) && (x < gpu->WINDOW_XDIM[1].bits.end)) /* || (gpu->WINDOW_XDIM[1].bitfield.end==0)*/)
&&(y >= gpu->WINDOW_YDIM[1].bits.start) && (y < gpu->WINDOW_YDIM[1].bits.end)))
{
} else

View File

@ -482,6 +482,7 @@ static INLINE void GPU_ligne(Screen * screen, u16 l)
for(i8 = 0; i8 < gpu->nbBGActif; ++i8)
{
if (! ((gpu->ordre[i8]==0) && (gpu->dispCnt.bits.BG0_3D)) )
modeRender[gpu->dispCnt.bits.BG_Mode][gpu->ordre[i8]](gpu, gpu->ordre[i8], l, dst);
bgprio = gpu->bgCnt[gpu->ordre[i8]].bits.Priority;
if (gpu->sprEnable)