winejack.drv only supports 16bit sound so we can simplify the sound
[wine] / dlls / d3d9 / directx.c
1 /*
2  * IDirect3D9 implementation
3  *
4  * Copyright 2002 Jason Edmeades
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "wingdi.h"
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
33
34 #include "d3d9_private.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
37
38 /* IDirect3D9 IUnknown parts follow: */
39 HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppobj)
40 {
41     ICOM_THIS(IDirect3D9Impl,iface);
42
43     if (IsEqualGUID(riid, &IID_IUnknown)
44         || IsEqualGUID(riid, &IID_IDirect3D9)) {
45         IDirect3D9Impl_AddRef(iface);
46         *ppobj = This;
47         return D3D_OK;
48     }
49
50     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
51     return E_NOINTERFACE;
52 }
53
54 ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface) {
55     ICOM_THIS(IDirect3D9Impl,iface);
56     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
57     return ++(This->ref);
58 }
59
60 ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9 iface) {
61     ICOM_THIS(IDirect3D9Impl,iface);
62     ULONG ref = --This->ref;
63     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
64     if (ref == 0)
65         HeapFree(GetProcessHeap(), 0, This);
66     return ref;
67 }
68
69 /* IDirect3D9 Interface follow: */
70 HRESULT  WINAPI  IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface, void* pInitializeFunction) {
71     ICOM_THIS(IDirect3D9Impl,iface);
72     FIXME("(%p)->(%p): stub\n", This, pInitializeFunction);
73     return D3D_OK;
74 }
75
76 UINT     WINAPI  IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface) {
77     ICOM_THIS(IDirect3D9Impl,iface);
78     /* FIXME: Set to one for now to imply the display */
79     TRACE("(%p): Mostly stub, only returns primary display\n", This);
80     return 1;
81 }
82
83 HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
84     ICOM_THIS(IDirect3D9Impl,iface);
85     FIXME("(%p): stub\n", This);
86     return D3D_OK;
87 }
88
89 UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format) {
90     ICOM_THIS(IDirect3D9Impl,iface);
91     FIXME("(%p): stub\n", This);
92     return 0;
93 }
94
95 HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
96     ICOM_THIS(IDirect3D9Impl,iface);
97     FIXME("(%p): stub\n", This);
98     return D3D_OK;
99 }
100
101 HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9 iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
102     ICOM_THIS(IDirect3D9Impl,iface);
103     FIXME("(%p): stub\n", This);
104     return D3D_OK;
105 }
106
107 HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface,
108                                               UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
109                                               D3DFORMAT BackBufferFormat, BOOL Windowed) {
110     ICOM_THIS(IDirect3D9Impl,iface);
111     FIXME("(%p): stub\n", This);
112     return D3D_OK;
113 }
114
115 HRESULT  WINAPI  IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface,
116                                                   UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
117                                                   DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
118     ICOM_THIS(IDirect3D9Impl,iface);
119     FIXME("(%p): stub\n", This);
120     return D3D_OK;
121 }
122
123 HRESULT  WINAPI  IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 iface,
124                                                            UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
125                                                            BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
126     ICOM_THIS(IDirect3D9Impl,iface);
127     FIXME("(%p): stub\n", This);
128     return D3D_OK;
129 }
130
131 HRESULT  WINAPI  IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface, 
132                                                        UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
133                                                        D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
134     ICOM_THIS(IDirect3D9Impl,iface);
135     FIXME("(%p): stub\n", This);
136     return D3D_OK;
137 }
138
139 HRESULT  WINAPI  IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
140     ICOM_THIS(IDirect3D9Impl,iface);
141     FIXME("(%p): stub\n", This);
142     return D3D_OK;
143 }
144
145
146 HRESULT  WINAPI  IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
147     ICOM_THIS(IDirect3D9Impl,iface);
148     FIXME("(%p): stub\n", This);
149     return D3D_OK;
150 }
151
152 HMONITOR WINAPI  IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter) {
153     ICOM_THIS(IDirect3D9Impl,iface);
154     FIXME("(%p) : stub\n", This);
155     return NULL;
156 }
157
158 HRESULT  WINAPI  IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
159                                              DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, 
160                                              IDirect3DDevice9** ppReturnedDeviceInterface) {
161
162     ICOM_THIS(IDirect3D9Impl,iface);
163     FIXME("(%p) : stub\n", This);
164     return D3D_OK;
165 }
166
167 ICOM_VTABLE(IDirect3D9) Direct3D9_Vtbl =
168 {
169     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
170     IDirect3D9Impl_QueryInterface,
171     IDirect3D9Impl_AddRef,
172     IDirect3D9Impl_Release,
173     IDirect3D9Impl_RegisterSoftwareDevice,
174     IDirect3D9Impl_GetAdapterCount,
175     IDirect3D9Impl_GetAdapterIdentifier,
176     IDirect3D9Impl_GetAdapterModeCount,
177     IDirect3D9Impl_EnumAdapterModes,
178     IDirect3D9Impl_GetAdapterDisplayMode,
179     IDirect3D9Impl_CheckDeviceType,
180     IDirect3D9Impl_CheckDeviceFormat,
181     IDirect3D9Impl_CheckDeviceMultiSampleType,
182     IDirect3D9Impl_CheckDepthStencilMatch,
183     IDirect3D9Impl_CheckDeviceFormatConversion,
184     IDirect3D9Impl_GetDeviceCaps,
185     IDirect3D9Impl_GetAdapterMonitor,
186     IDirect3D9Impl_CreateDevice
187 };