VOGONS


Making WineD3D on Windows for Win32

Topic actions

First post, by aqrit

User metadata
Rank Member
Rank
Member

WineD3D can be built on Windows for Win32
by applying a small patch to the aclocal.m4 file
and using a MSYS2/mingw-w64 toolchain

****
posting here because there was some interest in a newer build of ddraw.dll from wined3d
( and it took me hours to figure this out 😊 )
see the wine wiki for cross-compiling from Linux http://wiki.winehq.org/WineD3DOnWindows
[edit]pre-compiled binaries from someone else are here
----
note:
wined3d.dll has a dependency on opengl32.dll
but MS/opengl32.dll has a dependency on ddraw.dll ...

so to use wined3d/ddraw.dll
one has to either use a different opengl32.dll
or rename wined3d/ddraw.dll to something else and hex edit the target game to import wined3d/ddraw under its new name.
[edit] or use an ugly hack like the one posted later in this thread [here]

****

Step-by-step (kinda):

get msys2 and then update the base package
see details: http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/

get mingw-w4 using mys2's built-in package manager

pacman --noconfirm --needed -S wget base-devel mingw-w64-i686-toolchain git

then close msys2 and run autorebase.bat from windows explorer (aka not in msys2)

note: if pacman downloads start failing...
uncomment the "XferCommand = /usr/bin/wget [...]" line in /etc/pacman.conf
and try again

get the source

git clone git://source.winehq.org/git/wine.git $HOME/wine-git

apply patch to the wine build system ( using either a text editor or git )

diff --git a/aclocal.m4 b/aclocal.m4
index 3d43721..1f23f83 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -496,7 +496,7 @@ $ac_file.cross.a: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD)
wine_fn_append_rule \
"__builddeps__: dlls/lib$ac_implib.$IMPLIBEXT
dlls/lib$ac_implib.$IMPLIBEXT: $ac_file.$IMPLIBEXT
- \$(RM) \$[@] && \$(LN_S) $ac_name/lib$ac_implib.$IMPLIBEXT \$[@]
+ \$(RM) \$[@] && \$(LN_S) dlls/$ac_name/lib$ac_implib.$IMPLIBEXT \$[@]
clean::
\$(RM) dlls/lib$ac_implib.$IMPLIBEXT"
wine_fn_ignore_file "dlls/lib$ac_implib.$IMPLIBEXT"

build

autoreconf

./configure --without-x --without-freetype CFLAGS="-O2 -DWINE_NOWINSOCK -DUSE_WIN32_OPENGL -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables" CC='gcc -static-libgcc -s'

make __tooldeps__ dlls/d3d10 dlls/d3d10core dlls/d3d8 dlls/d3d9 dlls/dxgi dlls/ddraw dlls/wined3d

*note these switches are all optional "-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables" CC='gcc -static-libgcc -s'

collect all the dlls into the root of the 'dlls' folder

cp dlls/d3d10/d3d10.dll dlls/d3d10core/d3d10core.dll dlls/d3d8/d3d8.dll dlls/d3d9/d3d9.dll dlls/dxgi/dxgi.dll dlls/ddraw/ddraw.dll dlls/wined3d/wined3d.dll libs/wine/libwine.dll dlls/

enjoy

Last edited by aqrit on 2022-01-11, 22:45. Edited 8 times in total.

Reply 1 of 30, by teleguy

User metadata
Rank Member
Rank
Member

Someone uploaded an archive of WineD3D builds up to 1.7.19 mostly including ddraw.dll.

http://www.mediafire.com/download/51ua9rc36tr … eD3D+Patches.7z

or rename wined3d/ddraw.dll to something else and hex edit the target game to import wined3d/ddraw under its new name.

How do you do that? I tried Mesa's opengl32.dll and it's superslow.

Reply 2 of 30, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
teleguy wrote:

Someone uploaded an archive of WineD3D builds up to 1.7.19 mostly including ddraw.dll.

http://www.mediafire.com/download/51ua9rc36tr … eD3D+Patches.7z

Thanks! *pockets for The Wrapper Project*
[EDIT] Actually, we have all of these already except for 1.7.13 and 1.7.19. We must have got this pack before. Still, every little bit helps! 😀

teleguy wrote:
aqrit wrote:

or rename wined3d/ddraw.dll to something else and hex edit the target game to import wined3d/ddraw under its new name.

How do you do that? I tried Mesa's opengl32.dll and it's superslow.

https://forums.virtualbox.org/viewtopic.php?f=6&t=25939

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 3 of 30, by Stiletto

User metadata
Rank l33t++
Rank
l33t++

And now it seems there's a new project, "dosse91" plans to keep releasing builds. 1.7.32 is up.
http://sourceforge.net/projects/wined3d4win/

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 5 of 30, by teleguy

User metadata
Rank Member
Rank
Member
Stiletto wrote:

Thanks! Doesn't seem to have any benefit though (at least in the games I tested).

If a version of wine works out of the box it continues to work with the exe edited and ddraw.dll renamed. The more recent versions fail to start with the same "AppHangB1" error I received before even after being modified. The same versions run when paired with Mesa opengl32 although there are other issues. I'm positive I've edited the right part because some versions worked with ddraw.dll renamed to fdraw.dll and most exes contained only a single instance of "ddraw.dll".

Reply 6 of 30, by aqrit

User metadata
Rank Member
Rank
Member

here is an ugly hack: http://bitpatch.com/downloads/ddraw_wined3d_proxy.zip
[edit] updated ddraw_wined3d_proxy.zip with a newer version already... still don't know if it works

