diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp index 790eab9bb..3fb235cca 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp @@ -6702,6 +6702,20 @@ xbox::void_xt WINAPI xbox::EMUPATCH(D3DDevice_SetVertexShader) UpdateViewPortOffsetAndScaleConstants(); } +// This uses a custom calling convention where Handle is passed in EBX +// Test-case: NASCAR Heat 2002 +xbox::void_xt WINAPI xbox::EMUPATCH(D3DDevice_SetVertexShader_0)() +{ + dword_xt Handle; + __asm mov Handle, ebx + + LOG_FUNC_ONE_ARG(Handle); + + CxbxImpl_SetVertexShader(Handle); + + UpdateViewPortOffsetAndScaleConstants(); +} + // TODO : Move to own file constexpr unsigned int IndicesPerPage = PAGE_SIZE / sizeof(INDEX16); constexpr unsigned int InputQuadsPerPage = ((IndicesPerPage * VERTICES_PER_QUAD) / VERTICES_PER_TRIANGLE) / TRIANGLES_PER_QUAD; diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.h b/src/core/hle/D3D8/Direct3D9/Direct3D9.h index cf2c72b19..9232494c3 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.h +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.h @@ -1400,6 +1400,8 @@ xbox::void_xt WINAPI EMUPATCH(D3DDevice_SetVertexShader) dword_xt Handle ); +xbox::void_xt WINAPI EMUPATCH(D3DDevice_SetVertexShader_0)(); + // ****************************************************************** // * patch: D3DDevice_DrawVertices // ****************************************************************** diff --git a/src/core/hle/Patches.cpp b/src/core/hle/Patches.cpp index deeff679f..3fef16dfa 100644 --- a/src/core/hle/Patches.cpp +++ b/src/core/hle/Patches.cpp @@ -163,6 +163,7 @@ std::map g_PatchTable = { PATCH_ENTRY("D3DDevice_SetVertexData4ub", xbox::EMUPATCH(D3DDevice_SetVertexData4ub), PATCH_HLE_D3D), PATCH_ENTRY("D3DDevice_SetVertexDataColor", xbox::EMUPATCH(D3DDevice_SetVertexDataColor), PATCH_HLE_D3D), PATCH_ENTRY("D3DDevice_SetVertexShader", xbox::EMUPATCH(D3DDevice_SetVertexShader), PATCH_HLE_D3D), + PATCH_ENTRY("D3DDevice_SetVertexShader_0", xbox::EMUPATCH(D3DDevice_SetVertexShader_0), PATCH_HLE_D3D), PATCH_ENTRY("D3DDevice_SetVertexShaderConstant", xbox::EMUPATCH(D3DDevice_SetVertexShaderConstant), PATCH_HLE_D3D), PATCH_ENTRY("D3DDevice_SetVertexShaderConstant1", xbox::EMUPATCH(D3DDevice_SetVertexShaderConstant1), PATCH_HLE_D3D), PATCH_ENTRY("D3DDevice_SetVertexShaderConstant1Fast", xbox::EMUPATCH(D3DDevice_SetVertexShaderConstant1Fast), PATCH_HLE_D3D),