https://bugs.winehq.org/show_bug.cgi?id=8051
--- Comment #124 from swswine@gmail.com --- Created attachment 52904 --> https://bugs.winehq.org/attachment.cgi?id=52904 Partial workaround to fix game start, models display and get a sensible trace
I eventually tried to run Sims2 and make it work under Wine. It seems to be an interesting case of using various d3d9 features which are not implemented in Wine yet. Shader constants limit is just the first but not the least reason. I hope it is interesting to share what I found as actually previous discussion does not reveal what is actually wrong with Sims2 under wine.
While I not yet succeded in making Sims2 fully work I found the major reason why rendering did not work without any indication what's wrong or not supported in the trace (after the trick similar to that from Comment #118). I am attaching the patch which partially fixes rendering for me but more important reveals actually unsupported features which the game is using. This patch by no means can be thought as a fix proposal for anything, but lets Sims2 run and draw models, and makes it usable for further testing and fixing.
As noted in Comment #118 here, the crash on startup can be worked around by increasing the number of supported shader constants. The patch increases that constant at the first place and also increases number of constants in wined3d. Actually this workaround helps to run some other games involving 3d characters, but not this time. After applying just this the game starts but model is rendered in T pose and totally red (I am mainly running TS2BodyShop.exe to view how the model renders). At the same time wine trace does not show up any relevant problems.
The reason is that Sims2 is using some shader compilaton function from d3dx library (which has fancy static linkage in sims2 exe files, so no way to use builtin d3dx.dll). That function requests undocumentated interface from d3d9 through Direct3DShaderValidatorCreate9, and fails if it is not available. Unlike some redundant constants initialization at startup, this problem does not show up as crash or something, the game just continues running and falls back to some most basic shaders which draw red models in T pose, without any visible errors. My patch adds a very dumb & dirty implementation of the undocumented validator interface which returns OK for all the requests and does the trick, the game starts to use real shaders.
After that, if shader model 3.0 is available, the model stops rendering at all and the trace is full of indications of unsupported features. Not fully supported ProcessVertices implementation goes first, then a few other things like tangent, binormal and vertex blend indices vertex attributes, and some more. These probably should be sorted out one by one.
The last thing that the patch does is hardcoding maximum shaders version to 2 (caps->VertexShaderVersion and caps->PixelShaderVersion in wined3d/directx.c). After that the model shows OK in model builder (with normal pose and texture). I also started the main game in tutorial mode (I do not know how to play it), and the model also showing OK in the beginning, but other glitches show up quickly when doing some actions in the house (the glitches are now accompanied by the informative trace output). So probably it is easier to fix the problems showing up in shader 2.0 model first as it likely has less missing features. It actually should be possible to limit shader model version within game configuration files (the google is full of discussions on how people fixing Sims2 on Windows through these).