imagehlp: Check for 64-bit PE files in CheckSumMappedFile.
[wine] / dlls / d3d8 / d3d8_main.c
1 /*
2  * Direct3D 8
3  *
4  * Copyright 2005 Oliver Stieber
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  *
20  */
21
22 #include "config.h"
23 #include "initguid.h"
24 #include "d3d8_private.h"
25 #include "wine/debug.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
28
29 HRESULT WINAPI D3D8GetSWInfo(void) {
30     FIXME("(void): stub\n");
31     return 0;
32 }
33
34 void WINAPI DebugSetMute(void) {
35     /* nothing to do */
36 }
37
38 IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) {
39     IDirect3D8Impl* object;
40     TRACE("SDKVersion = %x\n", SDKVersion);
41
42     wined3d_mutex_lock();
43
44     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
45
46     object->lpVtbl = &Direct3D8_Vtbl;
47     object->ref = 1;
48     object->WineD3D = WineDirect3DCreate(8, (IUnknown *)object);
49
50     TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
51
52     wined3d_mutex_unlock();
53
54     if (!object->WineD3D)
55     {
56         HeapFree( GetProcessHeap(), 0, object );
57         object = NULL;
58     }
59     return (IDirect3D8*) object;
60 }
61
62 /* At process attach */
63 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
64 {
65     TRACE("fdwReason=%d\n", fdwReason);
66     if (fdwReason == DLL_PROCESS_ATTACH)
67         DisableThreadLibraryCalls(hInstDLL);
68
69     return TRUE;
70 }
71
72 /***********************************************************************
73  *              ValidateVertexShader (D3D8.@)
74  *
75  * I've seen reserved1 and reserved2 always passed as 0's
76  * bool seems always passed as 0 or 1, but other values work as well...
77  * toto       result?
78  */
79 HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, DWORD* reserved2, BOOL bool, DWORD* toto)
80 {
81   HRESULT ret;
82   FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, bool, toto);
83
84   if (!vertexshader)
85       return E_FAIL;
86
87   if (reserved1 || reserved2)
88       return E_FAIL;
89
90   switch(*vertexshader) {
91         case 0xFFFE0101:
92         case 0xFFFE0100:
93             ret=S_OK;
94             break;
95         default:
96             ERR("vertexshader version mismatch\n");
97             ret=E_FAIL;
98         }
99
100   return ret;
101 }
102
103 /***********************************************************************
104  *              ValidatePixelShader (D3D8.@)
105  *
106  * PARAMS
107  * toto       result?
108  */
109 HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bool, DWORD* toto)
110 {
111   HRESULT ret;
112   FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto);
113
114   if (!pixelshader)
115       return E_FAIL;
116
117   if (reserved1)
118       return E_FAIL;
119
120   switch(*pixelshader) {
121         case 0xFFFF0100:
122         case 0xFFFF0101:
123         case 0xFFFF0102:
124         case 0xFFFF0103:
125         case 0xFFFF0104:
126             ret=S_OK;
127             break;
128         default:
129             ERR("pixelshader version mismatch\n");
130             ret=E_FAIL;
131         }
132   return ret;
133 }