diff --git a/Cxbx.opt b/Cxbx.opt index 3854948d6..11e8fe5bd 100644 Binary files a/Cxbx.opt and b/Cxbx.opt differ diff --git a/Include/Cxbx.h b/Include/Cxbx.h index 749acd44b..0b11d21c1 100644 --- a/Include/Cxbx.h +++ b/Include/Cxbx.h @@ -55,10 +55,10 @@ typedef signed short sint16; typedef signed long sint32; // define this to trace intercepted function calls -//#define _DEBUG_TRACE +#define _DEBUG_TRACE // define this to trace warnings -//#define _DEBUG_WARNINGS +#define _DEBUG_WARNINGS // version information #ifndef _DEBUG_TRACE diff --git a/Include/Win32/CxbxKrnl/EmuD3D8.h b/Include/Win32/CxbxKrnl/EmuD3D8.h index b18906390..89ea1c34d 100644 --- a/Include/Win32/CxbxKrnl/EmuD3D8.h +++ b/Include/Win32/CxbxKrnl/EmuD3D8.h @@ -382,6 +382,16 @@ HRESULT WINAPI EmuIDirect3DDevice8_EndVisibilityTest DWORD Index ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_GetVisibilityTestResult +// ****************************************************************** +HRESULT WINAPI EmuIDirect3DDevice8_GetVisibilityTestResult +( + DWORD Index, + UINT *pResult, + ULONGLONG *pTimeStamp +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_LoadVertexShader // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 1abe8ccc3..ee3299254 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -953,6 +953,44 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_EndVisibilityTest return D3D_OK; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_GetVisibilityTestResult +// ****************************************************************** +HRESULT WINAPI XTL::EmuIDirect3DDevice8_GetVisibilityTestResult +( + DWORD Index, + UINT *pResult, + ULONGLONG *pTimeStamp +) +{ + EmuSwapFS(); // Win2k/XP FS + + // debug trace + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetVisibilityTestResult\n" + "(\n" + " Index : 0x%.08X\n" + " pResult : 0x%.08X\n" + " pTimeStamp : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Index, pResult, pTimeStamp); + } + #endif + + // TODO: actually emulate this!? + + if(pResult != 0) + *pResult = 0; + + if(pTimeStamp != 0) + *pTimeStamp = 0; + + EmuSwapFS(); // XBox FS + + return D3D_OK; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_GetDeviceCaps // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl b/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl index ddb790950..c5ce21f17 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4627.inl @@ -156,6 +156,37 @@ SOOVPA<13> IDirect3DDevice8_EndVisibilityTest_1_0_4627 = } }; +// ****************************************************************** +// * IDirect3DDevice8_GetVisibilityTestResult +// ****************************************************************** +SOOVPA<11> IDirect3DDevice8_GetVisibilityTestResult_1_0_4627 = +{ + 0, // Large == 0 + 11, // Count == 11 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_GetVisibilityTestResult+0x0C : shr ecx, 8 + { 0x0C, 0xC1 }, // (Offset,Value)-Pair #1 + { 0x0D, 0xE9 }, // (Offset,Value)-Pair #2 + { 0x0E, 0x08 }, // (Offset,Value)-Pair #3 + + // IDirect3DDevice8_GetVisibilityTestResult+0x0F : and eax, 0xFF + { 0x0F, 0x25 }, // (Offset,Value)-Pair #4 + { 0x10, 0xFF }, // (Offset,Value)-Pair #5 + { 0x11, 0x00 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_GetVisibilityTestResult+0x2B : mov eax, 0x88760828 + { 0x2B, 0xB8 }, // (Offset,Value)-Pair #7 + { 0x2C, 0x28 }, // (Offset,Value)-Pair #8 + { 0x2D, 0x08 }, // (Offset,Value)-Pair #9 + { 0x2E, 0x76 }, // (Offset,Value)-Pair #10 + { 0x2F, 0x88 }, // (Offset,Value)-Pair #11 + } +}; + // ****************************************************************** // * IDirect3D8_GetAdapterDisplayMode // ****************************************************************** @@ -1715,6 +1746,16 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_EndVisibilityTest" #endif }, + // IDirect3DDevice8::GetVisibilityTestResult + { + (OOVPA*)&IDirect3DDevice8_GetVisibilityTestResult_1_0_4627, + + XTL::EmuIDirect3DDevice8_GetVisibilityTestResult, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_GetVisibilityTestResult" + #endif + }, // IDirect3D8::GetAdapterModeCount (* unchanged since 4361 *) { (OOVPA*)&IDirect3D8_GetAdapterModeCount_1_0_4361,