http://bugs.winehq.org/show_bug.cgi?id=22780
--- Comment #8 from Matteo Bruni matteo.mystral@gmail.com 2010-07-23 10:59:15 --- Created an attachment (id=29788) --> (http://bugs.winehq.org/attachment.cgi?id=29788) Patch for the windowscodecs failure
OK, in current git the assembler shaders are processed correctly, and the game indeed aborts because of a libjpeg error. Specifically it's a windowscodecs bug triggered by D3DXGetImageInfoFromFileInMemory. Let me try to explain...
D3DXGetImageInfoFromFileInMemory calls IWICImagingFactory_CreateDecoderFromStream, which then enumerates and checks the decoders until it finds a matching one. Once found a suitable decoder, it calls IWICBitmapDecoder_Initialize (then calling JpegDecoder_Initialize) which fails because the stream was never reset after the many MatchesPattern (MatchesPattern, for each pattern, seeks the stream and reads the requested bytes, without resetting the stream pointer afterwards).
The attached patch fixes the issue for me (is that the correct approach?), the game is now playable with low shaders settings. The game uses D3DXLoadSurfaceFromFileInMemory and D3DXCompileShader which are currently stubbed, but somewhat still manages to work.
BTW, this leaves the general question of catching libjpeg failures open.