dsound: Do not call CoUninitialize if CoInitialize failed.
[wine.git] / dlls / d3drm / device.c
blobe1e2250440c48c32a91954757b382c8f8e9e2c9b
1 /*
2 * Implementation of IDirect3DRMDevice Interface
4 * Copyright 2011, 2012 André Hentschel
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/debug.h"
26 #define COBJMACROS
28 #include "winbase.h"
29 #include "wingdi.h"
31 #include "d3drm_private.h"
32 #include "initguid.h"
33 #include "d3drmwin.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
37 struct d3drm_device
39 IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
40 IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
41 IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
42 LONG ref;
43 BOOL dither;
44 D3DRMRENDERQUALITY quality;
45 DWORD rendermode;
46 DWORD height;
47 DWORD width;
50 static inline struct d3drm_device *impl_from_IDirect3DRMDevice2(IDirect3DRMDevice2 *iface)
52 return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice2_iface);
55 static inline struct d3drm_device *impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface)
57 return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice3_iface);
60 static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface)
62 return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMWinDevice_iface);
65 static HRESULT WINAPI d3drm_device2_QueryInterface(IDirect3DRMDevice2 *iface, REFIID riid, void **out)
67 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
69 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
71 if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)
72 || IsEqualGUID(riid, &IID_IDirect3DRMDevice)
73 || IsEqualGUID(riid, &IID_IUnknown))
75 *out = &device->IDirect3DRMDevice2_iface;
77 else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3))
79 *out = &device->IDirect3DRMDevice3_iface;
81 else if (IsEqualGUID(riid, &IID_IDirect3DRMWinDevice))
83 *out = &device->IDirect3DRMWinDevice_iface;
85 else
87 *out = NULL;
88 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
89 return E_NOINTERFACE;
92 IUnknown_AddRef((IUnknown *)*out);
93 return S_OK;
96 static ULONG WINAPI d3drm_device2_AddRef(IDirect3DRMDevice2 *iface)
98 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
99 ULONG refcount = InterlockedIncrement(&device->ref);
101 TRACE("%p increasing refcount to %u.\n", iface, refcount);
103 return refcount;
106 static ULONG WINAPI d3drm_device2_Release(IDirect3DRMDevice2 *iface)
108 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
109 ULONG refcount = InterlockedDecrement(&device->ref);
111 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
113 if (!refcount)
114 HeapFree(GetProcessHeap(), 0, device);
116 return refcount;
119 static HRESULT WINAPI d3drm_device2_Clone(IDirect3DRMDevice2 *iface,
120 IUnknown *outer, REFIID iid, void **out)
122 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
124 return E_NOTIMPL;
127 static HRESULT WINAPI d3drm_device2_AddDestroyCallback(IDirect3DRMDevice2 *iface,
128 D3DRMOBJECTCALLBACK cb, void *ctx)
130 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
132 return E_NOTIMPL;
135 static HRESULT WINAPI d3drm_device2_DeleteDestroyCallback(IDirect3DRMDevice2 *iface,
136 D3DRMOBJECTCALLBACK cb, void *ctx)
138 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
140 return E_NOTIMPL;
143 static HRESULT WINAPI d3drm_device2_SetAppData(IDirect3DRMDevice2 *iface, DWORD data)
145 FIXME("iface %p, data %#x stub!\n", iface, data);
147 return E_NOTIMPL;
150 static DWORD WINAPI d3drm_device2_GetAppData(IDirect3DRMDevice2 *iface)
152 FIXME("iface %p stub!\n", iface);
154 return 0;
157 static HRESULT WINAPI d3drm_device2_SetName(IDirect3DRMDevice2 *iface, const char *name)
159 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
161 return E_NOTIMPL;
164 static HRESULT WINAPI d3drm_device2_GetName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
166 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
168 return E_NOTIMPL;
171 static HRESULT WINAPI d3drm_device2_GetClassName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
173 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
175 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
177 return IDirect3DRMDevice3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name);
180 static HRESULT WINAPI d3drm_device2_Init(IDirect3DRMDevice2 *iface, ULONG width, ULONG height)
182 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
184 TRACE("iface %p, width %u, height %u.\n", iface, width, height);
186 return IDirect3DRMDevice3_Init(&device->IDirect3DRMDevice3_iface, width, height);
189 static HRESULT WINAPI d3drm_device2_InitFromD3D(IDirect3DRMDevice2 *iface,
190 IDirect3D *d3d, IDirect3DDevice *d3d_device)
192 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
194 return E_NOTIMPL;
197 static HRESULT WINAPI d3drm_device2_InitFromClipper(IDirect3DRMDevice2 *iface,
198 IDirectDrawClipper *clipper, GUID *guid, int width, int height)
200 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
202 TRACE("iface %p, clipper %p, guid %s, width %d, height %d.\n",
203 iface, clipper, debugstr_guid(guid), width, height);
205 return IDirect3DRMDevice3_InitFromClipper(&device->IDirect3DRMDevice3_iface,
206 clipper, guid, width, height);
209 static HRESULT WINAPI d3drm_device2_Update(IDirect3DRMDevice2 *iface)
211 FIXME("iface %p stub!\n", iface);
213 return D3DRM_OK;
216 static HRESULT WINAPI d3drm_device2_AddUpdateCallback(IDirect3DRMDevice2 *iface,
217 D3DRMUPDATECALLBACK cb, void *ctx)
219 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
221 return E_NOTIMPL;
224 static HRESULT WINAPI d3drm_device2_DeleteUpdateCallback(IDirect3DRMDevice2 *iface,
225 D3DRMUPDATECALLBACK cb, void *ctx)
227 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
229 return E_NOTIMPL;
232 static HRESULT WINAPI d3drm_device2_SetBufferCount(IDirect3DRMDevice2 *iface, DWORD count)
234 FIXME("iface %p, count %u.\n", iface, count);
236 return E_NOTIMPL;
239 static DWORD WINAPI d3drm_device2_GetBufferCount(IDirect3DRMDevice2 *iface)
241 FIXME("iface %p stub!\n", iface);
243 return E_NOTIMPL;
246 static HRESULT WINAPI d3drm_device2_SetDither(IDirect3DRMDevice2 *iface, BOOL enable)
248 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
250 TRACE("iface %p, enabled %#x.\n", iface, enable);
252 return IDirect3DRMDevice3_SetDither(&device->IDirect3DRMDevice3_iface, enable);
255 static HRESULT WINAPI d3drm_device2_SetShades(IDirect3DRMDevice2 *iface, DWORD count)
257 FIXME("iface %p, count %u stub!\n", iface, count);
259 return E_NOTIMPL;
262 static HRESULT WINAPI d3drm_device2_SetQuality(IDirect3DRMDevice2 *iface, D3DRMRENDERQUALITY quality)
264 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
266 TRACE("iface %p, quality %u.\n", iface, quality);
268 return IDirect3DRMDevice3_SetQuality(&device->IDirect3DRMDevice3_iface, quality);
271 static HRESULT WINAPI d3drm_device2_SetTextureQuality(IDirect3DRMDevice2 *iface, D3DRMTEXTUREQUALITY quality)
273 FIXME("iface %p, quality %u stub!\n", iface, quality);
275 return E_NOTIMPL;
278 static HRESULT WINAPI d3drm_device2_GetViewports(IDirect3DRMDevice2 *iface, IDirect3DRMViewportArray **array)
280 FIXME("iface %p, array %p stub!\n", iface, array);
282 return E_NOTIMPL;
285 static BOOL WINAPI d3drm_device2_GetDither(IDirect3DRMDevice2 *iface)
287 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
289 TRACE("iface %p.\n", iface);
291 return IDirect3DRMDevice3_GetDither(&device->IDirect3DRMDevice3_iface);
294 static DWORD WINAPI d3drm_device2_GetShades(IDirect3DRMDevice2 *iface)
296 FIXME("iface %p stub!\n", iface);
298 return E_NOTIMPL;
301 static DWORD WINAPI d3drm_device2_GetHeight(IDirect3DRMDevice2 *iface)
303 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
305 TRACE("iface %p.\n", iface);
307 return IDirect3DRMDevice3_GetHeight(&device->IDirect3DRMDevice3_iface);
310 static DWORD WINAPI d3drm_device2_GetWidth(IDirect3DRMDevice2 *iface)
312 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
314 TRACE("iface %p.\n", iface);
316 return IDirect3DRMDevice3_GetWidth(&device->IDirect3DRMDevice3_iface);
319 static DWORD WINAPI d3drm_device2_GetTrianglesDrawn(IDirect3DRMDevice2 *iface)
321 FIXME("iface %p stub!\n", iface);
323 return E_NOTIMPL;
326 static DWORD WINAPI d3drm_device2_GetWireframeOptions(IDirect3DRMDevice2 *iface)
328 FIXME("iface %p stub!\n", iface);
330 return E_NOTIMPL;
333 static D3DRMRENDERQUALITY WINAPI d3drm_device2_GetQuality(IDirect3DRMDevice2 *iface)
335 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
337 TRACE("iface %p.\n", iface);
339 return IDirect3DRMDevice3_GetQuality(&device->IDirect3DRMDevice3_iface);
342 static D3DCOLORMODEL WINAPI d3drm_device2_GetColorModel(IDirect3DRMDevice2 *iface)
344 FIXME("iface %p stub!\n", iface);
346 return E_NOTIMPL;
349 static D3DRMTEXTUREQUALITY WINAPI d3drm_device2_GetTextureQuality(IDirect3DRMDevice2 *iface)
351 FIXME("iface %p stub!\n", iface);
353 return E_NOTIMPL;
356 static HRESULT WINAPI d3drm_device2_GetDirect3DDevice(IDirect3DRMDevice2 *iface, IDirect3DDevice **d3d_device)
358 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
360 return E_NOTIMPL;
363 static HRESULT WINAPI d3drm_device2_InitFromD3D2(IDirect3DRMDevice2 *iface,
364 IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device)
366 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
368 return E_NOTIMPL;
371 static HRESULT WINAPI d3drm_device2_InitFromSurface(IDirect3DRMDevice2 *iface,
372 GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer)
374 FIXME("iface %p, guid %s, ddraw %p, backbuffer %p stub!\n",
375 iface, debugstr_guid(guid), ddraw, backbuffer);
377 return E_NOTIMPL;
380 static HRESULT WINAPI d3drm_device2_SetRenderMode(IDirect3DRMDevice2 *iface, DWORD flags)
382 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
384 TRACE("iface %p, flags %#x.\n", iface, flags);
386 return IDirect3DRMDevice3_SetRenderMode(&device->IDirect3DRMDevice3_iface, flags);
389 static DWORD WINAPI d3drm_device2_GetRenderMode(IDirect3DRMDevice2 *iface)
391 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
393 TRACE("iface %p.\n", iface);
395 return IDirect3DRMDevice3_GetRenderMode(&device->IDirect3DRMDevice3_iface);
398 static HRESULT WINAPI d3drm_device2_GetDirect3DDevice2(IDirect3DRMDevice2 *iface, IDirect3DDevice2 **d3d_device)
400 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
402 return E_NOTIMPL;
405 static const struct IDirect3DRMDevice2Vtbl d3drm_device2_vtbl =
407 d3drm_device2_QueryInterface,
408 d3drm_device2_AddRef,
409 d3drm_device2_Release,
410 d3drm_device2_Clone,
411 d3drm_device2_AddDestroyCallback,
412 d3drm_device2_DeleteDestroyCallback,
413 d3drm_device2_SetAppData,
414 d3drm_device2_GetAppData,
415 d3drm_device2_SetName,
416 d3drm_device2_GetName,
417 d3drm_device2_GetClassName,
418 d3drm_device2_Init,
419 d3drm_device2_InitFromD3D,
420 d3drm_device2_InitFromClipper,
421 d3drm_device2_Update,
422 d3drm_device2_AddUpdateCallback,
423 d3drm_device2_DeleteUpdateCallback,
424 d3drm_device2_SetBufferCount,
425 d3drm_device2_GetBufferCount,
426 d3drm_device2_SetDither,
427 d3drm_device2_SetShades,
428 d3drm_device2_SetQuality,
429 d3drm_device2_SetTextureQuality,
430 d3drm_device2_GetViewports,
431 d3drm_device2_GetDither,
432 d3drm_device2_GetShades,
433 d3drm_device2_GetHeight,
434 d3drm_device2_GetWidth,
435 d3drm_device2_GetTrianglesDrawn,
436 d3drm_device2_GetWireframeOptions,
437 d3drm_device2_GetQuality,
438 d3drm_device2_GetColorModel,
439 d3drm_device2_GetTextureQuality,
440 d3drm_device2_GetDirect3DDevice,
441 d3drm_device2_InitFromD3D2,
442 d3drm_device2_InitFromSurface,
443 d3drm_device2_SetRenderMode,
444 d3drm_device2_GetRenderMode,
445 d3drm_device2_GetDirect3DDevice2,
448 static HRESULT WINAPI d3drm_device3_QueryInterface(IDirect3DRMDevice3 *iface, REFIID riid, void **out)
450 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
452 return d3drm_device2_QueryInterface(&device->IDirect3DRMDevice2_iface, riid, out);
455 static ULONG WINAPI d3drm_device3_AddRef(IDirect3DRMDevice3 *iface)
457 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
459 return d3drm_device2_AddRef(&device->IDirect3DRMDevice2_iface);
462 static ULONG WINAPI d3drm_device3_Release(IDirect3DRMDevice3 *iface)
464 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
466 return d3drm_device2_Release(&device->IDirect3DRMDevice2_iface);
469 static HRESULT WINAPI d3drm_device3_Clone(IDirect3DRMDevice3 *iface,
470 IUnknown *outer, REFIID iid, void **out)
472 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
474 return E_NOTIMPL;
477 static HRESULT WINAPI d3drm_device3_AddDestroyCallback(IDirect3DRMDevice3 *iface,
478 D3DRMOBJECTCALLBACK cb, void *ctx)
480 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
482 return E_NOTIMPL;
485 static HRESULT WINAPI d3drm_device3_DeleteDestroyCallback(IDirect3DRMDevice3 *iface,
486 D3DRMOBJECTCALLBACK cb, void *ctx)
488 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
490 return E_NOTIMPL;
493 static HRESULT WINAPI d3drm_device3_SetAppData(IDirect3DRMDevice3 *iface, DWORD data)
495 FIXME("iface %p, data %#x stub!\n", iface, data);
497 return E_NOTIMPL;
500 static DWORD WINAPI d3drm_device3_GetAppData(IDirect3DRMDevice3 *iface)
502 FIXME("iface %p stub!\n", iface);
504 return 0;
507 static HRESULT WINAPI d3drm_device3_SetName(IDirect3DRMDevice3 *iface, const char *name)
509 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
511 return E_NOTIMPL;
514 static HRESULT WINAPI d3drm_device3_GetName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
516 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
518 return E_NOTIMPL;
521 static HRESULT WINAPI d3drm_device3_GetClassName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
523 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
525 if (!size || *size < strlen("Device") || !name)
526 return E_INVALIDARG;
528 strcpy(name, "Device");
529 *size = sizeof("Device");
531 return D3DRM_OK;
534 static HRESULT WINAPI d3drm_device3_Init(IDirect3DRMDevice3 *iface, ULONG width, ULONG height)
536 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
538 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
540 device->height = height;
541 device->width = width;
543 return D3DRM_OK;
546 static HRESULT WINAPI d3drm_device3_InitFromD3D(IDirect3DRMDevice3 *iface,
547 IDirect3D *d3d, IDirect3DDevice *d3d_device)
549 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
551 return E_NOTIMPL;
554 static HRESULT WINAPI d3drm_device3_InitFromClipper(IDirect3DRMDevice3 *iface,
555 IDirectDrawClipper *clipper, GUID *guid, int width, int height)
557 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
559 FIXME("iface %p, clipper %p, guid %s, width %d, height %d stub!\n",
560 iface, clipper, debugstr_guid(guid), width, height);
562 device->height = height;
563 device->width = width;
565 return D3DRM_OK;
568 static HRESULT WINAPI d3drm_device3_Update(IDirect3DRMDevice3 *iface)
570 FIXME("iface %p stub!\n", iface);
572 return D3DRM_OK;
575 static HRESULT WINAPI d3drm_device3_AddUpdateCallback(IDirect3DRMDevice3 *iface,
576 D3DRMUPDATECALLBACK cb, void *ctx)
578 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
580 return E_NOTIMPL;
583 static HRESULT WINAPI d3drm_device3_DeleteUpdateCallback(IDirect3DRMDevice3 *iface,
584 D3DRMUPDATECALLBACK cb, void *ctx)
586 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
588 return E_NOTIMPL;
591 static HRESULT WINAPI d3drm_device3_SetBufferCount(IDirect3DRMDevice3 *iface, DWORD count)
593 FIXME("iface %p, count %u stub!\n", iface, count);
595 return E_NOTIMPL;
598 static DWORD WINAPI d3drm_device3_GetBufferCount(IDirect3DRMDevice3 *iface)
600 FIXME("iface %p stub!\n", iface);
602 return E_NOTIMPL;
605 static HRESULT WINAPI d3drm_device3_SetDither(IDirect3DRMDevice3 *iface, BOOL enable)
607 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
609 TRACE("iface %p, enable %#x.\n", iface, enable);
611 device->dither = enable;
613 return D3DRM_OK;
616 static HRESULT WINAPI d3drm_device3_SetShades(IDirect3DRMDevice3 *iface, DWORD count)
618 FIXME("iface %p, count %u stub!\n", iface, count);
620 return E_NOTIMPL;
623 static HRESULT WINAPI d3drm_device3_SetQuality(IDirect3DRMDevice3 *iface, D3DRMRENDERQUALITY quality)
625 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
627 TRACE("iface %p, quality %u.\n", iface, quality);
629 device->quality = quality;
631 return D3DRM_OK;
634 static HRESULT WINAPI d3drm_device3_SetTextureQuality(IDirect3DRMDevice3 *iface, D3DRMTEXTUREQUALITY quality)
636 FIXME("iface %p, quality %u stub!\n", iface, quality);
638 return E_NOTIMPL;
641 static HRESULT WINAPI d3drm_device3_GetViewports(IDirect3DRMDevice3 *iface, IDirect3DRMViewportArray **array)
643 FIXME("iface %p, array %p stub!\n", iface, array);
645 return E_NOTIMPL;
648 static BOOL WINAPI d3drm_device3_GetDither(IDirect3DRMDevice3 *iface)
650 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
652 TRACE("iface %p.\n", iface);
654 return device->dither;
657 static DWORD WINAPI d3drm_device3_GetShades(IDirect3DRMDevice3 *iface)
659 FIXME("iface %p stub!\n", iface);
661 return E_NOTIMPL;
664 static DWORD WINAPI d3drm_device3_GetHeight(IDirect3DRMDevice3 *iface)
666 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
668 TRACE("iface %p.\n", iface);
670 return device->height;
673 static DWORD WINAPI d3drm_device3_GetWidth(IDirect3DRMDevice3 *iface)
675 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
677 TRACE("iface %p.\n", iface);
679 return device->width;
682 static DWORD WINAPI d3drm_device3_GetTrianglesDrawn(IDirect3DRMDevice3 *iface)
684 FIXME("iface %p stub!\n", iface);
686 return E_NOTIMPL;
689 static DWORD WINAPI d3drm_device3_GetWireframeOptions(IDirect3DRMDevice3 *iface)
691 FIXME("iface %p stub!\n", iface);
693 return E_NOTIMPL;
696 static D3DRMRENDERQUALITY WINAPI d3drm_device3_GetQuality(IDirect3DRMDevice3 *iface)
698 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
700 TRACE("iface %p.\n", iface);
702 return device->quality;
705 static D3DCOLORMODEL WINAPI d3drm_device3_GetColorModel(IDirect3DRMDevice3 *iface)
707 FIXME("iface %p stub!\n", iface);
709 return E_NOTIMPL;
712 static D3DRMTEXTUREQUALITY WINAPI d3drm_device3_GetTextureQuality(IDirect3DRMDevice3 *iface)
714 FIXME("iface %p stub!\n", iface);
716 return E_NOTIMPL;
719 static HRESULT WINAPI d3drm_device3_GetDirect3DDevice(IDirect3DRMDevice3 *iface, IDirect3DDevice **d3d_device)
721 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
723 return E_NOTIMPL;
726 static HRESULT WINAPI d3drm_device3_InitFromD3D2(IDirect3DRMDevice3 *iface,
727 IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device)
729 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
731 return E_NOTIMPL;
734 static HRESULT WINAPI d3drm_device3_InitFromSurface(IDirect3DRMDevice3 *iface,
735 GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer)
737 FIXME("iface %p, guid %s, ddraw %p, backbuffer %p stub!\n",
738 iface, debugstr_guid(guid), ddraw, backbuffer);
740 return E_NOTIMPL;
743 static HRESULT WINAPI d3drm_device3_SetRenderMode(IDirect3DRMDevice3 *iface, DWORD flags)
745 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
747 TRACE("iface %p, flags %#x.\n", iface, flags);
749 device->rendermode = flags;
751 return D3DRM_OK;
754 static DWORD WINAPI d3drm_device3_GetRenderMode(IDirect3DRMDevice3 *iface)
756 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
758 TRACE("iface %p.\n", iface);
760 return device->rendermode;
763 static HRESULT WINAPI d3drm_device3_GetDirect3DDevice2(IDirect3DRMDevice3 *iface, IDirect3DDevice2 **d3d_device)
765 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
767 return E_NOTIMPL;
770 static HRESULT WINAPI d3drm_device3_FindPreferredTextureFormat(IDirect3DRMDevice3 *iface,
771 DWORD bitdepths, DWORD flags, DDPIXELFORMAT *pf)
773 FIXME("iface %p, bitdepths %u, flags %#x, pf %p stub!\n", iface, bitdepths, flags, pf);
775 return E_NOTIMPL;
778 static HRESULT WINAPI d3drm_device3_RenderStateChange(IDirect3DRMDevice3 *iface,
779 D3DRENDERSTATETYPE state, DWORD value, DWORD flags)
781 FIXME("iface %p, state %#x, value %#x, flags %#x stub!\n", iface, state, value, flags);
783 return E_NOTIMPL;
786 static HRESULT WINAPI d3drm_device3_LightStateChange(IDirect3DRMDevice3 *iface,
787 D3DLIGHTSTATETYPE state, DWORD value, DWORD flags)
789 FIXME("iface %p, state %#x, value %#x, flags %#x stub!\n", iface, state, value, flags);
791 return E_NOTIMPL;
794 static HRESULT WINAPI d3drm_device3_GetStateChangeOptions(IDirect3DRMDevice3 *iface,
795 DWORD state_class, DWORD state_idx, DWORD *flags)
797 FIXME("iface %p, state_class %#x, state_idx %#x, flags %p stub!\n",
798 iface, state_class, state_idx, flags);
800 return E_NOTIMPL;
803 static HRESULT WINAPI d3drm_device3_SetStateChangeOptions(IDirect3DRMDevice3 *iface,
804 DWORD state_class, DWORD state_idx, DWORD flags)
806 FIXME("iface %p, state_class %#x, state_idx %#x, flags %#x stub!\n",
807 iface, state_class, state_idx, flags);
809 return E_NOTIMPL;
812 static const struct IDirect3DRMDevice3Vtbl d3drm_device3_vtbl =
814 d3drm_device3_QueryInterface,
815 d3drm_device3_AddRef,
816 d3drm_device3_Release,
817 d3drm_device3_Clone,
818 d3drm_device3_AddDestroyCallback,
819 d3drm_device3_DeleteDestroyCallback,
820 d3drm_device3_SetAppData,
821 d3drm_device3_GetAppData,
822 d3drm_device3_SetName,
823 d3drm_device3_GetName,
824 d3drm_device3_GetClassName,
825 d3drm_device3_Init,
826 d3drm_device3_InitFromD3D,
827 d3drm_device3_InitFromClipper,
828 d3drm_device3_Update,
829 d3drm_device3_AddUpdateCallback,
830 d3drm_device3_DeleteUpdateCallback,
831 d3drm_device3_SetBufferCount,
832 d3drm_device3_GetBufferCount,
833 d3drm_device3_SetDither,
834 d3drm_device3_SetShades,
835 d3drm_device3_SetQuality,
836 d3drm_device3_SetTextureQuality,
837 d3drm_device3_GetViewports,
838 d3drm_device3_GetDither,
839 d3drm_device3_GetShades,
840 d3drm_device3_GetHeight,
841 d3drm_device3_GetWidth,
842 d3drm_device3_GetTrianglesDrawn,
843 d3drm_device3_GetWireframeOptions,
844 d3drm_device3_GetQuality,
845 d3drm_device3_GetColorModel,
846 d3drm_device3_GetTextureQuality,
847 d3drm_device3_GetDirect3DDevice,
848 d3drm_device3_InitFromD3D2,
849 d3drm_device3_InitFromSurface,
850 d3drm_device3_SetRenderMode,
851 d3drm_device3_GetRenderMode,
852 d3drm_device3_GetDirect3DDevice2,
853 d3drm_device3_FindPreferredTextureFormat,
854 d3drm_device3_RenderStateChange,
855 d3drm_device3_LightStateChange,
856 d3drm_device3_GetStateChangeOptions,
857 d3drm_device3_SetStateChangeOptions,
860 static HRESULT WINAPI d3drm_device_win_QueryInterface(IDirect3DRMWinDevice *iface, REFIID riid, void **out)
862 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
864 return d3drm_device2_QueryInterface(&device->IDirect3DRMDevice2_iface, riid, out);
867 static ULONG WINAPI d3drm_device_win_AddRef(IDirect3DRMWinDevice *iface)
869 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
871 return d3drm_device2_AddRef(&device->IDirect3DRMDevice2_iface);
874 static ULONG WINAPI d3drm_device_win_Release(IDirect3DRMWinDevice *iface)
876 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
878 return d3drm_device2_Release(&device->IDirect3DRMDevice2_iface);
881 static HRESULT WINAPI d3drm_device_win_Clone(IDirect3DRMWinDevice *iface,
882 IUnknown *outer, REFIID iid, void **out)
884 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
886 return E_NOTIMPL;
889 static HRESULT WINAPI d3drm_device_win_AddDestroyCallback(IDirect3DRMWinDevice *iface,
890 D3DRMOBJECTCALLBACK cb, void *ctx)
892 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
894 return E_NOTIMPL;
897 static HRESULT WINAPI d3drm_device_win_DeleteDestroyCallback(IDirect3DRMWinDevice *iface,
898 D3DRMOBJECTCALLBACK cb, void *ctx)
900 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
902 return E_NOTIMPL;
905 static HRESULT WINAPI d3drm_device_win_SetAppData(IDirect3DRMWinDevice *iface, DWORD data)
907 FIXME("iface %p, data %#x stub!\n", iface, data);
909 return E_NOTIMPL;
912 static DWORD WINAPI d3drm_device_win_GetAppData(IDirect3DRMWinDevice *iface)
914 FIXME("iface %p stub!\n", iface);
916 return 0;
919 static HRESULT WINAPI d3drm_device_win_SetName(IDirect3DRMWinDevice *iface, const char *name)
921 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
923 return E_NOTIMPL;
926 static HRESULT WINAPI d3drm_device_win_GetName(IDirect3DRMWinDevice *iface, DWORD *size, char *name)
928 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
930 return E_NOTIMPL;
933 static HRESULT WINAPI d3drm_device_win_GetClassName(IDirect3DRMWinDevice *iface, DWORD *size, char *name)
935 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
937 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
939 return IDirect3DRMDevice3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name);
942 static HRESULT WINAPI d3drm_device_win_HandlePaint(IDirect3DRMWinDevice *iface, HDC dc)
944 FIXME("iface %p, dc %p stub!\n", iface, dc);
946 return D3DRM_OK;
949 static HRESULT WINAPI d3drm_device_win_HandleActivate(IDirect3DRMWinDevice *iface, WORD wparam)
951 FIXME("iface %p, wparam %#x stub!\n", iface, wparam);
953 return D3DRM_OK;
956 static const struct IDirect3DRMWinDeviceVtbl d3drm_device_win_vtbl =
958 d3drm_device_win_QueryInterface,
959 d3drm_device_win_AddRef,
960 d3drm_device_win_Release,
961 d3drm_device_win_Clone,
962 d3drm_device_win_AddDestroyCallback,
963 d3drm_device_win_DeleteDestroyCallback,
964 d3drm_device_win_SetAppData,
965 d3drm_device_win_GetAppData,
966 d3drm_device_win_SetName,
967 d3drm_device_win_GetName,
968 d3drm_device_win_GetClassName,
969 d3drm_device_win_HandlePaint,
970 d3drm_device_win_HandleActivate,
973 HRESULT Direct3DRMDevice_create(REFIID riid, IUnknown **out)
975 struct d3drm_device *object;
977 TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
979 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
980 return E_OUTOFMEMORY;
982 object->IDirect3DRMDevice2_iface.lpVtbl = &d3drm_device2_vtbl;
983 object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl;
984 object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl;
985 object->ref = 1;
987 if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3))
988 *out = (IUnknown*)&object->IDirect3DRMDevice3_iface;
989 else
990 *out = (IUnknown*)&object->IDirect3DRMDevice2_iface;
992 return S_OK;