From 1352a10da4d02c9d7ac68c8a47702731ae6a6292 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Tue, 8 Jul 2003 22:13:36 +0000 Subject: [PATCH] turok stuff --- Include/Win32/CxbxKrnl/EmuD3D8.h | 17 +++++++ Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl | 59 +++++++++++++++++++--- Source/Win32/CxbxKrnl/EmuD3D8.cpp | 66 ++++++++++++++++++++++++- Source/Win32/CxbxKrnl/EmuFS.cpp | 2 +- 4 files changed, 136 insertions(+), 8 deletions(-) diff --git a/Include/Win32/CxbxKrnl/EmuD3D8.h b/Include/Win32/CxbxKrnl/EmuD3D8.h index e5e50871f..026c3734a 100644 --- a/Include/Win32/CxbxKrnl/EmuD3D8.h +++ b/Include/Win32/CxbxKrnl/EmuD3D8.h @@ -693,6 +693,15 @@ HRESULT WINAPI EmuIDirect3DDevice8_SetVertexShaderConstant DWORD ConstantCount ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetVertexShaderConstant1 +// ****************************************************************** +VOID __fastcall EmuIDirect3DDevice8_SetVertexShaderConstant1 +( + INT Register, + CONST PVOID pConstantData +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_CreatePixelShader // ****************************************************************** @@ -1034,6 +1043,14 @@ VOID WINAPI EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias DWORD Value ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_ShadowFunc +// ****************************************************************** +VOID WINAPI EmuIDirect3DDevice8_SetRenderState_ShadowFunc +( + DWORD Value +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetTransform // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl b/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl index 874efa212..c0b40f079 100644 --- a/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/D3D8.1.0.4627.inl @@ -464,9 +464,9 @@ SOOVPA<11> IDirect3DDevice8_SetTileNoWait_1_0_4627 = }; // ****************************************************************** -// * IDirect3DDevice8_SetVertexShaderConstant +// * IDirect3DDevice8_SetVertexShaderConstant1 // ****************************************************************** -SOOVPA<11> IDirect3DDevice8_SetVertexShaderConstant_1_0_4627 = +SOOVPA<11> IDirect3DDevice8_SetVertexShaderConstant1_1_0_4627 = { 0, // Large == 0 11, // Count == 11 @@ -927,6 +927,43 @@ SOOVPA<12> IDirect3DDevice8_SetRenderState_MultiSampleAntiAlias_1_0_4627 = } }; +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ShadowFunc +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4627 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x00 : push esi + { 0x00, 0x56 }, // (Offset,Value)-Pair #1 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x09 : cmp eax, [esi+4] + { 0x09, 0x3B }, // (Offset,Value)-Pair #2 + { 0x0A, 0x46 }, // (Offset,Value)-Pair #3 + { 0x0B, 0x04 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #5 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x1D : lea edx, [ecx-0x0200] + { 0x1D, 0x8D }, // (Offset,Value)-Pair #7 + { 0x1E, 0x91 }, // (Offset,Value)-Pair #8 + { 0x1F, 0x00 }, // (Offset,Value)-Pair #9 + { 0x20, 0xFE }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_ShadowFunc+0x26 : add eax, 0x08 + { 0x26, 0x83 }, // (Offset,Value)-Pair #11 + { 0x27, 0xC0 }, // (Offset,Value)-Pair #12 + { 0x28, 0x08 }, // (Offset,Value)-Pair #13 + } +}; + // ****************************************************************** // * IDirect3DDevice8_DrawVerticesUP // ****************************************************************** @@ -1309,14 +1346,14 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_CreateVertexShader" #endif }, - // IDirect3DDevice8::SetVertexShaderConstant + // IDirect3DDevice8::SetVertexShaderConstant1 { - (OOVPA*)&IDirect3DDevice8_SetVertexShaderConstant_1_0_4627, + (OOVPA*)&IDirect3DDevice8_SetVertexShaderConstant1_1_0_4627, - XTL::EmuIDirect3DDevice8_SetVertexShaderConstant, + XTL::EmuIDirect3DDevice8_SetVertexShaderConstant1, #ifdef _DEBUG_TRACE - "EmuIDirect3DDevice8_SetVertexShaderConstant" + "EmuIDirect3DDevice8_SetVertexShaderConstant1" #endif }, // IDirect3DDevice8::CreatePixelShader (* unchanged since 4361 *) @@ -1539,6 +1576,16 @@ OOVPATable D3D8_1_0_4627[] = "EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias" #endif }, + // IDirect3DDevice8::SetRenderState_ShadowFunc + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4627, + + XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ShadowFunc" + #endif + }, // IDirect3DDevice8::SetTransform (* unchanged since 4361 *) { (OOVPA*)&IDirect3DDevice8_SetTransform_1_0_4361, diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 9fddc704d..231953138 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -341,7 +341,7 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_KILLFOCUS: dwRestoreSleepRate = EmuAutoSleepRate; - EmuAutoSleepRate = 1; + EmuAutoSleepRate = 0; break; case WM_CLOSE: @@ -1413,9 +1413,12 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexShaderConstant } #endif + HRESULT hRet; + // ****************************************************************** // * redirect to windows d3d // ****************************************************************** + /* HRESULT hRet = g_pD3DDevice8->SetVertexShaderConstant ( Register, @@ -1424,6 +1427,7 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexShaderConstant ); if(FAILED(hRet)) + */ { printf("*Warning* we're lying about setting a vertex shader constant!\n"); @@ -1435,6 +1439,36 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetVertexShaderConstant return hRet; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetVertexShaderConstant1 +// ****************************************************************** +VOID __fastcall XTL::EmuIDirect3DDevice8_SetVertexShaderConstant1 +( + INT Register, + CONST PVOID pConstantData +) +{ + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + EmuSwapFS(); // Win2k/XP FS + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetVertexShaderConstant1\n" + "(\n" + " Register : 0x%.08X\n" + " pConstantData : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Register, pConstantData); + EmuSwapFS(); // XBox FS + } + #endif + + XTL::EmuIDirect3DDevice8_SetVertexShaderConstant(Register - 96, pConstantData, 1); + + return; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_CreatePixelShader // ****************************************************************** @@ -3203,6 +3237,36 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_MultiSampleAntiAlias return; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_ShadowFunc +// ****************************************************************** +VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_ShadowFunc +( + DWORD Value +) +{ + EmuSwapFS(); // Win2k/XP FS + + // ****************************************************************** + // * debug trace + // ****************************************************************** + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_ShadowFunc\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); + } + #endif + + printf("*Warning* ShadowFunc not implemented\n"); + + EmuSwapFS(); // XBox FS + + return; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetTransform // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/EmuFS.cpp b/Source/Win32/CxbxKrnl/EmuFS.cpp index c733ee40e..99aa37673 100644 --- a/Source/Win32/CxbxKrnl/EmuFS.cpp +++ b/Source/Win32/CxbxKrnl/EmuFS.cpp @@ -52,7 +52,7 @@ namespace xboxkrnl // ****************************************************************** // * data: EmuAutoSleepRate // ****************************************************************** -uint32 EmuAutoSleepRate = -1; +uint32 EmuAutoSleepRate = 1000; // ****************************************************************** // * func: EmuInitFS