Commit d99c7d59 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

ddraw: Don't link to wined3d, load it at runtime.

This lets ddraw dlls built on a machine with OpenGL present run on other machines that may not have the OpenGL libraries installed.
parent 3538c0cd
......@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = ddraw.dll
IMPORTLIB = libddraw.$(IMPLIBEXT)
IMPORTS = wined3d ole32 user32 gdi32 advapi32 kernel32 ntdll
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
EXTRAINCL = @X_CFLAGS@
EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@
......
......@@ -48,6 +48,11 @@
#include "ddraw_private.h"
typedef IWineD3D* (WINAPI *fnWineDirect3DCreate)(UINT, UINT, IUnknown *);
static HMODULE hWineD3D = (HMODULE) -1;
static fnWineDirect3DCreate pWineDirect3DCreate;
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
/* The configured default surface */
......@@ -149,13 +154,27 @@ DDRAW_Create(GUID *guid,
This->orig_width = GetSystemMetrics(SM_CXSCREEN);
This->orig_height = GetSystemMetrics(SM_CYSCREEN);
if (hWineD3D == (HMODULE) -1)
{
hWineD3D = LoadLibraryA("wined3d");
if (hWineD3D)
pWineDirect3DCreate = (fnWineDirect3DCreate) GetProcAddress(hWineD3D, "WineDirect3DCreate");
}
if (!hWineD3D)
{
ERR("Couldn't load WineD3D - OpenGL libs not present?\n");
hr = E_NOTIMPL;
goto err_out;
}
/* Initialize WineD3D
*
* All Rendering (2D and 3D) is relayed to WineD3D,
* but DirectDraw specific management, like DDSURFACEDESC and DDPIXELFORMAT
* structure handling is handled in this lib.
*/
wineD3D = WineDirect3DCreate(0 /* SDKVersion */, 7 /* DXVersion */, (IUnknown *) This /* Parent */);
wineD3D = pWineDirect3DCreate(0 /* SDKVersion */, 7 /* DXVersion */, (IUnknown *) This /* Parent */);
if(!wineD3D)
{
ERR("Failed to initialise WineD3D\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment