https://bugs.winehq.org/show_bug.cgi?id=46735
Bug ID: 46735 Summary: The Sims 2 demo needs Direct3DShaderValidatorCreate9() implementation Product: Wine Version: 0.9.35. Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: directx-d3d Assignee: wine-bugs@winehq.org Reporter: z.figura12@gmail.com Distribution: ---
Split off from bug 8051. To summarize, the game calls d3d9.Direct3DShaderValidatorCreate9(), which is a completely undocumented internal function that returns an an unknown interface. It expects a valid interface pointer to be returned, and expects certain calls on unknown methods to succeed.
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Depends on| |8051
https://bugs.winehq.org/show_bug.cgi?id=46735
Alexandr Oleynikov sashok.olen@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |sashok.olen@gmail.com
--- Comment #1 from Alexandr Oleynikov sashok.olen@gmail.com --- Created attachment 63732 --> https://bugs.winehq.org/attachment.cgi?id=63732 Direct3DShaderValidatorCreate9 patch
A patch that returns fake values for some calls needed for the game to work (copied it from the older patch from #8051)
https://bugs.winehq.org/show_bug.cgi?id=46735
Luke Horwell luke_horwell@hotmail.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |luke_horwell@hotmail.co.uk
https://bugs.winehq.org/show_bug.cgi?id=46735
--- Comment #2 from Henri Verbeet hverbeet@gmail.com --- I can't help but notice that the parameter counts for uisv_4par() and uisv_5par() match those for d3d8 ValidatePixelShader() and ValidateVertexShader(). I'd also recommend tracing the actual values the application passes to these methods.
https://bugs.winehq.org/show_bug.cgi?id=46735
--- Comment #3 from Alexandr Oleynikov sashok.olen@gmail.com --- Apparently, Gamemaker 1 based games seem to be affected by this issue too (they too call Direct3DShaderValidatorCreate9, uisv_4par and uisv_5par) and work seemingly fine with latest staging patchset + the patch attached to this issue. Demo of such game (you will also need to install d3dx9_43 and d3dcompiler_43 with winetricks, otherwise hlsl shader compilation will fail): http://towergirls.boards.net/thread/261/towergirls-131-88-public-build
https://bugs.winehq.org/show_bug.cgi?id=46735
Paul Gofman gofmanp@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gofmanp@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=46735
pattietreutel katyaberezyaka@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |katyaberezyaka@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=46735
--- Comment #4 from Zebediah Figura z.figura12@gmail.com --- Created attachment 64086 --> https://bugs.winehq.org/attachment.cgi?id=64086 patch with more detailed traces
I've attached a log with +d3d9 provided by another user from The Sims 2, using a patch with more detailed tracing. Several things I can glean from the log:
* The values passed do not seem to match what we would expect if the parameters were the same as those to the d3d8 methods, so unfortunately Henri's guess seems to be in vain.
* The pattern of calls looks something like this:
validator = Direct3DShaderValidatorCreate9(); validator->stub1(validator, 0, ptr1, ptr2); for (i = 1; i < some_number; i++) { validator->stub2(validator, 0, i, some_ptr, some_len); some_ptr += some_len * sizeof(DWORD); } validator->stub3(); validator->Release(); device->CreateVertexShader(...);
Sometimes the third argument to stub2 is not i but 0 instead. Sometimes it is not a sequence of consecutive integers.
The only recognizable pointer is the pointer argument to stub2, which is sometimes close to the byte code of the vertex shader.
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #63732|0 |1 is obsolete| |
--- Comment #5 from Zebediah Figura z.figura12@gmail.com --- Created attachment 64087 --> https://bugs.winehq.org/attachment.cgi?id=64087 more detailed patch
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #64086|patch with more detailed |log with +d3d9 description|traces |
https://bugs.winehq.org/show_bug.cgi?id=46735
--- Comment #6 from Henri Verbeet hverbeet@gmail.com --- (In reply to Zebediah Figura from comment #4)
- The pattern of calls looks something like this:
validator = Direct3DShaderValidatorCreate9(); validator->stub1(validator, 0, ptr1, ptr2); for (i = 1; i < some_number; i++) { validator->stub2(validator, 0, i, some_ptr, some_len); some_ptr += some_len * sizeof(DWORD); } validator->stub3(); validator->Release(); device->CreateVertexShader(...);
So what do the contents of "some_ptr" look like?
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #64086|0 |1 is obsolete| |
--- Comment #7 from Zebediah Figura z.figura12@gmail.com --- Created attachment 64097 --> https://bugs.winehq.org/attachment.cgi?id=64097 yet more detailed logs (+d3d9)
(In reply to Henri Verbeet from comment #6)
So what do the contents of "some_ptr" look like?
Attached; grep for "shader_validator_stub2". Comparing with d3d9 tests, it looks like the contents are the shader itself, and stub2 is called once for each instruction in the shader. I don't see anything obvious that distinguishes the different patterns of the third argument.
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |https://www.malavida.com/en | |/soft/the-sims-2/ Keywords| |download
--- Comment #8 from Zebediah Figura z.figura12@gmail.com --- Attaching demo which reproduces the bug.
https://bugs.winehq.org/show_bug.cgi?id=46735
--- Comment #9 from Zebediah Figura z.figura12@gmail.com --- The first pointer argument to stub1 is a callback function. Judging from disassembly, it expects several arguments. I have no idea what those arguments are supposed to be.
The second pointer argument points to somewhere on the stack, and the contents of that stack pointer are another stack pointer.
Figuring out the purposes of either of these seems hard. How much work do we actually want to do to figure out what this game wants? It's happy with S_OK returns from all of the given functions.
https://bugs.winehq.org/show_bug.cgi?id=46735
--- Comment #10 from Alexandr Oleynikov sashok.olen@gmail.com --- Indeed it is very happy with simply passing S_OK to it. If for whatever reason such solution can't be upstreamed, perhaps it could be included in staging at least?
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |STAGED Staged patchset| |https://github.com/wine-sta | |ging/wine-staging/tree/mast | |er/patches/d3d9-Direct3DSha | |derValidatorCreate9
--- Comment #11 from Zebediah Figura z.figura12@gmail.com --- By request, and since I do intend to continue work on this patch but likely won't have time in the near future, I've added the patch set into Staging.
https://bugs.winehq.org/show_bug.cgi?id=46735
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ben@xnode.org
--- Comment #12 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- *** Bug 13863 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|The Sims 2 demo needs |Multiple applications need |Direct3DShaderValidatorCrea |Direct3DShaderValidatorCrea |te9() implementation |te9() implementation (The | |Sims 2 demo, Armed Assault)
https://bugs.winehq.org/show_bug.cgi?id=46735
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|STAGED |RESOLVED Fixed by SHA1| |2a4a8a5cf34e9697a976a8272a1 | |c93e5660cbea6
--- Comment #13 from Zebediah Figura z.figura12@gmail.com --- Should be fixed by https://source.winehq.org/git/wine.git/commitdiff/2a4a8a5cf34e9697a976a8272a1c93e5660cbea6.
https://bugs.winehq.org/show_bug.cgi?id=46735
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.2.
https://bugs.winehq.org/show_bug.cgi?id=46735
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |5.0.x
https://bugs.winehq.org/show_bug.cgi?id=46735
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|5.0.x |---
--- Comment #15 from Michael Stefaniuc mstefani@winehq.org --- Removing the 5.0.x milestone from bug fixes included in 5.0.1.