using this proxy dll
games should no longer have to be hex-edited to work with WineD3D On Windows when paired with ms/opengl
just rename wined3d's ddraw.dll to wdraw.dll and paste this new ddraw.dll into the same folder

---

new project

😀 hilarious, coeval.

Last edited by aqrit on 2014-12-06, 12:25. Edited 1 time in total.

Reply 7 of 30, by aqrit

User metadata
Rank Member
Rank
Member

If a version of wine works out of the box

I actually just tried WineD3D without that proxy dll, mesa opengl(llvmpipe), or hex-edits and it worked fine...
Maybe I'm losing my mind. 🙁
What game do you see errors with teleguy?

a few games may load ddraw via COM, in such cases hex-editing the "ddraw" strings would not help.
though if ddraw.dll is renamed it would load the regular MS/ddraw
a game may also be linking to ddraw from some game dlls in addition to the game exe
hex editing may also disagree with some copy-protection garbage

Reply 8 of 30, by teleguy

User metadata
Rank Member
Rank
Member

I actually just tried WineD3D without that proxy dll, mesa opengl(llvmpipe), or hex-edits and it worked fine...
Maybe I'm losing my mind.
What game do you see errors with teleguy?

Jedi Knight and Tie Fighter 98. They give me an AppHangB1 error even with the new proxy dll. The good news is that ddraw_test.exe that is included with wine now runs without triggering an infinite loop.

Which version of WineD3D are you using?

Edit: Tried Legacy of Kaine. Sames story as with the other games. The most recent versions of WineD3D fail to launch and once I found a version that works it made no difference whether I used the proxy dll/an hex editor or not.

Reply 9 of 30, by teleguy

User metadata
Rank Member
Rank
Member
teleguy wrote:

The good news is that ddraw_test.exe that is included with wine now runs without triggering an infinite loop.

Scratch that. Apparently I made that that test with one of the older versions of WineD3D by mistake. The newer versions are still broken so I guess that proxy dll doesn't work.

Reply 10 of 30, by aqrit

User metadata
Rank Member
Rank
Member

TIE Fighter '98 doesn't crash if the desktop is set to 8-bit color
so it seems its problems are unrelated to the opengl-ddraw recursion loop?

WINEDEBUG with ms/opengl32 wrote:
err:d3d:context_choose_pixel_format Can't find a suitable iPixelFormat ... err:d3d:context_set_pixel_format Unable to set pixel […]
Show full quote

err:d3d:context_choose_pixel_format Can't find a suitable iPixelFormat
...
err:d3d:context_set_pixel_format Unable to set pixel format 7 on device context 4E011497. Already using format 5.
err:d3d_surface:surface_prepare_buffer Failed to create a PBO with error GL_NO_ERROR (0).
Segmentation fault

the whole pixelformat thing seems to be an on going problem
https://www.winehq.org/pipermail/wine-devel/2 … ary/102637.html

Reply 11 of 30, by Stiletto

User metadata
Rank l33t++
Rank
l33t++

Interesting how it has changed, or not, since 2012, aqrit:
Re: D3D to open gl wrapper

Hmmmm:
https://bugs.winehq.org/show_bug.cgi?id=2082
https://bugs.winehq.org/show_bug.cgi?id=35718

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 12 of 30, by teleguy

User metadata
Rank Member
Rank
Member
aqrit wrote:

TIE Fighter '98 doesn't crash if the desktop is set to 8-bit color
so it seems its problems are unrelated to the opengl-ddraw recursion loop?

Thanks! The same applies to JK and ddraw_test.exe. The proxy dll isn't even needed.

Reply 13 of 30, by aqrit

User metadata
Rank Member
Rank
Member

the wined3d .dll <= v1.1.38 from there do not static-link with opengl32.dll
the v1.7.32 version that I built does link to opengl32.dll

Last edited by aqrit on 2014-12-07, 18:35. Edited 2 times in total.

Reply 14 of 30, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
aqrit wrote:

the wined3d .dll <= v1.1.38 from there do not static-link with opengl32.dll

So this is a dependency added in a revision > v1.1.38? Weird... I wonder why.

PS. Been thinking about Bladeforce's request for a Wine subforum but I think what we might do is merge a bunch of the WineD3D on Windows threads, if that's okay with you.

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 15 of 30, by teleguy

User metadata
Rank Member
Rank
Member
aqrit wrote:

the wined3d .dll <= v1.1.38 from there do not static-link with opengl32.dll
the v1.7.32 version that I built does link to opengl32.dll

I'm using 1.7.32. It works without proxy dll as long as the game is set to 256 colors.

Reply 16 of 30, by teleguy

User metadata
Rank Member
Rank
Member
aqrit wrote:
note: wined3d.dll has a dependency on opengl32.dll but MS/opengl32.dll has a dependency on ddraw.dll ... […]
Show full quote

note:
wined3d.dll has a dependency on opengl32.dll
but MS/opengl32.dll has a dependency on ddraw.dll ...

so to use wined3d/ddraw.dll
one has to either use a different opengl32.dll
or rename wined3d/ddraw.dll to something else and hex edit the target game to import wined3d/ddraw under its new name.

Can someone with Windows 8 (or 10?) check if that is still the case?

I saw a forum post from someone that said he used WineD3D on Windows 8 without any modifications.

Reply 17 of 30, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
teleguy wrote:

I saw a forum post from someone that said he used WineD3D on Windows 8 without any modifications.

Maybe you are thinking of D3D to open gl wrapper ?