Activate render window before entering message dispatch loop to avoid deadlock when the message queue is empty.

Set reference count in X_D3DResource::Common field. Titles may check this value to see if a resource is registered. "Special" resources are ignored for now due to the use of the Common field to identify them.

Register D3DFMT_A8 textures. Not supported by all devices, we should check and expand to another format if necessary.

Added XDK 5849 D3D8 OOVPAs.
- IDirect3DDevice8::BeginVisibilityTest, reused from 4627
- IDirect3DDevice8::EndVisibilityTest
- IDirect3DDevice8::GetVisibilityTestResult
- IDirect3DDevice8::GetViewport
- IDirect3DDevice8::CopyRects, reused from 5233

Minor texture coordinate normalization condition fix.
This commit is contained in:
Daniel Stien 2008-09-09 18:44:52 +00:00
parent 86dfc8027c
commit 46410680e8
4 changed files with 137 additions and 6 deletions

View File

@ -377,12 +377,12 @@ static DWORD WINAPI EmuRenderWindow(LPVOID lpVoid)
bool lPrintfOn = g_bPrintfOn;
g_bRenderWindowActive = true;
while(msg.message != WM_QUIT)
{
if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
g_bRenderWindowActive = true;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@ -4156,7 +4156,9 @@ HRESULT WINAPI XTL::EmuIDirect3DResource8_Register
dwPitch = dwWidth*2;
dwBPP = 2;
}
else if(X_Format == 0x00 /* X_D3DFMT_L8 */ || X_Format == 0x0B /* X_D3DFMT_P8 */ || X_Format == 0x01 /* X_D3DFMT_AL8 */ || X_Format == 0x1A /* X_D3DFMT_A8L8 */)
else if(X_Format == 0x00 /* X_D3DFMT_L8 */ || X_Format == 0x0B /* X_D3DFMT_P8 */
|| X_Format == 0x01 /* X_D3DFMT_AL8 */ || X_Format == 0x1A /* X_D3DFMT_A8L8 */
|| X_Format == 0x19 /* X_D3DFMT_A8 */)
{
bSwizzled = TRUE;
@ -4641,6 +4643,8 @@ ULONG WINAPI XTL::EmuIDirect3DResource8_AddRef
uRet = ++pThis->Lock;
else if(pResource8 != 0)
uRet = pResource8->AddRef();
pThis->Common = (pThis->Common & ~X_D3DCOMMON_REFCOUNT_MASK) | ((pThis->Common & X_D3DCOMMON_REFCOUNT_MASK) + 1);
}
EmuSwapFS(); // XBox FS
@ -4725,8 +4729,11 @@ ULONG WINAPI XTL::EmuIDirect3DResource8_Release
//delete pThis;
}
}
pThis->Common = (pThis->Common & ~X_D3DCOMMON_REFCOUNT_MASK) | ((pThis->Common & X_D3DCOMMON_REFCOUNT_MASK) - 1);
}
EmuSwapFS(); // XBox FS
return uRet;

View File

@ -45,6 +45,7 @@ BOOL XTL::EmuXBFormatIsSwizzled(X_D3DFORMAT Format, DWORD *pBPP)
case 0x00:
case 0x01:
case 0x0B:
case 0x19: // X_D3DFMT_A8
*pBPP = 1;
return TRUE;
case 0x02:

View File

