https://bugs.winehq.org/show_bug.cgi?id=19471
Paul Gofman gofmanp@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |gofmanp@gmail.com
--- Comment #18 from Paul Gofman gofmanp@gmail.com --- Created attachment 65756 --> https://bugs.winehq.org/attachment.cgi?id=65756 Fixes
I've tested the game, observed three issues described in Comment #13, and found three distinct reasons for them. I am attaching the patch which actually consists of three and contains proof of concept fixes.
1. Missing text The game renders text by preparing a set of textures each containing a letter and then drawing those textures. The problem happens at the texture preparation stage. The textures have _B4G4R4A4 format. Application creates temporary surface (of _B5G5R5A1 format), uses IDirectDrawSurface4_GetDC() to get surface's DC, and then doing SetTextColor(dc, 0xffffffff), DrawTextA(...). After that the application creates _B4G4R4A4 surface, locks both and sets the new surface data looking at alpha component of original surface samples. The problem is that gdi draws the text with color 0. This originates from get_pixel_color() returning 0 color (gdi32/dibdrv/objects). The color stored in context is correct, but make_rgb_colorref() decides that color is palette index and returns 0. The fix in the attached patch fixes the problem in the game, but the fix is likely wrong, I did not test that much enough. I can guess the correct decision on whether to ignore palette flags check likely has something to do with the DIB having alpha channel rather than with the color value itself.
2. Missing elements in the introduction screens. The game is using _SetViewport2() to set the viewport in the beginnig, gets another viewport back with _GetViewport() and using the values from it for vertex transformation. Dividing into 0 ScaleX, ScaleY eventually leads to NaNs in vertex positions. It looks like native ddraw does some conversion. The attached patch contains a fix with a basic test.
3. Dark or missing elements in game The game creates some number of DXT1 and DXT3 mipmapped textures and initializes the most detailed level. It then uses _Blt() to stretch the data for each next mip level using a previous one. This requires our CPU blitter to be able to stretch between compressed format. I am attaching a very quick implementation which fixes the rendering, while it is really a draft and has not been tested much.