https://bugs.winehq.org/show_bug.cgi?id=9337
--- Comment #44 from Jan Havran havran.jan@email.cz --- Created attachment 58948 --> https://bugs.winehq.org/attachment.cgi?id=58948 Rendering bug after changing MaxVertexBlendMatrixIndex value.
After some talks with Brchi (creator of VCStarter) and Stefan Dösinger (on Devel mailing list: https://www.winehq.org/pipermail/wine-devel/2017-August/118619.html) I have made little progress.
The application checks (in sub_1008F8D0 procedure at offset 0x1975) MaxVertexBlendMatrixIndex (offset 0xAC) of struct D3DCAPS8 and in depend on that value will run one (MaxVertexBlendMatrixIndex >= 127) or another branch (MaxVertexBlendMatrixIndex < 127) for certain soldier figures. The problem is that MaxVertexBlendMatrixIndex for Software Vertex Processing is set to 0 in Wine, while in Windows it is 255.
When I change value of MaxVertexBlendMatrixIndex in dlls/d3d8/device.c to 255, the game is no longer crashing, but instead of that there are graphical problems with soldiers (see attached image).
Here is list of MaxVertexBlendMatrixIndex values for different configurations: Vietcong (Windows) with SW Vertex: 255 Vietcong (Windows) with HW Vertex: 126 Vietcong (Wine) with SW Vertex: 0 Vietcong (Wine) with HW Vertex: 126
The application expects MaxVertexBlendMatrixIndex of value 255, so the branch for MaxVertexBlendMatrixIndex < 127 was probably not properly tested. That is the reason why the game was crashing (and fixed in VCStarter by Brchi) with enabled HW Vertex Processing on Windows and with both SW/HW Vertex Processing on Wine.