Write the RegOwner and RegCompany keys as blank if they do not exist
[wine] / dlls / wined3d / wined3d_main.c
1 /*
2  * Direct3D wine internal interface main
3  *
4  * Copyright 2002-2003 The wine-d3d team
5  * Copyright 2002-2003 Raphael Junqueira
6  * Copyright 2004      Jason Edmeades   
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #include "config.h"
24
25 #include "initguid.h"
26 #include "wined3d_private.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(wine_d3d);
29
30 int num_lock = 0;
31 void (*wine_tsx11_lock_ptr)(void) = NULL;
32 void (*wine_tsx11_unlock_ptr)(void) = NULL;
33 int vs_mode = VS_HW;   /* Hardware by default */
34 int ps_mode = PS_NONE; /* Disabled by default */
35
36 IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *parent) {
37     IWineD3DImpl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DImpl));
38     object->lpVtbl = &IWineD3D_Vtbl;
39     object->dxVersion = dxVersion;
40     object->ref = 1;
41     object->parent = parent;
42
43     TRACE("Created WineD3D object @ %p for d3d%d support\n", object, dxVersion);
44
45     return (IWineD3D *)object;
46 }
47
48 /* At process attach */
49 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
50 {
51     TRACE("WineD3D DLLMain Reason=%ld\n", fdwReason);
52     if (fdwReason == DLL_PROCESS_ATTACH)
53     {
54        HMODULE mod;
55        char buffer[32];
56        DWORD size = sizeof(buffer);
57        HKEY hkey = 0;
58
59        DisableThreadLibraryCalls(hInstDLL);
60
61        mod = GetModuleHandleA( "winex11.drv" );
62        if (mod)
63        {
64            wine_tsx11_lock_ptr   = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
65            wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
66        }
67        if ( !RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Direct3D", &hkey) )
68        {
69            if ( !RegQueryValueExA( hkey, "VertexShaderMode", 0, NULL, buffer, &size) )
70            {
71                if (!strcmp(buffer,"none"))
72                {
73                    TRACE("Disable vertex shaders\n");
74                    vs_mode = VS_NONE;
75                }
76                else if (!strcmp(buffer,"emulation"))
77                {
78                    TRACE("Force SW vertex shaders\n");
79                    vs_mode = VS_SW;
80                }
81            }
82            if ( !RegQueryValueExA( hkey, "PixelShaderMode", 0, NULL, buffer, &size) )
83            {
84                if (!strcmp(buffer,"enabled"))
85                {
86                    TRACE("Allow pixel shaders\n");
87                    ps_mode = PS_HW;
88                }
89            }
90        }
91        if (vs_mode == VS_HW)
92            TRACE("Allow HW vertex shaders\n");
93        if (ps_mode == PS_NONE)
94            TRACE("Disable pixel shaders\n");
95     }
96     return TRUE;
97 }