1) XFB in DC proposal. This impact video plugin interface. WARNING: XFB_Draw is not CPU->VI dependent anymore. It's up to GP now. Except for some 2D homebrews which never use GPfifo&CP but direcly XFB. Well, in other words: emulated VSync is uncorrelated with CPU timings now. Tell me if it's too much hacky.

2) DC/GPfifo work: GP quicker to react. PeekMessages at a more steady rate.
3) Fix XFB address to avoid crash like with Animal Crossing gc. TODO: VI regs need proper typedef and logic.
4) Few misc. changes on the fly.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2001 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
memberTwo.mb2
2009-01-24 14:43:17 +00:00
parent fa7e857161
commit 1e7655b5db
15 changed files with 148 additions and 47 deletions

View File

@ -442,7 +442,13 @@ void BPWritten(int addr, int changes, int newval)
// the number of lines copied is determined by the y scale * source efb height
float yScale = bpmem.dispcopyyscale / 256.0f;
float xfbLines = bpmem.copyTexSrcWH.y + 1.0f * yScale;
XFB_Write(Memory_GetPtr(bpmem.copyTexDest << 5), multirc, (bpmem.copyMipMapStrideChannels << 4), (int)xfbLines);
//XFB_Write(Memory_GetPtr(bpmem.copyTexDest << 5), multirc, (bpmem.copyMipMapStrideChannels << 4), (int)xfbLines);
// TODO: compact this below if everyone is happy with it
u8* pXFB = Memory_GetPtr(bpmem.copyTexDest << 5);
u32 dstWidth = (bpmem.copyMipMapStrideChannels << 4);
u32 dstHeight = (u32)xfbLines;
XFB_Write(pXFB, multirc, dstWidth, dstHeight);
XFB_Draw(pXFB, dstWidth, dstHeight, 0);
}
else
{

View File

@ -39,6 +39,16 @@ enum {
static GLuint xfb_decoded_texture;
static int XFBInitStatus = 0;
static struct
{
u8* pXFB;
u32 width;
u32 height;
s32 yOffset;
} tUpdateXFBArgs;
void XFB_SetUpdateArgs(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset);
void XFB_Init()
{
@ -108,6 +118,19 @@ void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset)
GL_REPORT_ERRORD();
}
void XFB_Draw()
{
XFB_Draw(tUpdateXFBArgs.pXFB, tUpdateXFBArgs.width, tUpdateXFBArgs.height, tUpdateXFBArgs.yOffset);
}
void XFB_SetUpdateArgs(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset)
{
tUpdateXFBArgs.pXFB = _pXFB;
tUpdateXFBArgs.width = _dwWidth;
tUpdateXFBArgs.height = _dwHeight;
tUpdateXFBArgs.yOffset = _dwYOffset;
}
#else
static GLuint xfb_texture;

View File

@ -27,9 +27,12 @@ void XFB_Write(u8 *xfb_in_ram, const TRectangle& sourceRc, u32 dstWd, u32 dstHt)
// draw the XFB to the screen
void XFB_Draw(u8 *xfb_in_ram, u32 width, u32 height, s32 yOffset);
void XFB_Draw();
void XFB_Shutdown();
int XFB_isInit();
void XFB_SetUpdateArgs(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset);
#endif

View File

@ -360,12 +360,23 @@ unsigned int Video_Screenshot(TCHAR* _szFilename)
return FALSE;
}
void Video_UpdateXFB(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset)
void Video_UpdateXFB(u8* _pXFB, u32 _dwWidth, u32 _dwHeight, s32 _dwYOffset, BOOL scheduling)
{
if(g_Config.bUseXFB)
if(g_Config.bUseXFB && XFB_isInit())
{
if (XFB_isInit())
XFB_Draw(_pXFB, _dwWidth, _dwHeight, _dwYOffset);
if (scheduling) // DC mode
{
XFB_SetUpdateArgs(_pXFB, _dwWidth, _dwHeight, _dwYOffset);
g_XFBUpdateRequested = TRUE;
}
else // SC mode or DC without fifo&CP
{
if (_pXFB) // from CPU
XFB_Draw(_pXFB, _dwWidth, _dwHeight, _dwYOffset);
else // from GP
XFB_Draw();
}
}
}