-fix render & OSD (moved to gpu.cpp)
This commit is contained in:
parent
7e4d70f2b8
commit
93a6318a42
|
@ -90,6 +90,8 @@ OSDCLASS *osd = NULL;
|
|||
OSDCLASS *osdA = NULL;
|
||||
OSDCLASS *osdB = NULL;
|
||||
|
||||
u16 gpu_angle = 0;
|
||||
|
||||
const short sizeTab[4][4][2] =
|
||||
{
|
||||
{{256,256}, {512, 256}, {256, 512}, {512, 512}},
|
||||
|
@ -3355,6 +3357,54 @@ void GPU::setAffineStart(int layer, int xy, u32 val)
|
|||
else affineInfo[layer-2].y = val;
|
||||
}
|
||||
|
||||
void gpu_UpdateRender()
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
u16 *src = (u16*)GPU_tempScreen;
|
||||
u16 *dst = (u16*)GPU_screen;
|
||||
|
||||
switch (gpu_angle)
|
||||
{
|
||||
case 0:
|
||||
memcpy(dst, src, 256*192*4);
|
||||
break;
|
||||
|
||||
case 90:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[(383 - y) + (x * 384)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 180:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[(255 - x) + ((383 - y) * 256)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 270:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[y + ((255 - x) * 384)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void gpu_SetRotateScreen(u16 angle)
|
||||
{
|
||||
gpu_angle = angle;
|
||||
}
|
||||
|
||||
//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.
|
||||
//static void __setFinalColorBck(GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, bool opaque)
|
||||
|
|
|
@ -912,5 +912,9 @@ void SetupFinalPixelBlitter (GPU *gpu);
|
|||
#define GPU_setBGxHOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxHOFS = (val & 0x1F)
|
||||
#define GPU_setBGxVOFS(bg, gpu, val) gpu->dispx_st->dispx_BGxOFS[bg].BGxVOFS = (val & 0x1F)
|
||||
|
||||
// render
|
||||
void gpu_UpdateRender();
|
||||
void gpu_SetRotateScreen(u16 angle);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -143,55 +143,10 @@ void OSDCLASS::setColor(u16 col)
|
|||
|
||||
void OSDCLASS::update() // don't optimized
|
||||
{
|
||||
//if (!needUpdate) return; // don't update if buffer empty (speed up)
|
||||
if (!needUpdate) return; // don't update if buffer empty (speed up)
|
||||
|
||||
int x, y;
|
||||
u16 *src = (u16*)GPU_tempScreen;
|
||||
u16 *dst = (u16*)GPU_screen;
|
||||
|
||||
switch(rotAngle)
|
||||
{
|
||||
case 0:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[x + (y * 256)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 90:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[(383 - y) + (x * 384)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 180:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[(255 - x) + ((383 - y) * 256)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 270:
|
||||
for(y = 0; y < 384; y++)
|
||||
{
|
||||
for(x = 0; x < 256; x++)
|
||||
{
|
||||
dst[y + ((255 - x) * 384)] = src[x + (y * 256)];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode!=255)
|
||||
dst+=offset*512;
|
||||
|
||||
|
|
|
@ -1217,7 +1217,7 @@ u32 NDS_exec(s32 nb)
|
|||
nds.lignerendu = FALSE;
|
||||
if(nds.VCount==192)
|
||||
{
|
||||
//osdA->update(); //================================= this is don't correct, need swap engine
|
||||
//osdA->update();
|
||||
gfx3d_VBlankSignal();
|
||||
|
||||
T1WriteWord(ARM9Mem.ARM9_REG, 4, T1ReadWord(ARM9Mem.ARM9_REG, 4) | 1);
|
||||
|
@ -1257,7 +1257,8 @@ u32 NDS_exec(s32 nb)
|
|||
else if(nds.VCount==263)
|
||||
{
|
||||
//osd->update();
|
||||
//osdB->update(); //================================= this is don't correct, need swap engine
|
||||
//osdB->update();
|
||||
gpu_UpdateRender();
|
||||
|
||||
nds.nextHBlank = 3168;
|
||||
nds.VCount = 0;
|
||||
|
@ -1783,6 +1784,7 @@ u32 NDS_exec(s32 nb)
|
|||
} // if(!nds.sleeping)
|
||||
else
|
||||
{
|
||||
gpu_UpdateRender();
|
||||
if((MMU.reg_IE[1] & MMU.reg_IF[1]) & (1<<22))
|
||||
{
|
||||
nds.sleeping = FALSE;
|
||||
|
|
|
@ -621,7 +621,7 @@ void Display()
|
|||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags=DDSD_ALL;
|
||||
res=IDirectDrawSurface7_Lock(lpBackSurface,NULL,&ddsd,DDLOCK_WAIT, NULL);
|
||||
|
||||
|
||||
if (res == DD_OK)
|
||||
{
|
||||
char* buffer = (char*)ddsd.lpSurface;
|
||||
|
@ -1231,6 +1231,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
gpu_SetRotateScreen(GPU_rotation);
|
||||
|
||||
/* default the firmware settings, they may get changed later */
|
||||
NDS_FillDefaultFirmwareConfigData( &win_fw_config);
|
||||
|
||||
|
@ -1605,6 +1607,8 @@ void SetRotate(HWND hwnd, int rot)
|
|||
MainWindow->checkMenu(IDC_ROTATE180, MF_BYCOMMAND | ((GPU_rotation==180)?MF_CHECKED:MF_UNCHECKED));
|
||||
MainWindow->checkMenu(IDC_ROTATE270, MF_BYCOMMAND | ((GPU_rotation==270)?MF_CHECKED:MF_UNCHECKED));
|
||||
WritePrivateProfileInt("Video","Window Rotate",GPU_rotation,IniName);
|
||||
|
||||
gpu_SetRotateScreen(GPU_rotation);
|
||||
}
|
||||
|
||||
static void AviEnd()
|
||||
|
|
Loading…
Reference in New Issue