diff --git a/Cxbx.opt b/Cxbx.opt index 1c8d82ff8..1bf3f8d13 100644 Binary files a/Cxbx.opt and b/Cxbx.opt differ diff --git a/Include/Win32/CxbxKrnl/EmuD3D8.h b/Include/Win32/CxbxKrnl/EmuD3D8.h index 0f166d13f..88d76d0ea 100644 --- a/Include/Win32/CxbxKrnl/EmuD3D8.h +++ b/Include/Win32/CxbxKrnl/EmuD3D8.h @@ -749,6 +749,14 @@ VOID WINAPI EmuIDirect3DDevice8_SetTextureState_TexCoordIndex DWORD Value ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting +// ****************************************************************** +VOID WINAPI EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting +( + DWORD Value +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetTextureState_BackFillMode // ****************************************************************** @@ -873,6 +881,14 @@ VOID WINAPI EmuIDirect3DDevice8_SetRenderState_CullMode DWORD Value ); +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_StencilFail +// ****************************************************************** +VOID WINAPI EmuIDirect3DDevice8_SetRenderState_StencilFail +( + DWORD Value +); + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetRenderState_ZEnable // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/EmuD3D8.cpp b/Source/Win32/CxbxKrnl/EmuD3D8.cpp index 8606750d8..61d4772d8 100644 --- a/Source/Win32/CxbxKrnl/EmuD3D8.cpp +++ b/Source/Win32/CxbxKrnl/EmuD3D8.cpp @@ -4868,6 +4868,34 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_TexCoordIndex return; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting +// ****************************************************************** +VOID WINAPI XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting +( + DWORD Value +) +{ + EmuSwapFS(); // Win2k/XP FS + + // debug trace + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); + } + #endif + + EmuWarning("TwoSidedLighting is not supported!"); + + EmuSwapFS(); // XBox FS + + return; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetTextureState_BackFillMode // ****************************************************************** @@ -5408,6 +5436,34 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_CullMode return; } +// ****************************************************************** +// * func: EmuIDirect3DDevice8_SetRenderState_StencilFail +// ****************************************************************** +VOID WINAPI XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail +( + DWORD Value +) +{ + EmuSwapFS(); // Win2k/XP FS + + // debug trace + #ifdef _DEBUG_TRACE + { + printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetRenderState_StencilFail\n" + "(\n" + " Value : 0x%.08X\n" + ");\n", + GetCurrentThreadId(), Value); + } + #endif + + g_pD3DDevice8->SetRenderState(D3DRS_STENCILFAIL, Value); + + EmuSwapFS(); // XBox FS + + return; +} + // ****************************************************************** // * func: EmuIDirect3DDevice8_SetRenderState_ZEnable // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl b/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl index 4773be5cf..1a9ceb0ca 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl +++ b/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4361.inl @@ -1103,7 +1103,7 @@ SOOVPA<13> IDirect3DDevice8_SetRenderState_ZEnable_1_0_4361 = { 0x1D, 0x74 }, // (Offset,Value)-Pair #5 { 0x1E, 0x20 }, // (Offset,Value)-Pair #6 - // IDirect3DDevice8_SetRenderState_ZEnable+0x31 : mov dword ptr [eax], 0x4030 + // IDirect3DDevice8_SetRenderState_ZEnable+0x31 : mov dword ptr [eax], 0x4030C { 0x31, 0xC7 }, // (Offset,Value)-Pair #7 { 0x32, 0x00 }, // (Offset,Value)-Pair #8 { 0x33, 0x0C }, // (Offset,Value)-Pair #9 diff --git a/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl b/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl index e97bbd804..127b8f24b 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl +++ b/Source/Win32/CxbxKrnl/HLEDataBase/D3D8.1.0.4432.inl @@ -202,6 +202,41 @@ SOOVPA<12> IDirect3DDevice8_SetTextureState_BumpEnv_1_0_4432 = } }; +// ****************************************************************** +// * IDirect3DDevice8_SetTextureState_TwoSidedLighting +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4432 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x11 : or edx, 0x1000 + { 0x11, 0x81 }, // (Offset,Value)-Pair #1 + { 0x12, 0xCA }, // (Offset,Value)-Pair #2 + { 0x13, 0x00 }, // (Offset,Value)-Pair #3 + { 0x14, 0x10 }, // (Offset,Value)-Pair #4 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x24 : cmp eax, [esi+4]; push edi + { 0x24, 0x3B }, // (Offset,Value)-Pair #5 + { 0x25, 0x46 }, // (Offset,Value)-Pair #6 + { 0x26, 0x04 }, // (Offset,Value)-Pair #7 + { 0x27, 0x57 }, // (Offset,Value)-Pair #8 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x53 : add eax, 0x0C + { 0x53, 0x83 }, // (Offset,Value)-Pair #9 + { 0x54, 0xC0 }, // (Offset,Value)-Pair #10 + { 0x55, 0x0C }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetTextureState_TwoSidedLighting+0x60 : retn 0x04 + { 0x60, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x61, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + // ****************************************************************** // * IDirect3DDevice8_SetTextureState_BackFillMode // ****************************************************************** @@ -302,6 +337,75 @@ SOOVPA<8> IDirect3DDevice8_SetRenderState_NormalizeNormals_1_0_4432 = } }; +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_ZEnable +// ****************************************************************** +SOOVPA<13> IDirect3DDevice8_SetRenderState_ZEnable_1_0_4432 = +{ + 0, // Large == 0 + 13, // Count == 13 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_ZEnable+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_ZEnable+0x1B : mov ecx, [esi+0x2074] + { 0x1B, 0x8B }, // (Offset,Value)-Pair #3 + { 0x1C, 0x8E }, // (Offset,Value)-Pair #4 + { 0x1D, 0x74 }, // (Offset,Value)-Pair #5 + { 0x1E, 0x20 }, // (Offset,Value)-Pair #6 + + // IDirect3DDevice8_SetRenderState_ZEnable+0x2E : mov dword ptr [eax], 0x4030C + { 0x2E, 0xC7 }, // (Offset,Value)-Pair #7 + { 0x2F, 0x00 }, // (Offset,Value)-Pair #8 + { 0x30, 0x0C }, // (Offset,Value)-Pair #9 + { 0x31, 0x03 }, // (Offset,Value)-Pair #10 + { 0x32, 0x04 }, // (Offset,Value)-Pair #11 + + // IDirect3DDevice8_SetRenderState_ZEnable+0x8C : retn 0x04 + { 0x8C, 0xC2 }, // (Offset,Value)-Pair #12 + { 0x8D, 0x04 }, // (Offset,Value)-Pair #13 + } +}; + +// ****************************************************************** +// * IDirect3DDevice8_SetRenderState_StencilFail +// ****************************************************************** +SOOVPA<12> IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432 = +{ + 0, // Large == 0 + 12, // Count == 12 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + // IDirect3DDevice8_SetRenderState_StencilFail+0x0C : jb +0x05 + { 0x0C, 0x72 }, // (Offset,Value)-Pair #1 + { 0x0D, 0x05 }, // (Offset,Value)-Pair #2 + + // IDirect3DDevice8_SetRenderState_StencilFail+0x38 : cmp [abs], 0x1E00 + { 0x38, 0x81 }, // (Offset,Value)-Pair #3 + { 0x3E, 0x00 }, // (Offset,Value)-Pair #4 + { 0x3F, 0x1E }, // (Offset,Value)-Pair #5 + + // IDirect3DDevice8_SetRenderState_StencilFail+0x47 : mov dword ptr [eax], 0x41D84 + { 0x47, 0xC7 }, // (Offset,Value)-Pair #6 + { 0x48, 0x00 }, // (Offset,Value)-Pair #7 + { 0x49, 0x84 }, // (Offset,Value)-Pair #8 + { 0x4A, 0x1D }, // (Offset,Value)-Pair #9 + { 0x4B, 0x04 }, // (Offset,Value)-Pair #10 + + // IDirect3DDevice8_SetRenderState_StencilFail+0x6A : retn 0x04 + { 0x6A, 0xC2 }, // (Offset,Value)-Pair #11 + { 0x6B, 0x04 }, // (Offset,Value)-Pair #12 + } +}; + // ****************************************************************** // * IDirect3DDevice8_SetRenderState_ShadowFunc // ****************************************************************** @@ -481,6 +585,16 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetTextureState_BumpEnv" #endif }, + // IDirect3DDevice8::SetTextureState_TwoSidedLighting + { + (OOVPA*)&IDirect3DDevice8_SetTextureState_TwoSidedLighting_1_0_4432, + + XTL::EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetTextureState_TwoSidedLighting" + #endif + }, // IDirect3DDevice8::SetTextureState_BackFillMode { (OOVPA*)&IDirect3DDevice8_SetTextureState_BackFillMode_1_0_4432, @@ -601,6 +715,26 @@ OOVPATable D3D8_1_0_4432[] = "EmuIDirect3DDevice8_SetRenderState_StencilEnable" #endif }, + // IDirect3DDevice8::SetRenderState_StencilFail + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_StencilFail_1_0_4432, + + XTL::EmuIDirect3DDevice8_SetRenderState_StencilFail, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_StencilFail" + #endif + }, + // IDirect3DDevice8::SetRenderState_ZEnable + { + (OOVPA*)&IDirect3DDevice8_SetRenderState_ZEnable_1_0_4432, + + XTL::EmuIDirect3DDevice8_SetRenderState_ZEnable, + + #ifdef _DEBUG_TRACE + "EmuIDirect3DDevice8_SetRenderState_ZEnable" + #endif + }, // IDirect3DDevice8::SetRenderState_ShadowFunc { (OOVPA*)&IDirect3DDevice8_SetRenderState_ShadowFunc_1_0_4432,