@ -412,10 +412,16 @@ bool XTL::VertexPatcher::PatchStream(VertexPatchDesc *pPatchDesc,
{
// FVF buffers doesn't have Xbox extensions, but texture coordinates may
// need normalization if used with linear textures.
if(!VshHandleIsVertexShader(pPatchDesc->hVertexShader)
&& (pPatchDesc->hVertexShader & D3DFVF_TEXCOUNT_MASK))
if(!VshHandleIsVertexShader(pPatchDesc->hVertexShader))
{
return NormalizeTexCoords(pPatchDesc, uiStream);
if(pPatchDesc->hVertexShader & D3DFVF_TEXCOUNT_MASK)
{
return NormalizeTexCoords(pPatchDesc, uiStream);
}
else
{
return false;
}
}
if(!m_pDynamicPatch || !m_pDynamicPatch->pStreamPatches[uiStream].NeedPatch)

View File

@ -32,6 +32,73 @@
// *
// ******************************************************************
// ******************************************************************
// * IDirect3DDevice8_EndVisibilityTest
// ******************************************************************
SOOVPA<7> IDirect3DDevice8_EndVisibilityTest_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // XRef Not Saved
0, // XRef Not Used
{
{ 0x10, 0x09 },
{ 0x12, 0x0E },
{ 0x18, 0x04 },
{ 0x34, 0xCC },
{ 0x3D, 0x0E },
{ 0x50, 0x0C },
{ 0x58, 0x04 },
}
};
// ******************************************************************
// * IDirect3DDevice8_GetVisibilityTestResult
// ******************************************************************
SOOVPA<7> IDirect3DDevice8_GetVisibilityTestResult_1_0_5849 =
{
0, // Large == 0
7, // Count == 7
-1, // XRef Not Saved
0, // XRef Not Used
{
{ 0x0E, 0x08 },
{ 0x10, 0xFF },
{ 0x2A, 0x16 },
{ 0x3C, 0x76 },
{ 0x3F, 0x0C },
{ 0x51, 0x0A },
{ 0x5F, 0x0C },
}
};
// ******************************************************************
// * IDirect3DDevice8_GetViewport
// ******************************************************************
SOOVPA<8> IDirect3DDevice8_GetViewport_1_0_5849 =
{
0, // Large == 0
8, // Count == 8
-1, // XRef Not Saved
0, // XRef Not Used
{
{ 0x09, 0x05 },
{ 0x14, 0x04 },
{ 0x1D, 0x08 },
{ 0x20, 0x0C },
{ 0x26, 0x10 },
{ 0x2B, 0x40 },
{ 0x2F, 0x14 },
{ 0x31, 0x04 },
}
};
// ******************************************************************
// * IDirect3DDevice8_SetBackBufferScale
// ******************************************************************
@ -811,6 +878,46 @@ OOVPATable D3D8_1_0_5849[] =
"EmuIDirect3D8_CreateDevice"
#endif
},
// IDirect3DDevice8::BeginVisibilityTest (* unchanged since 4627 *)
{
(OOVPA*)&IDirect3DDevice8_BeginVisibilityTest_1_0_4627,
XTL::EmuIDirect3DDevice8_BeginVisibilityTest,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_BeginVisibilityTest"
#endif
},
// IDirect3DDevice8::EndVisibilityTest
{
(OOVPA*)&IDirect3DDevice8_EndVisibilityTest_1_0_5849,
XTL::EmuIDirect3DDevice8_EndVisibilityTest,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_EndVisibilityTest"
#endif
},
// IDirect3DDevice8::GetVisibilityTestResult
{
(OOVPA*)&IDirect3DDevice8_GetVisibilityTestResult_1_0_5849,
XTL::EmuIDirect3DDevice8_GetVisibilityTestResult,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_GetVisibilityTestResult"
#endif
},
// IDirect3DDevice8::GetViewport
{
(OOVPA*)&IDirect3DDevice8_GetViewport_1_0_5849,
XTL::EmuIDirect3DDevice8_GetViewport,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_GetViewport"
#endif
},
// IDirect3DDevice8::SetBackBufferScale
{
(OOVPA*)&IDirect3DDevice8_SetBackBufferScale_1_0_5849,
@ -1352,6 +1459,16 @@ OOVPATable D3D8_1_0_5849[] =
"EmuIDirect3DSurface8_GetDesc"
#endif
},
// IDirect3DDevice8::CopyRects (* unchanged since 5233 *)
{
(OOVPA*)&IDirect3DDevice8_CopyRects_1_0_5233,
XTL::EmuIDirect3DDevice8_CopyRects,
#ifdef _DEBUG_TRACE
"EmuIDirect3DDevice8_CopyRects"
#endif
},
// IDirect3DTexture8::LockRect
{
(OOVPA*)&IDirect3DTexture8_LockRect_1_0_5849,