http://bugs.winehq.org/show_bug.cgi?id=19471
Summary: Earthworm Jim 3D: Extensive graphics errors Product: Wine Version: 1.1.26 Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: ezekiel000@lavabit.com
Created an attachment (id=22632) --> (http://bugs.winehq.org/attachment.cgi?id=22632) Terminal output.
While running Earthworm Jim 3D the background to the title screen and intro video/scene are black and during the game there are various graphics errors including: missing textures, corrupt textures, low quality textures. There are also quite a few 3D model animation errors.
http://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #1 from David Rogers ezekiel000@lavabit.com 2009-07-26 17:24:39 --- Created an attachment (id=22633) --> (http://bugs.winehq.org/attachment.cgi?id=22633) Example of errors
http://bugs.winehq.org/show_bug.cgi?id=19471
Christian Costa titan.costa@wanadoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |titan.costa@wanadoo.fr
--- Comment #2 from Christian Costa titan.costa@wanadoo.fr 2010-03-31 12:17:19 --- Some of ERRs ot FIXMEs have been fixed. Please retest with recent wine.
http://bugs.winehq.org/show_bug.cgi?id=19471
David Rogers ezekiel000@lavabit.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #22632|0 |1 is obsolete| |
--- Comment #3 from David Rogers ezekiel000@lavabit.com 2010-03-31 16:33:19 --- Created an attachment (id=27130) --> (http://bugs.winehq.org/attachment.cgi?id=27130) Terminal output (1.1.41)
Done, all errors are still visible.
http://bugs.winehq.org/show_bug.cgi?id=19471
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh@gmail.com
--- Comment #4 from Jerome Leclanche adys.wh@gmail.com 2012-02-17 13:59:29 CST --- Please retest with wine-1.4-rc4 or newer.
http://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #5 from David Rogers ezekiel000@lavabit.com 2012-02-17 15:44:03 CST --- The menu backgrounds and gfx are now displayed but none of the text is, the 3D gfx errors are just as bad if not worse now.
http://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #6 from Jerome Leclanche adys.wh@gmail.com 2012-02-17 15:45:21 CST --- Could you provide an updated log? Try +ddraw,+d3d for now, don't know what the d3d guys would prefer.
http://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #7 from David Rogers ezekiel000@lavabit.com 2012-02-17 16:14:39 CST --- Created attachment 38931 --> http://bugs.winehq.org/attachment.cgi?id=38931 +ddraw,+d3d log
I think this is what you want but with the logging the game won't go past the title screen it seems to get stuck.
http://bugs.winehq.org/show_bug.cgi?id=19471
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #8 from joaopa jeremielapuree@yahoo.fr 2012-02-17 19:03:29 CST --- Does there exist a demo showing the problem for this game?
http://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #9 from David Rogers ezekiel000@lavabit.com 2012-02-18 02:13:22 CST --- I can't seem to find one but it is available through GOG.com.
http://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #10 from David Rogers ezekiel000@lavabit.com 2012-07-22 05:02:10 CDT --- This is still a problem in wine 1.5.9, actually it's gotten worse more graphics are completely black until they get very close to the camera.
http://bugs.winehq.org/show_bug.cgi?id=19471
Adam Bolte boltronics@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |boltronics@gmail.com
--- Comment #11 from Adam Bolte boltronics@gmail.com 2013-01-20 02:53:04 CST --- Definitely a problem in 1.5.22.
http://bugs.winehq.org/show_bug.cgi?id=19471
Christopher Larson kergoth@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kergoth@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=19471
mrdeathjr28@yahoo.es changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mrdeathjr28@yahoo.es
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #12 from mrdeathjr28@yahoo.es --- Problem still remains in wine 1.7.45
https://bugs.winehq.org/show_bug.cgi?id=19471
Vincent Beers VincentBeers@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |VincentBeers@gmail.com
--- Comment #13 from Vincent Beers VincentBeers@gmail.com --- Created attachment 59279 --> https://bugs.winehq.org/attachment.cgi?id=59279 Terminal output for Wine Staging 2.17
Retested with Wine Staging 2.17 on Ubuntu 17.04. I made a video of what the graphical glitches look like: https://youtu.be/OGdgFaQV7gg
I also attached terminal output.
Several things seem to be going on:
- Some of the game intro stuff seems to be skipped immediately. - Some graphics don't display at all, like all of the text. - Some of the surfaces will darken really quickly when positioned too far from the camera. (Look at the boxes and the floor at around 2:09 in the video specifically.)
Here's a video of what gameplay is supposed to look like, for comparison: https://www.youtube.com/watch?v=8Rs2zgRC8KE
I'm testing with the original CD-ROM release, but I figure it's probably going to exhibit the same problems as the GOG version.
Note that while I normally run with Wine-staging and CSMT, these graphical glitches have been consistent across regular Wine versions that I've run last year as well.
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #14 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-4.0?
https://bugs.winehq.org/show_bug.cgi?id=19471
moog621@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |moog621@gmail.com
--- Comment #15 from moog621@gmail.com --- (In reply to joaopa from comment #14)
Does the bug still occur with wine-4.0?
It does occur in 4.1 with staging patches.
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #16 from joaopa jeremielapuree@yahoo.fr --- Does the bug still occur with wine-4.20?
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #17 from Ken Sharp imwellcushtymelike@gmail.com --- This needs testing in vanilla Wine.
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.
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #19 from Paul Gofman gofmanp@gmail.com --- Created attachment 65804 --> https://bugs.winehq.org/attachment.cgi?id=65804 test program
An addition to comment #18, p. 1.
Application actually wants the text rendered with DrawText to have nonzero color, not alpha. Yet it does not work like that on the modern Windows, color 0xffffffff seems to be treated like palette index 0 no matter what, just like in Wine. And the same happens if the application ddraw sequence is emulated.
The application actually stops rendering text on Windows just the same way as under Wine if the application .exe is renamed. All the other rendering stays ok. And starts rendering text again if I set compatibility mode to Windows 98 / Windows ME for this application. So Windows seem to auto enable the compatibility profile.
I am attaching the test program which reproduces what Wine ddraw / wined3d does for DC creation and tries to render text through gdi with color 0xffffffff. This program renders text with color 0 by default, but I can get colors 0x7fff (as the game expects) if turn on Windows 98 / Windows ME compatibility mode for the test program.
https://bugs.winehq.org/show_bug.cgi?id=19471
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download CC| |focht@gmx.net URL| |https://archive.org/details | |/earthworm-jim-3d
https://bugs.winehq.org/show_bug.cgi?id=19471
Zachary J zakarjor@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zakarjor@yahoo.com
--- Comment #20 from Zachary J zakarjor@yahoo.com --- I applied the changes in wine-staging 6.9 and I can confirm that the fixes now show the texts. I only applied make_rgb_colorref() returning color as-is if 0xffffffff since most of the other changes seem to be in wine-staging.
I didn't see any glitches or issues with cutscenes in wine-staging (haven't tested in vanilla wine, but I'm guessing most of the fixes are what's already in wine-staging).
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #21 from Vincent Beers VincentBeers@gmail.com --- Created attachment 70089 --> https://bugs.winehq.org/attachment.cgi?id=70089 Earthworm Jim on Wine Staging 6.9
I've retested on wine-staging 6.9 as well and the game mostly looks good now, but for me the text is still not displaying. Not in the text boxes, not in the HUD or menus.
There's also a constant, incredibly loud static noise now but that's an unrelated issue.
https://bugs.winehq.org/show_bug.cgi?id=19471
Vincent Beers VincentBeers@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #59279|0 |1 is obsolete| |
--- Comment #22 from Vincent Beers VincentBeers@gmail.com --- Created attachment 70090 --> https://bugs.winehq.org/attachment.cgi?id=70090 +ddraw,+d3d output for Wine Staging 6.9
Here's the output. Taken from my usual wineprefix, but not before checking if the same behavior shows on a clean wineprefix.
Warning: the log is 1.4GB.
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #23 from Vincent Beers VincentBeers@gmail.com --- Note: I was testing from my original CD-ROM version of the game. Obtaining the GOG version right now, just to see if it makes a difference. That is likely the version most people will be running anyway.
This doesn't change the fact that something is still up with the text rendering in this specific scenario, of course.
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #24 from Vincent Beers VincentBeers@gmail.com --- The GOG version has the same issues.
https://bugs.winehq.org/show_bug.cgi?id=19471
Raiden jules.blok@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jules.blok@gmail.com
--- Comment #25 from Raiden jules.blok@gmail.com --- I've tried patching the executable, setting the high-order byte to 0 as specified in the COLORREF documentation when calling SetTextColor() fixes the text rendering issue. So it looks like Earthworm Jim 3D is relying on Windows 98 behavior which ignores the high-order byte of COLORREF. It was basically setting the reserved byte of the COLORREF to 0xff and when later version of Windows started using that reserved byte the text rendering broke.
https://bugs.winehq.org/show_bug.cgi?id=19471
--- Comment #26 from Raiden jules.blok@gmail.com --- If anyone is interested in applying the patch to the executable themselves, then simply open the executable in a hex editor and at offset 0x82e88 replace E8 B3 0F 01 00 8B F4 6A FF with 66 90 89 E6 68 FF FF FF 00.
This should work for both the GOG version and the retail version, since the offset is the same for both.