d3dx9_36/tests: Add a '\n' to a trace() call.
[wine] / dlls / d3drm / d3drm.c
1 /*
2  * Implementation of IDirect3DRM Interface
3  *
4  * Copyright 2010 Christian Costa
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 #include "wine/debug.h"
22
23 #define COBJMACROS
24
25 #include "winbase.h"
26 #include "wingdi.h"
27
28 #include "d3drm_private.h"
29
30 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
31
32 typedef struct {
33     IDirect3DRM IDirect3DRM_iface;
34     LONG ref;
35 } IDirect3DRMImpl;
36
37 static const struct IDirect3DRMVtbl Direct3DRM_Vtbl;
38
39 static inline IDirect3DRMImpl *impl_from_IDirect3DRM(IDirect3DRM *iface)
40 {
41     return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM_iface);
42 }
43
44 HRESULT Direct3DRM_create(LPDIRECT3DRM* ppDirect3DRM)
45 {
46     IDirect3DRMImpl* object;
47
48     TRACE("(%p)\n", ppDirect3DRM);
49
50     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DRMImpl));
51     if (!object)
52     {
53         ERR("Out of memory\n");
54         return E_OUTOFMEMORY;
55     }
56
57     object->IDirect3DRM_iface.lpVtbl = &Direct3DRM_Vtbl;
58     object->ref = 1;
59
60     *ppDirect3DRM = (IDirect3DRM*)object;
61
62     return S_OK;
63 }
64
65 /*** IUnknown methods ***/
66 static HRESULT WINAPI IDirect3DRMImpl_QueryInterface(IDirect3DRM* iface, REFIID riid, void** ppvObject)
67 {
68     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
69
70     TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
71
72     if (IsEqualGUID(riid, &IID_IUnknown) ||
73         IsEqualGUID(riid, &IID_IDirect3DRM))
74     {
75         IUnknown_AddRef(iface);
76         *ppvObject = This;
77         return S_OK;
78     }
79
80     ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
81     return E_NOINTERFACE;
82 }
83
84 static ULONG WINAPI IDirect3DRMImpl_AddRef(IDirect3DRM* iface)
85 {
86     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
87
88     TRACE("(%p/%p)\n", iface, This);
89
90     return InterlockedIncrement(&This->ref);
91 }
92
93 static ULONG WINAPI IDirect3DRMImpl_Release(IDirect3DRM* iface)
94 {
95     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
96     ULONG ref = InterlockedDecrement(&This->ref);
97
98     TRACE("(%p/%p)\n", iface, This);
99
100     if (!ref)
101         HeapFree(GetProcessHeap(), 0, This);
102
103     return ref;
104 }
105
106 /*** IDirect3DRM methods ***/
107 static HRESULT WINAPI IDirect3DRMImpl_CreateObject(IDirect3DRM* iface, REFCLSID rclsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
108 {
109     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
110
111     FIXME("(%p/%p)->(%s,%p,%s,%p): stub\n", iface, This, debugstr_guid(rclsid), pUnkOuter, debugstr_guid(riid), ppvObj);
112
113     return E_NOTIMPL;
114 }
115
116 static HRESULT WINAPI IDirect3DRMImpl_CreateFrame(IDirect3DRM* iface, LPDIRECT3DRMFRAME pFrameParent, LPDIRECT3DRMFRAME * ppFrame)
117 {
118     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
119
120     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pFrameParent, ppFrame);
121
122     return E_NOTIMPL;
123 }
124
125 static HRESULT WINAPI IDirect3DRMImpl_CreateMesh(IDirect3DRM* iface, LPDIRECT3DRMMESH * ppMesh)
126 {
127     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
128
129     FIXME("(%p/%p)->(%p): stub\n", iface, This, ppMesh);
130
131     return E_NOTIMPL;
132 }
133
134 static HRESULT WINAPI IDirect3DRMImpl_CreateMeshBuilder(IDirect3DRM* iface, LPDIRECT3DRMMESHBUILDER * ppMeshBuilder)
135 {
136     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
137
138     TRACE("(%p/%p)->(%p)\n", iface, This, ppMeshBuilder);
139
140     return Direct3DRMMeshBuilder_create(ppMeshBuilder);
141 }
142
143 static HRESULT WINAPI IDirect3DRMImpl_CreateFace(IDirect3DRM* iface, LPDIRECT3DRMFACE * ppFace)
144 {
145     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
146
147     FIXME("(%p/%p)->(%p): stub\n", iface, This, ppFace);
148
149     return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI IDirect3DRMImpl_CreateAnimation(IDirect3DRM* iface, LPDIRECT3DRMANIMATION * ppAnimation)
153 {
154     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
155
156     FIXME("(%p/%p)->(%p): stub\n", iface, This, ppAnimation);
157
158     return E_NOTIMPL;
159 }
160
161 static HRESULT WINAPI IDirect3DRMImpl_CreateAnimationSet(IDirect3DRM* iface, LPDIRECT3DRMANIMATIONSET * ppAnimationSet)
162 {
163     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
164
165     FIXME("(%p/%p)->(%p): stub\n", iface, This, ppAnimationSet);
166
167     return E_NOTIMPL;
168 }
169
170 static HRESULT WINAPI IDirect3DRMImpl_CreateTexture(IDirect3DRM* iface, LPD3DRMIMAGE pImage, LPDIRECT3DRMTEXTURE * ppTexture)
171 {
172     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
173
174     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pImage, ppTexture);
175
176     return E_NOTIMPL;
177 }
178
179 static HRESULT WINAPI IDirect3DRMImpl_CreateLight(IDirect3DRM* iface, D3DRMLIGHTTYPE type, D3DCOLOR color, LPDIRECT3DRMLIGHT * ppLight)
180 {
181     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
182
183     FIXME("(%p/%p)->(%d,%d,%p): stub\n", iface, This, type, color, ppLight);
184
185     return E_NOTIMPL;
186 }
187
188 static HRESULT WINAPI IDirect3DRMImpl_CreateLightRGB(IDirect3DRM* iface, D3DRMLIGHTTYPE type,  D3DVALUE red, D3DVALUE green, D3DVALUE blue, LPDIRECT3DRMLIGHT * ppLight)
189 {
190     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
191
192     FIXME("(%p/%p)->(%d,%f,%f,%f,%p): stub\n", iface, This, type, red, green, blue, ppLight);
193
194     return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI IDirect3DRMImpl_Material(IDirect3DRM* iface, D3DVALUE m, LPDIRECT3DRMMATERIAL * ppMaterial)
198 {
199     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
200
201     FIXME("(%p/%p)->(%f,%p): stub\n", iface, This, m, ppMaterial);
202
203     return E_NOTIMPL;
204 }
205
206 static HRESULT WINAPI IDirect3DRMImpl_CreateDevice(IDirect3DRM* iface, DWORD width, DWORD height, LPDIRECT3DRMDEVICE * ppDevice)
207 {
208     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
209
210     FIXME("(%p/%p)->(%d,%d,%p): stub\n", iface, This, width, height, ppDevice);
211
212     return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromSurface(IDirect3DRM* iface, LPGUID pGUID, LPDIRECTDRAW pDD, LPDIRECTDRAWSURFACE pDDSBack, LPDIRECT3DRMDEVICE * ppDevice)
216 {
217     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
218
219     FIXME("(%p/%p)->(%s,%p,%p,%p): stub\n", iface, This, debugstr_guid(pGUID), pDD, pDDSBack, ppDevice);
220
221     return E_NOTIMPL;
222 }
223
224 static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromD3D(IDirect3DRM* iface, LPDIRECT3D pD3D, LPDIRECT3DDEVICE pD3DDev, LPDIRECT3DRMDEVICE * ppDevice)
225 {
226     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
227
228     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, pD3D, pD3DDev, ppDevice);
229
230     return E_NOTIMPL;
231 }
232
233 static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromClipper(IDirect3DRM* iface, LPDIRECTDRAWCLIPPER pDDClipper, LPGUID pGUID, int width, int height, LPDIRECT3DRMDEVICE * ppDevice)
234 {
235     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
236
237     FIXME("(%p/%p)->(%p,%s,%d,%d,%p): stub\n", iface, This, pDDClipper, debugstr_guid(pGUID), width, height, ppDevice);
238
239     return E_NOTIMPL;
240 }
241
242 static HRESULT WINAPI IDirect3DRMImpl_CreateShadow(IDirect3DRM* iface, LPDIRECT3DRMVISUAL pVisual, LPDIRECT3DRMLIGHT pLight, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, LPDIRECT3DRMVISUAL * ppVisual)
243 {
244     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
245
246     FIXME("(%p/%p)->(%p,%p,%f,%f,%f,%f,%f,%f,%p): stub\n", iface, This, pVisual, pLight, px, py, pz, nx, ny, nz, ppVisual);
247
248     return E_NOTIMPL;
249 }
250
251 static HRESULT WINAPI IDirect3DRMImpl_CreateTextureFromSurface(IDirect3DRM* iface, LPDIRECTDRAWSURFACE pDDS, LPDIRECT3DRMTEXTURE * ppTexture)
252 {
253     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
254
255     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pDDS, ppTexture);
256
257     return E_NOTIMPL;
258 }
259
260 static HRESULT WINAPI IDirect3DRMImpl_CreateViewport(IDirect3DRM* iface, LPDIRECT3DRMDEVICE pDevice, LPDIRECT3DRMFRAME pFrame, DWORD xpos, DWORD ypos, DWORD width, DWORD height, LPDIRECT3DRMVIEWPORT * ppViewport)
261 {
262     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
263
264     FIXME("(%p/%p)->(%p,%p,%d,%d,%d,%d,%p): stub\n", iface, This, pDevice, pFrame, xpos, ypos, width, height, ppViewport);
265
266     return E_NOTIMPL;
267 }
268
269 static HRESULT WINAPI IDirect3DRMImpl_CreateWrap(IDirect3DRM* iface, D3DRMWRAPTYPE type, LPDIRECT3DRMFRAME pFrame, D3DVALUE ox, D3DVALUE oy, D3DVALUE oz, D3DVALUE dx, D3DVALUE dy, D3DVALUE dz, D3DVALUE ux, D3DVALUE uy, D3DVALUE uz, D3DVALUE ou, D3DVALUE ov, D3DVALUE su, D3DVALUE sv, LPDIRECT3DRMWRAP * ppWrap)
270 {
271     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
272
273     FIXME("(%p/%p)->(%d,%p,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%p): stub\n", iface, This, type, pFrame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, ppWrap);
274
275     return E_NOTIMPL;
276 }
277
278 static HRESULT WINAPI IDirect3DRMImpl_CreateUserVisual(IDirect3DRM* iface, D3DRMUSERVISUALCALLBACK cb, LPVOID pArg, LPDIRECT3DRMUSERVISUAL * ppUserVisual)
279 {
280     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
281
282     FIXME("(%p/%p)->(%p,%p,%p): stub\n", iface, This, cb, pArg, ppUserVisual);
283
284     return E_NOTIMPL;
285 }
286
287 static HRESULT WINAPI IDirect3DRMImpl_LoadTexture(IDirect3DRM* iface, const char * filename, LPDIRECT3DRMTEXTURE * ppTexture)
288 {
289     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
290
291     FIXME("(%p/%p)->(%s,%p): stub\n", iface, This, filename, ppTexture);
292
293     return E_NOTIMPL;
294 }
295
296 static HRESULT WINAPI IDirect3DRMImpl_LoadTextureFromResource(IDirect3DRM* iface, HRSRC rs, LPDIRECT3DRMTEXTURE * ppTexture)
297 {
298     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
299
300     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, rs, ppTexture);
301
302     return E_NOTIMPL;
303 }
304
305 static HRESULT WINAPI IDirect3DRMImpl_SetSearchPath(IDirect3DRM* iface, LPCSTR path)
306 {
307     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
308
309     FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
310
311     return E_NOTIMPL;
312 }
313
314 static HRESULT WINAPI IDirect3DRMImpl_AddSearchPath(IDirect3DRM* iface, LPCSTR path)
315 {
316     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
317
318     FIXME("(%p/%p)->(%s): stub\n", iface, This, path);
319
320     return E_NOTIMPL;
321 }
322
323 static HRESULT WINAPI IDirect3DRMImpl_GetSearchPath(IDirect3DRM* iface, DWORD *size_return, LPSTR path_return)
324 {
325     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
326
327     FIXME("(%p/%p)->(%p,%s): stub\n", iface, This, size_return, path_return);
328
329     return E_NOTIMPL;
330 }
331
332 static HRESULT WINAPI IDirect3DRMImpl_SetDefaultTextureColors(IDirect3DRM* iface, DWORD nb_colors)
333 {
334     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
335
336     FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
337
338     return E_NOTIMPL;
339 }
340
341 static HRESULT WINAPI IDirect3DRMImpl_SetDefaultTextureShades(IDirect3DRM* iface, DWORD nb_shades)
342 {
343     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
344
345     FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
346
347     return E_NOTIMPL;
348 }
349
350 static HRESULT WINAPI IDirect3DRMImpl_GetDevices(IDirect3DRM* iface, LPDIRECT3DRMDEVICEARRAY * ppDeviceArray)
351 {
352     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
353
354     FIXME("(%p/%p)->(%p): stub\n", iface, This, ppDeviceArray);
355
356     return E_NOTIMPL;
357 }
358
359 static HRESULT WINAPI IDirect3DRMImpl_GetNamedObject(IDirect3DRM* iface, const char * pName, LPDIRECT3DRMOBJECT * ppObject)
360 {
361     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
362
363     FIXME("(%p/%p)->(%s,%p): stub\n", iface, This, pName, ppObject);
364
365     return E_NOTIMPL;
366 }
367
368 static HRESULT WINAPI IDirect3DRMImpl_EnumerateObjects(IDirect3DRM* iface, D3DRMOBJECTCALLBACK cb, LPVOID pArg)
369 {
370     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
371
372     FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, cb, pArg);
373
374     return E_NOTIMPL;
375 }
376
377 static HRESULT WINAPI IDirect3DRMImpl_Load(IDirect3DRM* iface, LPVOID pObjSource, LPVOID pObjID, LPIID * ppGUIDs, DWORD nb_GUIDs, D3DRMLOADOPTIONS LOFlags, D3DRMLOADCALLBACK LoadProc, LPVOID pArgLP, D3DRMLOADTEXTURECALLBACK LoadTextureProc, LPVOID pArgLTP, LPDIRECT3DRMFRAME pParentFrame)
378 {
379     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
380
381     FIXME("(%p/%p)->(%p,%p,%p,%d,%d,%p,%p,%p,%p,%p): stub\n", iface, This, pObjSource, pObjID, ppGUIDs, nb_GUIDs, LOFlags, LoadProc, pArgLP, LoadTextureProc, pArgLTP, pParentFrame);
382
383     return E_NOTIMPL;
384 }
385
386 static HRESULT WINAPI IDirect3DRMImpl_Tick(IDirect3DRM* iface, D3DVALUE tick)
387 {
388     IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
389
390     FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
391
392     return E_NOTIMPL;
393 }
394
395 static const struct IDirect3DRMVtbl Direct3DRM_Vtbl =
396 {
397     IDirect3DRMImpl_QueryInterface,
398     IDirect3DRMImpl_AddRef,
399     IDirect3DRMImpl_Release,
400     IDirect3DRMImpl_CreateObject,
401     IDirect3DRMImpl_CreateFrame,
402     IDirect3DRMImpl_CreateMesh,
403     IDirect3DRMImpl_CreateMeshBuilder,
404     IDirect3DRMImpl_CreateFace,
405     IDirect3DRMImpl_CreateAnimation,
406     IDirect3DRMImpl_CreateAnimationSet,
407     IDirect3DRMImpl_CreateTexture,
408     IDirect3DRMImpl_CreateLight,
409     IDirect3DRMImpl_CreateLightRGB,
410     IDirect3DRMImpl_Material,
411     IDirect3DRMImpl_CreateDevice,
412     IDirect3DRMImpl_CreateDeviceFromSurface,
413     IDirect3DRMImpl_CreateDeviceFromD3D,
414     IDirect3DRMImpl_CreateDeviceFromClipper,
415     IDirect3DRMImpl_CreateShadow,
416     IDirect3DRMImpl_CreateTextureFromSurface,
417     IDirect3DRMImpl_CreateViewport,
418     IDirect3DRMImpl_CreateWrap,
419     IDirect3DRMImpl_CreateUserVisual,
420     IDirect3DRMImpl_LoadTexture,
421     IDirect3DRMImpl_LoadTextureFromResource,
422     IDirect3DRMImpl_SetSearchPath,
423     IDirect3DRMImpl_AddSearchPath,
424     IDirect3DRMImpl_GetSearchPath,
425     IDirect3DRMImpl_SetDefaultTextureColors,
426     IDirect3DRMImpl_SetDefaultTextureShades,
427     IDirect3DRMImpl_GetDevices,
428     IDirect3DRMImpl_GetNamedObject,
429     IDirect3DRMImpl_EnumerateObjects,
430     IDirect3DRMImpl_Load,
431     IDirect3DRMImpl_Tick
432 };