diff --git a/Include/Cxbx.h b/Include/Cxbx.h index 9295e77e7..7396854f9 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 d3724e182..f1d5eb180 100644 --- a/Include/Win32/CxbxKrnl/EmuD3D8.h +++ b/Include/Win32/CxbxKrnl/EmuD3D8.h @@ -566,9 +566,9 @@ HRESULT WINAPI EmuIDirect3D8_CreateDevice ); // ****************************************************************** -// * func: EmuIDirect3D8_GetDeviceCaps +// * func: EmuIDirect3DDevice8_GetDeviceCaps // ****************************************************************** -HRESULT WINAPI EmuIDirect3D8_GetDeviceCaps +VOID WINAPI EmuIDirect3DDevice8_GetDeviceCaps ( D3DCAPS8 *pCaps ); diff --git a/Source/Win32/CxbxKrnl/D3D8.1.0.3925.inl b/Source/Win32/CxbxKrnl/D3D8.1.0.3925.inl index ca5ef2b73..a13a9a742 100644 --- a/Source/Win32/CxbxKrnl/D3D8.1.0.3925.inl +++ b/Source/Win32/CxbxKrnl/D3D8.1.0.3925.inl @@ -63,9 +63,9 @@ SOOVPA<8> IDirect3D8_CreateDevice_1_0_3925 = }; // ****************************************************************** -// * IDirect3D8_GetDeviceCaps +// * IDirect3DDevice8_GetDeviceCaps // ****************************************************************** -SOOVPA<11> IDirect3D8_GetDeviceCaps_1_0_3925 = +SOOVPA<11> IDirect3DDevice8_GetDeviceCaps_1_0_3925 = { 0, // Large == 0 11, // Count == 11 @@ -74,22 +74,22 @@ SOOVPA<11> IDirect3D8_GetDeviceCaps_1_0_3925 = 0, // XRef Not Used { - // IDirect3D8_GetDeviceCaps+0x00 : push esi; push edi + // IDirect3DDevice8_GetDeviceCaps+0x00 : push esi; push edi { 0x00, 0x56 }, // (Offset,Value)-Pair #1 { 0x01, 0x57 }, // (Offset,Value)-Pair #2 - // IDirect3D8_GetDeviceCaps+0x06 : mov ecx, 0x35 + // IDirect3DDevice8_GetDeviceCaps+0x06 : mov ecx, 0x35 { 0x06, 0xB9 }, // (Offset,Value)-Pair #3 { 0x07, 0x35 }, // (Offset,Value)-Pair #4 { 0x08, 0x00 }, // (Offset,Value)-Pair #5 { 0x09, 0x00 }, // (Offset,Value)-Pair #6 { 0x0A, 0x00 }, // (Offset,Value)-Pair #7 - // IDirect3D8_GetDeviceCaps+0x10 : rep movsd + // IDirect3DDevice8_GetDeviceCaps+0x10 : rep movsd { 0x10, 0xF3 }, // (Offset,Value)-Pair #8 { 0x11, 0xA5 }, // (Offset,Value)-Pair #9 - // IDirect3D8_GetDeviceCaps+0x14 : retn 0x04 + // IDirect3DDevice8_GetDeviceCaps+0x14 : retn 0x04 { 0x14, 0xC2 }, // (Offset,Value)-Pair #10 { 0x15, 0x04 }, // (Offset,Value)-Pair #11 } @@ -1852,14 +1852,14 @@ OOVPATable D3D8_1_0_3925[] = "EmuIDirect3D8_CreateDevice" #endif }, - // IDirect3D8::GetDeviceCaps + // IDirect3DDevice8::GetDeviceCaps { - (OOVPA*)&IDirect3D8_GetDeviceCaps_1_0_3925, + (OOVPA*)&IDirect3DDevice8_GetDeviceCaps_1_0_3925, - XTL::EmuIDirect3D8_GetDeviceCaps, + XTL::EmuIDirect3DDevice8_GetDeviceCaps, #ifdef _DEBUG_TRACE - "EmuIDirect3D8_GetDeviceCaps" + "EmuIDirect3DDevice8_GetDeviceCaps" #endif }, // IDirect3DDevice8::Release diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 666d383a8..a7960ce37 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -753,10 +753,15 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CreateDevice g_EmuCDPD.pPresentationParameters = pPresentationParameters; g_EmuCDPD.ppReturnedDeviceInterface = ppReturnedDeviceInterface; + // Wait until proxy is done with an existing call (i highly doubt this situation will come up) + while(g_EmuCDPD.bReady) + Sleep(10); + // Signal proxy thread, and wait for completion g_EmuCDPD.bReady = true; g_EmuCDPD.bCreate = true; + // Wait until proxy is completed while(g_EmuCDPD.bReady) Sleep(10); @@ -766,9 +771,9 @@ HRESULT WINAPI XTL::EmuIDirect3D8_CreateDevice } // ****************************************************************** -// * func: EmuIDirect3D8_GetDeviceCaps +// * func: EmuIDirect3DDevice8_GetDeviceCaps // ****************************************************************** -HRESULT WINAPI XTL::EmuIDirect3D8_GetDeviceCaps +VOID WINAPI XTL::EmuIDirect3DDevice8_GetDeviceCaps ( D3DCAPS8 *pCaps ) @@ -780,7 +785,7 @@ HRESULT WINAPI XTL::EmuIDirect3D8_GetDeviceCaps // ****************************************************************** #ifdef _DEBUG_TRACE { - printf("EmuD3D8 (0x%X): EmuIDirect3D8_GetDeviceCaps\n" + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_GetDeviceCaps\n" "(\n" " pCaps : 0x%.08X\n" ");\n", @@ -788,11 +793,11 @@ HRESULT WINAPI XTL::EmuIDirect3D8_GetDeviceCaps } #endif - HRESULT hRet = g_pD3D8->GetDeviceCaps(g_XBVideo.GetDisplayAdapter(), (g_XBVideo.GetDirect3DDevice() == 0) ? XTL::D3DDEVTYPE_HAL : XTL::D3DDEVTYPE_REF, pCaps); + g_pD3D8->GetDeviceCaps(g_XBVideo.GetDisplayAdapter(), (g_XBVideo.GetDirect3DDevice() == 0) ? XTL::D3DDEVTYPE_HAL : XTL::D3DDEVTYPE_REF, pCaps); EmuSwapFS(); // XBox FS - return hRet; + return; } // ****************************************************************** @@ -4214,7 +4219,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_EdgeAntiAlias // TODO: Analyze performance and compatibility (undefined behavior on PC with triangles or points) // g_pD3DDevice8->SetRenderState(D3DRS_EDGEANTIALIAS, Value); - EmuWarning("SetRenderState_EdgeAntiAlias not implemented!"); +// EmuWarning("SetRenderState_EdgeAntiAlias not implemented!"); EmuSwapFS(); // XBox FS @@ -4872,10 +4877,10 @@ static void EmuUpdateDeferredStates() if(EmuD3DDeferredRenderState != 0) { if(XTL::EmuD3DDeferredRenderState[0] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_FOGENABLE, XTL::EmuD3DDeferredRenderState[0]); + g_pD3DDevice8->SetRenderState(D3DRS_FOGENABLE, XTL::EmuD3DDeferredRenderState[0]); if(XTL::EmuD3DDeferredRenderState[1] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_FOGTABLEMODE, XTL::EmuD3DDeferredRenderState[1]); + g_pD3DDevice8->SetRenderState(D3DRS_FOGTABLEMODE, XTL::EmuD3DDeferredRenderState[1]); if(XTL::EmuD3DDeferredRenderState[6] != X_D3DRS_UNK) { @@ -4889,40 +4894,40 @@ static void EmuUpdateDeferredStates() } if(XTL::EmuD3DDeferredRenderState[10] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_LIGHTING, XTL::EmuD3DDeferredRenderState[10]); + g_pD3DDevice8->SetRenderState(D3DRS_LIGHTING, XTL::EmuD3DDeferredRenderState[10]); if(XTL::EmuD3DDeferredRenderState[11] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_SPECULARENABLE, XTL::EmuD3DDeferredRenderState[11]); + g_pD3DDevice8->SetRenderState(D3DRS_SPECULARENABLE, XTL::EmuD3DDeferredRenderState[11]); if(XTL::EmuD3DDeferredRenderState[20] != X_D3DRS_UNK) g_pD3DDevice8->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, XTL::EmuD3DDeferredRenderState[20]); if(XTL::EmuD3DDeferredRenderState[23] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_AMBIENT, XTL::EmuD3DDeferredRenderState[23]); + g_pD3DDevice8->SetRenderState(D3DRS_AMBIENT, XTL::EmuD3DDeferredRenderState[23]); if(XTL::EmuD3DDeferredRenderState[24] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSIZE, XTL::EmuD3DDeferredRenderState[24]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSIZE, XTL::EmuD3DDeferredRenderState[24]); if(XTL::EmuD3DDeferredRenderState[25] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSIZE_MIN, XTL::EmuD3DDeferredRenderState[25]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSIZE_MIN, XTL::EmuD3DDeferredRenderState[25]); if(XTL::EmuD3DDeferredRenderState[26] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSPRITEENABLE, XTL::EmuD3DDeferredRenderState[26]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSPRITEENABLE, XTL::EmuD3DDeferredRenderState[26]); if(XTL::EmuD3DDeferredRenderState[27] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALEENABLE, XTL::EmuD3DDeferredRenderState[27]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALEENABLE, XTL::EmuD3DDeferredRenderState[27]); if(XTL::EmuD3DDeferredRenderState[28] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_A, XTL::EmuD3DDeferredRenderState[28]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_A, XTL::EmuD3DDeferredRenderState[28]); if(XTL::EmuD3DDeferredRenderState[29] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_B, XTL::EmuD3DDeferredRenderState[29]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_B, XTL::EmuD3DDeferredRenderState[29]); if(XTL::EmuD3DDeferredRenderState[30] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_C, XTL::EmuD3DDeferredRenderState[30]); + g_pD3DDevice8->SetRenderState(D3DRS_POINTSCALE_C, XTL::EmuD3DDeferredRenderState[30]); if(XTL::EmuD3DDeferredRenderState[33] != X_D3DRS_UNK) - g_pD3DDevice8->SetRenderState(D3DRS_PATCHSEGMENTS, XTL::EmuD3DDeferredRenderState[33]); + g_pD3DDevice8->SetRenderState(D3DRS_PATCHSEGMENTS, XTL::EmuD3DDeferredRenderState[33]); /** To check for unhandled RenderStates for(int v=0;v<117-82;v++) @@ -5135,7 +5140,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawVertices EmuUpdateDeferredStates(); - if((DWORD)PrimitiveType == 0x03 || (DWORD)PrimitiveType == 0x09 || (DWORD)PrimitiveType == 0x10) + if((DWORD)PrimitiveType == 0x09 || (DWORD)PrimitiveType == 0x10) EmuWarning("Unsupported PrimitiveType! (%d)", (DWORD)PrimitiveType); UINT PrimitiveCount = EmuD3DVertex2PrimitiveCount(PrimitiveType, VertexCount); @@ -5196,7 +5201,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawVerticesUP EmuUpdateDeferredStates(); - if((DWORD)PrimitiveType == 0x03 || (DWORD)PrimitiveType == 0x09 || (DWORD)PrimitiveType == 0x10) + if((DWORD)PrimitiveType == 0x09 || (DWORD)PrimitiveType == 0x10) EmuWarning("Unsupported PrimitiveType! (%d)", (DWORD)PrimitiveType); UINT PrimitiveCount = EmuD3DVertex2PrimitiveCount(PrimitiveType, VertexCount); @@ -5262,7 +5267,7 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices EmuUpdateDeferredStates(); - if((DWORD)PrimitiveType == 0x03 || (DWORD)PrimitiveType == 0x08 || (DWORD)PrimitiveType == 0x09 || (DWORD)PrimitiveType == 0x10) + if((DWORD)PrimitiveType == 0x08 || (DWORD)PrimitiveType == 0x09 || (DWORD)PrimitiveType == 0x10) EmuWarning("Unsupported PrimitiveType! (%d)", (DWORD)PrimitiveType); UINT PrimitiveCount = EmuD3DVertex2PrimitiveCount(PrimitiveType, VertexCount); diff --git a/Source/Win32/CxbxKrnl/EmuKrnl.cpp b/Source/Win32/CxbxKrnl/EmuKrnl.cpp index f775bd1ef..791973ad2 100644 --- a/Source/Win32/CxbxKrnl/EmuKrnl.cpp +++ b/Source/Win32/CxbxKrnl/EmuKrnl.cpp @@ -1274,13 +1274,11 @@ XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI xboxkrnl::NtCreateFile (NtDll::LARGE_INTEGER*)AllocationSize, FileAttributes, ShareAccess, CreateDisposition, CreateOptions, NULL, NULL ); - if(FAILED(ret)) - EmuWarning("NtCreateFile Failed (0x%.08X)", ret); #ifdef _DEBUG_TRACE + if(FAILED(ret)) + printf("EmuKrnl (0x%X): NtCreateFile Failed! (0x%.08X)", GetCurrentThreadId(), ret); else - { printf("EmuKrnl (0x%X): NtCreateFile = 0x%.08X\n", GetCurrentThreadId(), *FileHandle); - } #endif // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/EmuXapi.cpp b/Source/Win32/CxbxKrnl/EmuXapi.cpp index 7c5eb6315..e75061b1f 100644 --- a/Source/Win32/CxbxKrnl/EmuXapi.cpp +++ b/Source/Win32/CxbxKrnl/EmuXapi.cpp @@ -614,7 +614,7 @@ DWORD WINAPI XTL::EmuXInputSetState } #endif - EmuWarning("Ignoring EmuXInputSetState!"); +// EmuWarning("Ignoring EmuXInputSetState!"); EmuSwapFS(); // XBox FS