diff --git a/Cxbx.dsp b/Cxbx.dsp index 1304ad31f..978e8018f 100644 --- a/Cxbx.dsp +++ b/Cxbx.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="Cxbx" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 60000 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Application" 0x0101 diff --git a/Include/Win32/CxbxKrnl/xd3d8.h b/Include/Win32/CxbxKrnl/xd3d8.h index 4b507a462..baeb7b77e 100644 --- a/Include/Win32/CxbxKrnl/xd3d8.h +++ b/Include/Win32/CxbxKrnl/xd3d8.h @@ -245,6 +245,19 @@ struct X_D3DSurface : public X_D3DPixelContainer }; +// ****************************************************************** +// * X_D3DTILE +// ****************************************************************** +struct X_D3DTILE +{ + DWORD Flags; + PVOID pMemory; + DWORD Size; + DWORD Pitch; + DWORD ZStartTag; + DWORD ZOffset; +}; + // ****************************************************************** // * D3DVertexToPrimitive // ****************************************************************** @@ -363,6 +376,24 @@ HRESULT WINAPI EmuIDirect3DDevice8_GetDepthStencilSurface // ****************************************************************** X_D3DSurface * WINAPI EmuIDirect3DDevice8_GetDepthStencilSurface2(); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_GetTile +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_GetTile +( + DWORD Index, + X_D3DTILE *pTile +); + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetTileNoWait +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_SetTileNoWait +( + DWORD Index, + CONST X_D3DTILE *pTile +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_CreateVertexShader // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl b/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl index 698bda206..be088ca44 100644 --- a/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl @@ -157,6 +157,64 @@ SOOVPA<10> IDirect3DDevice8_GetDepthStencilSurface2_1_0_4627 = } }; +// ****************************************************************** +// * IDirect3DDevice8_GetTile +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_GetTile_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + { + // IDirect3DDevice8_GetTile+0x13 : lea esi, [ecx+eax*8+0x2260] + { 0x13, 0x8D }, // (Offset,Value)-Pair #1 + { 0x14, 0xB4 }, // (Offset,Value)-Pair #2 + { 0x15, 0xC1 }, // (Offset,Value)-Pair #3 + { 0x16, 0x60 }, // (Offset,Value)-Pair #4 + { 0x17, 0x22 }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_GetTile+0x1A : mov ecx, 0x06 + { 0x1A, 0xB9 }, // (Offset,Value)-Pair #6 + { 0x1B, 0x06 }, // (Offset,Value)-Pair #7 + + // IDirect3DDevice8_GetTile+0x5F : pop edi; pop esi + { 0x21, 0x5F }, // (Offset,Value)-Pair #8 + { 0x22, 0x5E }, // (Offset,Value)-Pair #9 + + // IDirect3DDevice8_GetTile+0x23 : retn 0x08 + { 0x23, 0xC2 }, // (Offset,Value)-Pair #10 + { 0x24, 0x08 }, // (Offset,Value)-Pair #11 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetTileNoWait +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_SetTileNoWait_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + { + // IDirect3DDevice8_SetTileNoWait+0x06 : sub esp, 0x18 + { 0x06, 0x83 }, // (Offset,Value)-Pair #1 + { 0x07, 0xEC }, // (Offset,Value)-Pair #2 + { 0x08, 0x18 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_SetTileNoWait+0x15 : cmp [esi+4], eax + { 0x15, 0x39 }, // (Offset,Value)-Pair #4 + { 0x16, 0x46 }, // (Offset,Value)-Pair #5 + { 0x17, 0x04 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetTileNoWait+0x3D : lea edi, [edx+ecx*8+0x2260] + { 0x3D, 0x8D }, // (Offset,Value)-Pair #7 + { 0x3E, 0xBC }, // (Offset,Value)-Pair #8 + { 0x3F, 0xCA }, // (Offset,Value)-Pair #9 + { 0x40, 0x60 }, // (Offset,Value)-Pair #10 + { 0x41, 0x22 }, // (Offset,Value)-Pair #11 + } +}; + // ****************************************************************** // * IDirect3DDevice8_SetVertexShaderConstant // ****************************************************************** @@ -848,6 +906,26 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_GetDepthStencilSurface2" #endif }, + // IDirect3DDevice8::GetTile + { + (OOVPA*)&IDirect3DDevice8_GetTile_1_0_4627, + + xd3d8::EmuIDirect3DDevice8_GetTile, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetTile" + #endif + }, + // IDirect3DDevice8::SetTileNoWait + { + (OOVPA*)&IDirect3DDevice8_SetTileNoWait_1_0_4627, + + xd3d8::EmuIDirect3DDevice8_SetTileNoWait, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTileNoWait" + #endif + }, // IDirect3DDevice8::CreateVertexShader (* unchanged since 4361 *) { (OOVPA*)&IDirect3DDevice8_CreateVertexShader_1_0_4361, diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 2146df75f..ffbb32996 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -796,19 +796,19 @@ HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_GetDepthStencilSurface } // ****************************************************************** -// * func: EmuIDirect3DDevice8_GetDepthStencilSurface +// * func: EmuIDirect3DDevice8_GetDepthStencilSurface2 // ****************************************************************** xd3d8::X_D3DSurface * WINAPI xd3d8::EmuIDirect3DDevice8_GetDepthStencilSurface2() { + EmuSwapFS(); // Win2k/XP FS + // ****************************************************************** // * debug trace // ****************************************************************** #ifdef _DEBUG_TRACE { - EmuSwapFS(); // Win2k/XP FS printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDepthStencilSurface2()\n", GetCurrentThreadId()); - EmuSwapFS(); // Xbox FS } #endif @@ -816,9 +816,75 @@ xd3d8::X_D3DSurface * WINAPI xd3d8::EmuIDirect3DDevice8_GetDepthStencilSurface2( pSurface8->AddRef(); + EmuSwapFS(); // Xbox FS + return g_pCachedZStencilSurface; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_GetTile +// ****************************************************************** +HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_GetTile +( + DWORD Index, + X_D3DTILE *pTile +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetTile\n" + "(\n" + " Index : 0x%.08X\n" + " pTile : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pTile); + } + #endif + + printf("*Warning* we are ignoring IDirect3DDevice8::GetTile\n"); + + EmuSwapFS(); // XBox FS + + return D3D_OK; +} + +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetTileNoWait +// ****************************************************************** +HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_SetTileNoWait +( + DWORD Index, + CONST X_D3DTILE *pTile +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTileNoWait\n" + "(\n" + " Index : 0x%.08X\n" + " pTile : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pTile); + } + #endif + + printf("*Warning* we are ignoring IDirect3DDevice8::SetTileNoWait\n"); + + EmuSwapFS(); // XBox FS + + return D3D_OK; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_CreateVertexShader // ****************************************************************** @@ -859,6 +925,9 @@ HRESULT WINAPI xd3d8::EmuIDirect3DDevice8_CreateVertexShader g_dwVertexShaderUsage // TODO: HACK: Xbox has extensions! ); + if(FAILED(hRet)) + printf("*Warning* we're lying about the creation of a vertex shader!"); + // hey look, we lied hRet = D3D_OK;