_DISPCNT_ structure definition
This commit is contained in:
parent
c28b17c794
commit
ff2b794d64
|
@ -127,8 +127,10 @@ void GPU_DeInit(GPU * gpu)
|
|||
void GPU_setVideoProp(GPU * gpu, u32 p)
|
||||
{
|
||||
gpu->prop = p;
|
||||
_DISPCNT_ * cnt = &p;
|
||||
|
||||
gpu->dispMode = DISPCNT_DISPLAY_MODE(p,gpu->lcd) ;
|
||||
// gpu->dispMode = DISPCNT_DISPLAY_MODE(p,gpu->lcd) ;
|
||||
gpu->dispMode = cnt->ExMode & ((gpu->lcd)?1:3);
|
||||
|
||||
switch (gpu->dispMode)
|
||||
{
|
||||
|
@ -137,7 +139,8 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
|
|||
case 1: // Display BG and OBJ layers
|
||||
break;
|
||||
case 2: // Display framebuffer
|
||||
gpu->vramBlock = DISPCNT_VRAMBLOCK(p) ;
|
||||
// gpu->vramBlock = DISPCNT_VRAMBLOCK(p) ;
|
||||
gpu->vramBlock = cnt->FrameBufferSelect;
|
||||
return;
|
||||
case 3: // Display from Main RAM
|
||||
LOG("FIXME: Display Mode 3 not supported(Display from Main RAM)\n");
|
||||
|
@ -145,7 +148,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
|
|||
}
|
||||
|
||||
gpu->nbBGActif = 0;
|
||||
if(DISPCNT_OBJMAPING1D(p))
|
||||
if(cnt->SpriteMode & 0x1)
|
||||
{
|
||||
/* 1-d sprite mapping */
|
||||
|
||||
|
@ -172,14 +175,14 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
|
|||
gpu->sprBMPBlock = 7;
|
||||
}
|
||||
|
||||
gpu->sprEnable = DISPCNT_SPRITEENABLE(p) ;
|
||||
gpu->sprEnable = cnt->Sprite_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));
|
||||
GPU_setBGProp(gpu, 0, T1ReadWord(ARM9Mem.ARM9_REG, gpu->core * ADDRESS_STEP_4KB + 8));
|
||||
|
||||
if(DISPCNT_BG3ENABLED(p) && gpu->dispBG[3])
|
||||
if(cnt->BG3_Enable && gpu->dispBG[3])
|
||||
{
|
||||
gpu->ordre[0] = 3;
|
||||
gpu->BGIndex[3] = 1;
|
||||
|
@ -190,7 +193,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
|
|||
gpu->BGIndex[3] = 0;
|
||||
}
|
||||
|
||||
if(DISPCNT_BG2ENABLED(p) && gpu->dispBG[2])
|
||||
if(cnt->BG2_Enable && gpu->dispBG[2])
|
||||
{
|
||||
if(gpu->nbBGActif)
|
||||
{
|
||||
|
@ -221,7 +224,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
|
|||
gpu->BGIndex[2] = 0;
|
||||
}
|
||||
|
||||
if(DISPCNT_BG1ENABLED(p) && gpu->dispBG[1])
|
||||
if(cnt->BG1_Enable && gpu->dispBG[1])
|
||||
{
|
||||
if(gpu->nbBGActif == 0)
|
||||
{
|
||||
|
@ -248,7 +251,7 @@ void GPU_setVideoProp(GPU * gpu, u32 p)
|
|||
gpu->BGIndex[1] = 0;
|
||||
}
|
||||
|
||||
if(DISPCNT_BG0ENABLED(p) && (!(p & 0x8)) && gpu->dispBG[0])
|
||||
if(cnt->BG0_Enable && (!cnt->BG0_3D) && gpu->dispBG[0])
|
||||
{
|
||||
if(gpu->nbBGActif == 0)
|
||||
{
|
||||
|
@ -392,7 +395,7 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p)
|
|||
{
|
||||
gpu->BG_bmp_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + BGCNT_SCREENBASEBLOCK(p) * ADDRESS_STEP_16KB;
|
||||
gpu->BG_tile_ram[num] = ((u8 *)ARM9Mem.ARM9_ABG) + BGCNT_CHARBASEBLOCK(p) * ADDRESS_STEP_16KB + ((gpu->prop >> 24) & 0x7) * ADDRESS_STEP_64kB ;
|
||||
gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + BGCNT_SCREENBASEBLOCK(p) * ADDRESS_STEP_2KB + DISPCNT_SCREENBASEBLOCK(gpu->prop) * ADDRESS_STEP_64kB;
|
||||
gpu->BG_map_ram[num] = ARM9Mem.ARM9_ABG + BGCNT_SCREENBASEBLOCK(p) * ADDRESS_STEP_2KB + ((_DISPCNT_*)(&(gpu->prop)))->ScreenBaseBlock * ADDRESS_STEP_64kB;
|
||||
}
|
||||
|
||||
/*if(!(p&(1<<7)))
|
||||
|
@ -411,8 +414,8 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p)
|
|||
return;
|
||||
}*/
|
||||
|
||||
gpu->BGSize[num][0] = sizeTab[mode2type[DISPCNT_MODE(gpu->prop)][num]][BGCNT_SCREENSIZE(p)][0];
|
||||
gpu->BGSize[num][1] = sizeTab[mode2type[DISPCNT_MODE(gpu->prop)][num]][BGCNT_SCREENSIZE(p)][1];
|
||||
gpu->BGSize[num][0] = sizeTab[mode2type[gpu->dispMode][num]][BGCNT_SCREENSIZE(p)][0];
|
||||
gpu->BGSize[num][1] = sizeTab[mode2type[gpu->dispMode][num]][BGCNT_SCREENSIZE(p)][1];
|
||||
}
|
||||
|
||||
void GPU_remove(GPU * gpu, u8 num)
|
||||
|
@ -692,7 +695,7 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * DST, u16 X, u16 Y, u16 LG)
|
|||
}
|
||||
return;
|
||||
}
|
||||
if(!DISPCNT_USEEXTPAL(gpu->prop)) /* color: no extended palette */
|
||||
if(!((_DISPCNT_*)(&(gpu->prop)))->ExBGPalette_Enable) /* color: no extended palette */
|
||||
{
|
||||
yoff = ((Y&7)<<3);
|
||||
pal = ARM9Mem.ARM9_VMEM + gpu->core * ADDRESS_STEP_1KB ;
|
||||
|
|
|
@ -46,6 +46,29 @@ extern "C" {
|
|||
#define ADDRESS_STEP_32KB 0x08000
|
||||
#define ADDRESS_STEP_64kB 0x10000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*0*/ unsigned DisplayMode:3;
|
||||
/*3*/ unsigned BG0_3D:1;
|
||||
/*4*/ unsigned SpriteMode:3;
|
||||
/*7*/ unsigned ForceBlank:1;
|
||||
/*8*/ unsigned BG0_Enable:1;
|
||||
/*9*/ unsigned BG1_Enable:1;
|
||||
/*10*/ unsigned BG2_Enable:1;
|
||||
/*11*/ unsigned BG3_Enable:1;
|
||||
/*12*/ unsigned Sprite_Enable:1;
|
||||
/*13*/ unsigned Win0_Enable:1;
|
||||
/*14*/ unsigned Win1_Enable:1;
|
||||
/*15*/ unsigned SpriteWin_Enable:1;
|
||||
/*16*/ unsigned ExMode:2; // (00: Framebuffer, 01: GBA-style, 10: Framebuffer-alike, 11: ?)
|
||||
/*18*/ unsigned FrameBufferSelect:2; // ExMode 2
|
||||
/*20*/ unsigned ExSpriteMode:3;
|
||||
/*23*/ unsigned :4;
|
||||
/*27*/ unsigned ScreenBaseBlock:3;
|
||||
/*30*/ unsigned ExBGPalette_Enable:1;
|
||||
/*31*/ unsigned ExSpritePalette_Enable:1;
|
||||
} _DISPCNT_;
|
||||
|
||||
#define DISPCNT_OBJMAPING1D(val) (((val) >> 4) & 1)
|
||||
#define DISPCNT_BG0ENABLED(val) (((val) >> 8) & 1)
|
||||
#define DISPCNT_BG1ENABLED(val) (((val) >> 9) & 1)
|
||||
|
@ -72,22 +95,22 @@ typedef struct
|
|||
{
|
||||
// found here : http://www.bottledlight.com/ds/index.php/Video/Sprites
|
||||
// attr0
|
||||
unsigned Y:8;
|
||||
unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale)
|
||||
unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap)
|
||||
unsigned Mosaic:1; // (1: Enabled)
|
||||
unsigned Depth:1; // (0: 16, 1: 256)
|
||||
unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal)
|
||||
/*0*/ unsigned Y:8;
|
||||
/*8*/ unsigned RotScale:2; // (00: Normal, 01: Rot/scale, 10: Disabled, 11: Double-size rot/scale)
|
||||
/*10*/ unsigned Mode:2; // (00: Normal, 01: Transparent, 10: Object window, 11: Bitmap)
|
||||
/*12*/ unsigned Mosaic:1; // (1: Enabled)
|
||||
/*13*/ unsigned Depth:1; // (0: 16, 1: 256)
|
||||
/*14*/ unsigned Shape:2; // (00: Square, 01: Wide, 10: Tall, 11: Illegal)
|
||||
// attr1
|
||||
unsigned X:9;
|
||||
unsigned RotScalIndex:3; // Rot/scale matrix index
|
||||
unsigned HFlip:1;
|
||||
unsigned VFlip:1;
|
||||
unsigned Size:2;
|
||||
/*0*/ signed X:9;
|
||||
/*9*/ unsigned RotScalIndex:3; // Rot/scale matrix index
|
||||
/*12*/ unsigned HFlip:1;
|
||||
/*13*/ unsigned VFlip:1;
|
||||
/*14*/ unsigned Size:2;
|
||||
// attr2
|
||||
unsigned TileIndex:10;
|
||||
unsigned Priority:2;
|
||||
unsigned PaletteIndex:4;
|
||||
/*0*/ unsigned TileIndex:10;
|
||||
/*10*/ unsigned Priority:2;
|
||||
/*12*/ unsigned PaletteIndex:4;
|
||||
// attr3
|
||||
unsigned attr3:16;
|
||||
} _OAM_;
|
||||
|
|
Loading…
Reference in New Issue