Assorted spelling fixes.
[wine] / dlls / d3d8 / d3d8_main.c
1 /* Direct3D 8
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16  *
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winreg.h"
26 #include "wingdi.h"
27 #include "winuser.h"
28 #include "wine/debug.h"
29
30 #include "d3d8.h"
31 #include "d3d8_private.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
34
35 int num_lock = 0;
36 void (*wine_tsx11_lock_ptr)(void) = NULL;
37 void (*wine_tsx11_unlock_ptr)(void) = NULL;
38 int vs_mode = VS_HW; /* Hardware by default */
39
40 HRESULT WINAPI D3D8GetSWInfo(void)
41 {
42     FIXME("(void): stub\n");
43     return 0;
44 }
45
46 void WINAPI DebugSetMute(void)
47 {
48     /* nothing to do */
49 }
50
51 IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
52 {
53
54     IDirect3D8Impl *object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
55
56     object->lpVtbl = &Direct3D8_Vtbl;
57     object->direct3d8 = object;
58     object->ref = 1;
59
60     TRACE("SDKVersion = %x, Created Direct3D object at %p\n", SDKVersion, object);
61
62     return (IDirect3D8 *)object;
63 }
64
65 /* At process attach */
66 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
67 {
68     TRACE("D3D8 DLLMain Reason=%ld\n", fdwReason);
69     if (fdwReason == DLL_PROCESS_ATTACH)
70     {
71        HMODULE mod;
72        char buffer[32];
73        DWORD size = sizeof(buffer);
74        HKEY hkey = 0;
75
76        DisableThreadLibraryCalls(hInstDLL);
77
78        mod = GetModuleHandleA( "x11drv.dll" );
79        if (mod)
80        {
81            wine_tsx11_lock_ptr   = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
82            wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
83        }
84        if ( !RegOpenKeyA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Direct3D", &hkey) &&
85             !RegQueryValueExA( hkey, "VertexShaderMode", 0, NULL, buffer, &size) )
86        {
87            if (!strcmp(buffer,"none"))
88            {
89                TRACE("Disable vertex shader\n");
90                vs_mode = VS_NONE;
91            }
92            else if (!strcmp(buffer,"emulation"))
93            {
94                TRACE("Force SW vertex shader\n");
95                vs_mode = VS_SW;
96            }
97        }
98        if (vs_mode == VS_HW)
99            FIXME("Allow HW vertex shader\n");
100     }
101     return TRUE;
102 }