[D3DRM]
[reactos.git] / reactos / dll / directx / wine / d3drm / device.c
1 /*
2 * Implementation of IDirect3DRMDevice Interface
3 *
4 * Copyright 2011, 2012 André Hentschel
5 *
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
8 *
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.
13 *
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.
18 *
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
22 */
23
24 #include "d3drm_private.h"
25
26 #include <d3drmwin.h>
27
28 struct d3drm_device
29 {
30 IDirect3DRMDevice2 IDirect3DRMDevice2_iface;
31 IDirect3DRMDevice3 IDirect3DRMDevice3_iface;
32 IDirect3DRMWinDevice IDirect3DRMWinDevice_iface;
33 LONG ref;
34 BOOL dither;
35 D3DRMRENDERQUALITY quality;
36 DWORD rendermode;
37 DWORD height;
38 DWORD width;
39 };
40
41 static inline struct d3drm_device *impl_from_IDirect3DRMDevice2(IDirect3DRMDevice2 *iface)
42 {
43 return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice2_iface);
44 }
45
46 static inline struct d3drm_device *impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *iface)
47 {
48 return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice3_iface);
49 }
50
51 static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface)
52 {
53 return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMWinDevice_iface);
54 }
55
56 static HRESULT WINAPI d3drm_device2_QueryInterface(IDirect3DRMDevice2 *iface, REFIID riid, void **out)
57 {
58 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
59
60 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
61
62 if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)
63 || IsEqualGUID(riid, &IID_IDirect3DRMDevice)
64 || IsEqualGUID(riid, &IID_IUnknown))
65 {
66 *out = &device->IDirect3DRMDevice2_iface;
67 }
68 else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3))
69 {
70 *out = &device->IDirect3DRMDevice3_iface;
71 }
72 else if (IsEqualGUID(riid, &IID_IDirect3DRMWinDevice))
73 {
74 *out = &device->IDirect3DRMWinDevice_iface;
75 }
76 else
77 {
78 *out = NULL;
79 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
80 return E_NOINTERFACE;
81 }
82
83 IUnknown_AddRef((IUnknown *)*out);
84 return S_OK;
85 }
86
87 static ULONG WINAPI d3drm_device2_AddRef(IDirect3DRMDevice2 *iface)
88 {
89 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
90 ULONG refcount = InterlockedIncrement(&device->ref);
91
92 TRACE("%p increasing refcount to %u.\n", iface, refcount);
93
94 return refcount;
95 }
96
97 static ULONG WINAPI d3drm_device2_Release(IDirect3DRMDevice2 *iface)
98 {
99 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
100 ULONG refcount = InterlockedDecrement(&device->ref);
101
102 TRACE("%p decreasing refcount to %u.\n", iface, refcount);
103
104 if (!refcount)
105 HeapFree(GetProcessHeap(), 0, device);
106
107 return refcount;
108 }
109
110 static HRESULT WINAPI d3drm_device2_Clone(IDirect3DRMDevice2 *iface,
111 IUnknown *outer, REFIID iid, void **out)
112 {
113 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
114
115 return E_NOTIMPL;
116 }
117
118 static HRESULT WINAPI d3drm_device2_AddDestroyCallback(IDirect3DRMDevice2 *iface,
119 D3DRMOBJECTCALLBACK cb, void *ctx)
120 {
121 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
122
123 return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI d3drm_device2_DeleteDestroyCallback(IDirect3DRMDevice2 *iface,
127 D3DRMOBJECTCALLBACK cb, void *ctx)
128 {
129 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
130
131 return E_NOTIMPL;
132 }
133
134 static HRESULT WINAPI d3drm_device2_SetAppData(IDirect3DRMDevice2 *iface, DWORD data)
135 {
136 FIXME("iface %p, data %#x stub!\n", iface, data);
137
138 return E_NOTIMPL;
139 }
140
141 static DWORD WINAPI d3drm_device2_GetAppData(IDirect3DRMDevice2 *iface)
142 {
143 FIXME("iface %p stub!\n", iface);
144
145 return 0;
146 }
147
148 static HRESULT WINAPI d3drm_device2_SetName(IDirect3DRMDevice2 *iface, const char *name)
149 {
150 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
151
152 return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI d3drm_device2_GetName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
156 {
157 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
158
159 return E_NOTIMPL;
160 }
161
162 static HRESULT WINAPI d3drm_device2_GetClassName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
163 {
164 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
165
166 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
167
168 return IDirect3DRMDevice3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name);
169 }
170
171 static HRESULT WINAPI d3drm_device2_Init(IDirect3DRMDevice2 *iface, ULONG width, ULONG height)
172 {
173 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
174
175 TRACE("iface %p, width %u, height %u.\n", iface, width, height);
176
177 return IDirect3DRMDevice3_Init(&device->IDirect3DRMDevice3_iface, width, height);
178 }
179
180 static HRESULT WINAPI d3drm_device2_InitFromD3D(IDirect3DRMDevice2 *iface,
181 IDirect3D *d3d, IDirect3DDevice *d3d_device)
182 {
183 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
184
185 return E_NOTIMPL;
186 }
187
188 static HRESULT WINAPI d3drm_device2_InitFromClipper(IDirect3DRMDevice2 *iface,
189 IDirectDrawClipper *clipper, GUID *guid, int width, int height)
190 {
191 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
192
193 TRACE("iface %p, clipper %p, guid %s, width %d, height %d.\n",
194 iface, clipper, debugstr_guid(guid), width, height);
195
196 return IDirect3DRMDevice3_InitFromClipper(&device->IDirect3DRMDevice3_iface,
197 clipper, guid, width, height);
198 }
199
200 static HRESULT WINAPI d3drm_device2_Update(IDirect3DRMDevice2 *iface)
201 {
202 FIXME("iface %p stub!\n", iface);
203
204 return D3DRM_OK;
205 }
206
207 static HRESULT WINAPI d3drm_device2_AddUpdateCallback(IDirect3DRMDevice2 *iface,
208 D3DRMUPDATECALLBACK cb, void *ctx)
209 {
210 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
211
212 return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI d3drm_device2_DeleteUpdateCallback(IDirect3DRMDevice2 *iface,
216 D3DRMUPDATECALLBACK cb, void *ctx)
217 {
218 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
219
220 return E_NOTIMPL;
221 }
222
223 static HRESULT WINAPI d3drm_device2_SetBufferCount(IDirect3DRMDevice2 *iface, DWORD count)
224 {
225 FIXME("iface %p, count %u.\n", iface, count);
226
227 return E_NOTIMPL;
228 }
229
230 static DWORD WINAPI d3drm_device2_GetBufferCount(IDirect3DRMDevice2 *iface)
231 {
232 FIXME("iface %p stub!\n", iface);
233
234 return E_NOTIMPL;
235 }
236
237 static HRESULT WINAPI d3drm_device2_SetDither(IDirect3DRMDevice2 *iface, BOOL enable)
238 {
239 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
240
241 TRACE("iface %p, enabled %#x.\n", iface, enable);
242
243 return IDirect3DRMDevice3_SetDither(&device->IDirect3DRMDevice3_iface, enable);
244 }
245
246 static HRESULT WINAPI d3drm_device2_SetShades(IDirect3DRMDevice2 *iface, DWORD count)
247 {
248 FIXME("iface %p, count %u stub!\n", iface, count);
249
250 return E_NOTIMPL;
251 }
252
253 static HRESULT WINAPI d3drm_device2_SetQuality(IDirect3DRMDevice2 *iface, D3DRMRENDERQUALITY quality)
254 {
255 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
256
257 TRACE("iface %p, quality %u.\n", iface, quality);
258
259 return IDirect3DRMDevice3_SetQuality(&device->IDirect3DRMDevice3_iface, quality);
260 }
261
262 static HRESULT WINAPI d3drm_device2_SetTextureQuality(IDirect3DRMDevice2 *iface, D3DRMTEXTUREQUALITY quality)
263 {
264 FIXME("iface %p, quality %u stub!\n", iface, quality);
265
266 return E_NOTIMPL;
267 }
268
269 static HRESULT WINAPI d3drm_device2_GetViewports(IDirect3DRMDevice2 *iface, IDirect3DRMViewportArray **array)
270 {
271 FIXME("iface %p, array %p stub!\n", iface, array);
272
273 return E_NOTIMPL;
274 }
275
276 static BOOL WINAPI d3drm_device2_GetDither(IDirect3DRMDevice2 *iface)
277 {
278 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
279
280 TRACE("iface %p.\n", iface);
281
282 return IDirect3DRMDevice3_GetDither(&device->IDirect3DRMDevice3_iface);
283 }
284
285 static DWORD WINAPI d3drm_device2_GetShades(IDirect3DRMDevice2 *iface)
286 {
287 FIXME("iface %p stub!\n", iface);
288
289 return E_NOTIMPL;
290 }
291
292 static DWORD WINAPI d3drm_device2_GetHeight(IDirect3DRMDevice2 *iface)
293 {
294 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
295
296 TRACE("iface %p.\n", iface);
297
298 return IDirect3DRMDevice3_GetHeight(&device->IDirect3DRMDevice3_iface);
299 }
300
301 static DWORD WINAPI d3drm_device2_GetWidth(IDirect3DRMDevice2 *iface)
302 {
303 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
304
305 TRACE("iface %p.\n", iface);
306
307 return IDirect3DRMDevice3_GetWidth(&device->IDirect3DRMDevice3_iface);
308 }
309
310 static DWORD WINAPI d3drm_device2_GetTrianglesDrawn(IDirect3DRMDevice2 *iface)
311 {
312 FIXME("iface %p stub!\n", iface);
313
314 return E_NOTIMPL;
315 }
316
317 static DWORD WINAPI d3drm_device2_GetWireframeOptions(IDirect3DRMDevice2 *iface)
318 {
319 FIXME("iface %p stub!\n", iface);
320
321 return E_NOTIMPL;
322 }
323
324 static D3DRMRENDERQUALITY WINAPI d3drm_device2_GetQuality(IDirect3DRMDevice2 *iface)
325 {
326 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
327
328 TRACE("iface %p.\n", iface);
329
330 return IDirect3DRMDevice3_GetQuality(&device->IDirect3DRMDevice3_iface);
331 }
332
333 static D3DCOLORMODEL WINAPI d3drm_device2_GetColorModel(IDirect3DRMDevice2 *iface)
334 {
335 FIXME("iface %p stub!\n", iface);
336
337 return E_NOTIMPL;
338 }
339
340 static D3DRMTEXTUREQUALITY WINAPI d3drm_device2_GetTextureQuality(IDirect3DRMDevice2 *iface)
341 {
342 FIXME("iface %p stub!\n", iface);
343
344 return E_NOTIMPL;
345 }
346
347 static HRESULT WINAPI d3drm_device2_GetDirect3DDevice(IDirect3DRMDevice2 *iface, IDirect3DDevice **d3d_device)
348 {
349 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
350
351 return E_NOTIMPL;
352 }
353
354 static HRESULT WINAPI d3drm_device2_InitFromD3D2(IDirect3DRMDevice2 *iface,
355 IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device)
356 {
357 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
358
359 return E_NOTIMPL;
360 }
361
362 static HRESULT WINAPI d3drm_device2_InitFromSurface(IDirect3DRMDevice2 *iface,
363 GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer)
364 {
365 FIXME("iface %p, guid %s, ddraw %p, backbuffer %p stub!\n",
366 iface, debugstr_guid(guid), ddraw, backbuffer);
367
368 return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI d3drm_device2_SetRenderMode(IDirect3DRMDevice2 *iface, DWORD flags)
372 {
373 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
374
375 TRACE("iface %p, flags %#x.\n", iface, flags);
376
377 return IDirect3DRMDevice3_SetRenderMode(&device->IDirect3DRMDevice3_iface, flags);
378 }
379
380 static DWORD WINAPI d3drm_device2_GetRenderMode(IDirect3DRMDevice2 *iface)
381 {
382 struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface);
383
384 TRACE("iface %p.\n", iface);
385
386 return IDirect3DRMDevice3_GetRenderMode(&device->IDirect3DRMDevice3_iface);
387 }
388
389 static HRESULT WINAPI d3drm_device2_GetDirect3DDevice2(IDirect3DRMDevice2 *iface, IDirect3DDevice2 **d3d_device)
390 {
391 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
392
393 return E_NOTIMPL;
394 }
395
396 static const struct IDirect3DRMDevice2Vtbl d3drm_device2_vtbl =
397 {
398 d3drm_device2_QueryInterface,
399 d3drm_device2_AddRef,
400 d3drm_device2_Release,
401 d3drm_device2_Clone,
402 d3drm_device2_AddDestroyCallback,
403 d3drm_device2_DeleteDestroyCallback,
404 d3drm_device2_SetAppData,
405 d3drm_device2_GetAppData,
406 d3drm_device2_SetName,
407 d3drm_device2_GetName,
408 d3drm_device2_GetClassName,
409 d3drm_device2_Init,
410 d3drm_device2_InitFromD3D,
411 d3drm_device2_InitFromClipper,
412 d3drm_device2_Update,
413 d3drm_device2_AddUpdateCallback,
414 d3drm_device2_DeleteUpdateCallback,
415 d3drm_device2_SetBufferCount,
416 d3drm_device2_GetBufferCount,
417 d3drm_device2_SetDither,
418 d3drm_device2_SetShades,
419 d3drm_device2_SetQuality,
420 d3drm_device2_SetTextureQuality,
421 d3drm_device2_GetViewports,
422 d3drm_device2_GetDither,
423 d3drm_device2_GetShades,
424 d3drm_device2_GetHeight,
425 d3drm_device2_GetWidth,
426 d3drm_device2_GetTrianglesDrawn,
427 d3drm_device2_GetWireframeOptions,
428 d3drm_device2_GetQuality,
429 d3drm_device2_GetColorModel,
430 d3drm_device2_GetTextureQuality,
431 d3drm_device2_GetDirect3DDevice,
432 d3drm_device2_InitFromD3D2,
433 d3drm_device2_InitFromSurface,
434 d3drm_device2_SetRenderMode,
435 d3drm_device2_GetRenderMode,
436 d3drm_device2_GetDirect3DDevice2,
437 };
438
439 static HRESULT WINAPI d3drm_device3_QueryInterface(IDirect3DRMDevice3 *iface, REFIID riid, void **out)
440 {
441 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
442
443 return d3drm_device2_QueryInterface(&device->IDirect3DRMDevice2_iface, riid, out);
444 }
445
446 static ULONG WINAPI d3drm_device3_AddRef(IDirect3DRMDevice3 *iface)
447 {
448 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
449
450 return d3drm_device2_AddRef(&device->IDirect3DRMDevice2_iface);
451 }
452
453 static ULONG WINAPI d3drm_device3_Release(IDirect3DRMDevice3 *iface)
454 {
455 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
456
457 return d3drm_device2_Release(&device->IDirect3DRMDevice2_iface);
458 }
459
460 static HRESULT WINAPI d3drm_device3_Clone(IDirect3DRMDevice3 *iface,
461 IUnknown *outer, REFIID iid, void **out)
462 {
463 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
464
465 return E_NOTIMPL;
466 }
467
468 static HRESULT WINAPI d3drm_device3_AddDestroyCallback(IDirect3DRMDevice3 *iface,
469 D3DRMOBJECTCALLBACK cb, void *ctx)
470 {
471 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
472
473 return E_NOTIMPL;
474 }
475
476 static HRESULT WINAPI d3drm_device3_DeleteDestroyCallback(IDirect3DRMDevice3 *iface,
477 D3DRMOBJECTCALLBACK cb, void *ctx)
478 {
479 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
480
481 return E_NOTIMPL;
482 }
483
484 static HRESULT WINAPI d3drm_device3_SetAppData(IDirect3DRMDevice3 *iface, DWORD data)
485 {
486 FIXME("iface %p, data %#x stub!\n", iface, data);
487
488 return E_NOTIMPL;
489 }
490
491 static DWORD WINAPI d3drm_device3_GetAppData(IDirect3DRMDevice3 *iface)
492 {
493 FIXME("iface %p stub!\n", iface);
494
495 return 0;
496 }
497
498 static HRESULT WINAPI d3drm_device3_SetName(IDirect3DRMDevice3 *iface, const char *name)
499 {
500 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
501
502 return E_NOTIMPL;
503 }
504
505 static HRESULT WINAPI d3drm_device3_GetName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
506 {
507 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
508
509 return E_NOTIMPL;
510 }
511
512 static HRESULT WINAPI d3drm_device3_GetClassName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
513 {
514 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
515
516 if (!size || *size < strlen("Device") || !name)
517 return E_INVALIDARG;
518
519 strcpy(name, "Device");
520 *size = sizeof("Device");
521
522 return D3DRM_OK;
523 }
524
525 static HRESULT WINAPI d3drm_device3_Init(IDirect3DRMDevice3 *iface, ULONG width, ULONG height)
526 {
527 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
528
529 FIXME("iface %p, width %u, height %u stub!\n", iface, width, height);
530
531 device->height = height;
532 device->width = width;
533
534 return D3DRM_OK;
535 }
536
537 static HRESULT WINAPI d3drm_device3_InitFromD3D(IDirect3DRMDevice3 *iface,
538 IDirect3D *d3d, IDirect3DDevice *d3d_device)
539 {
540 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
541
542 return E_NOTIMPL;
543 }
544
545 static HRESULT WINAPI d3drm_device3_InitFromClipper(IDirect3DRMDevice3 *iface,
546 IDirectDrawClipper *clipper, GUID *guid, int width, int height)
547 {
548 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
549
550 FIXME("iface %p, clipper %p, guid %s, width %d, height %d stub!\n",
551 iface, clipper, debugstr_guid(guid), width, height);
552
553 device->height = height;
554 device->width = width;
555
556 return D3DRM_OK;
557 }
558
559 static HRESULT WINAPI d3drm_device3_Update(IDirect3DRMDevice3 *iface)
560 {
561 FIXME("iface %p stub!\n", iface);
562
563 return D3DRM_OK;
564 }
565
566 static HRESULT WINAPI d3drm_device3_AddUpdateCallback(IDirect3DRMDevice3 *iface,
567 D3DRMUPDATECALLBACK cb, void *ctx)
568 {
569 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
570
571 return E_NOTIMPL;
572 }
573
574 static HRESULT WINAPI d3drm_device3_DeleteUpdateCallback(IDirect3DRMDevice3 *iface,
575 D3DRMUPDATECALLBACK cb, void *ctx)
576 {
577 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
578
579 return E_NOTIMPL;
580 }
581
582 static HRESULT WINAPI d3drm_device3_SetBufferCount(IDirect3DRMDevice3 *iface, DWORD count)
583 {
584 FIXME("iface %p, count %u stub!\n", iface, count);
585
586 return E_NOTIMPL;
587 }
588
589 static DWORD WINAPI d3drm_device3_GetBufferCount(IDirect3DRMDevice3 *iface)
590 {
591 FIXME("iface %p stub!\n", iface);
592
593 return E_NOTIMPL;
594 }
595
596 static HRESULT WINAPI d3drm_device3_SetDither(IDirect3DRMDevice3 *iface, BOOL enable)
597 {
598 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
599
600 TRACE("iface %p, enable %#x.\n", iface, enable);
601
602 device->dither = enable;
603
604 return D3DRM_OK;
605 }
606
607 static HRESULT WINAPI d3drm_device3_SetShades(IDirect3DRMDevice3 *iface, DWORD count)
608 {
609 FIXME("iface %p, count %u stub!\n", iface, count);
610
611 return E_NOTIMPL;
612 }
613
614 static HRESULT WINAPI d3drm_device3_SetQuality(IDirect3DRMDevice3 *iface, D3DRMRENDERQUALITY quality)
615 {
616 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
617
618 TRACE("iface %p, quality %u.\n", iface, quality);
619
620 device->quality = quality;
621
622 return D3DRM_OK;
623 }
624
625 static HRESULT WINAPI d3drm_device3_SetTextureQuality(IDirect3DRMDevice3 *iface, D3DRMTEXTUREQUALITY quality)
626 {
627 FIXME("iface %p, quality %u stub!\n", iface, quality);
628
629 return E_NOTIMPL;
630 }
631
632 static HRESULT WINAPI d3drm_device3_GetViewports(IDirect3DRMDevice3 *iface, IDirect3DRMViewportArray **array)
633 {
634 FIXME("iface %p, array %p stub!\n", iface, array);
635
636 return E_NOTIMPL;
637 }
638
639 static BOOL WINAPI d3drm_device3_GetDither(IDirect3DRMDevice3 *iface)
640 {
641 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
642
643 TRACE("iface %p.\n", iface);
644
645 return device->dither;
646 }
647
648 static DWORD WINAPI d3drm_device3_GetShades(IDirect3DRMDevice3 *iface)
649 {
650 FIXME("iface %p stub!\n", iface);
651
652 return E_NOTIMPL;
653 }
654
655 static DWORD WINAPI d3drm_device3_GetHeight(IDirect3DRMDevice3 *iface)
656 {
657 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
658
659 TRACE("iface %p.\n", iface);
660
661 return device->height;
662 }
663
664 static DWORD WINAPI d3drm_device3_GetWidth(IDirect3DRMDevice3 *iface)
665 {
666 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
667
668 TRACE("iface %p.\n", iface);
669
670 return device->width;
671 }
672
673 static DWORD WINAPI d3drm_device3_GetTrianglesDrawn(IDirect3DRMDevice3 *iface)
674 {
675 FIXME("iface %p stub!\n", iface);
676
677 return E_NOTIMPL;
678 }
679
680 static DWORD WINAPI d3drm_device3_GetWireframeOptions(IDirect3DRMDevice3 *iface)
681 {
682 FIXME("iface %p stub!\n", iface);
683
684 return E_NOTIMPL;
685 }
686
687 static D3DRMRENDERQUALITY WINAPI d3drm_device3_GetQuality(IDirect3DRMDevice3 *iface)
688 {
689 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
690
691 TRACE("iface %p.\n", iface);
692
693 return device->quality;
694 }
695
696 static D3DCOLORMODEL WINAPI d3drm_device3_GetColorModel(IDirect3DRMDevice3 *iface)
697 {
698 FIXME("iface %p stub!\n", iface);
699
700 return E_NOTIMPL;
701 }
702
703 static D3DRMTEXTUREQUALITY WINAPI d3drm_device3_GetTextureQuality(IDirect3DRMDevice3 *iface)
704 {
705 FIXME("iface %p stub!\n", iface);
706
707 return E_NOTIMPL;
708 }
709
710 static HRESULT WINAPI d3drm_device3_GetDirect3DDevice(IDirect3DRMDevice3 *iface, IDirect3DDevice **d3d_device)
711 {
712 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
713
714 return E_NOTIMPL;
715 }
716
717 static HRESULT WINAPI d3drm_device3_InitFromD3D2(IDirect3DRMDevice3 *iface,
718 IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device)
719 {
720 FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device);
721
722 return E_NOTIMPL;
723 }
724
725 static HRESULT WINAPI d3drm_device3_InitFromSurface(IDirect3DRMDevice3 *iface,
726 GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer)
727 {
728 FIXME("iface %p, guid %s, ddraw %p, backbuffer %p stub!\n",
729 iface, debugstr_guid(guid), ddraw, backbuffer);
730
731 return E_NOTIMPL;
732 }
733
734 static HRESULT WINAPI d3drm_device3_SetRenderMode(IDirect3DRMDevice3 *iface, DWORD flags)
735 {
736 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
737
738 TRACE("iface %p, flags %#x.\n", iface, flags);
739
740 device->rendermode = flags;
741
742 return D3DRM_OK;
743 }
744
745 static DWORD WINAPI d3drm_device3_GetRenderMode(IDirect3DRMDevice3 *iface)
746 {
747 struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
748
749 TRACE("iface %p.\n", iface);
750
751 return device->rendermode;
752 }
753
754 static HRESULT WINAPI d3drm_device3_GetDirect3DDevice2(IDirect3DRMDevice3 *iface, IDirect3DDevice2 **d3d_device)
755 {
756 FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device);
757
758 return E_NOTIMPL;
759 }
760
761 static HRESULT WINAPI d3drm_device3_FindPreferredTextureFormat(IDirect3DRMDevice3 *iface,
762 DWORD bitdepths, DWORD flags, DDPIXELFORMAT *pf)
763 {
764 FIXME("iface %p, bitdepths %u, flags %#x, pf %p stub!\n", iface, bitdepths, flags, pf);
765
766 return E_NOTIMPL;
767 }
768
769 static HRESULT WINAPI d3drm_device3_RenderStateChange(IDirect3DRMDevice3 *iface,
770 D3DRENDERSTATETYPE state, DWORD value, DWORD flags)
771 {
772 FIXME("iface %p, state %#x, value %#x, flags %#x stub!\n", iface, state, value, flags);
773
774 return E_NOTIMPL;
775 }
776
777 static HRESULT WINAPI d3drm_device3_LightStateChange(IDirect3DRMDevice3 *iface,
778 D3DLIGHTSTATETYPE state, DWORD value, DWORD flags)
779 {
780 FIXME("iface %p, state %#x, value %#x, flags %#x stub!\n", iface, state, value, flags);
781
782 return E_NOTIMPL;
783 }
784
785 static HRESULT WINAPI d3drm_device3_GetStateChangeOptions(IDirect3DRMDevice3 *iface,
786 DWORD state_class, DWORD state_idx, DWORD *flags)
787 {
788 FIXME("iface %p, state_class %#x, state_idx %#x, flags %p stub!\n",
789 iface, state_class, state_idx, flags);
790
791 return E_NOTIMPL;
792 }
793
794 static HRESULT WINAPI d3drm_device3_SetStateChangeOptions(IDirect3DRMDevice3 *iface,
795 DWORD state_class, DWORD state_idx, DWORD flags)
796 {
797 FIXME("iface %p, state_class %#x, state_idx %#x, flags %#x stub!\n",
798 iface, state_class, state_idx, flags);
799
800 return E_NOTIMPL;
801 }
802
803 static const struct IDirect3DRMDevice3Vtbl d3drm_device3_vtbl =
804 {
805 d3drm_device3_QueryInterface,
806 d3drm_device3_AddRef,
807 d3drm_device3_Release,
808 d3drm_device3_Clone,
809 d3drm_device3_AddDestroyCallback,
810 d3drm_device3_DeleteDestroyCallback,
811 d3drm_device3_SetAppData,
812 d3drm_device3_GetAppData,
813 d3drm_device3_SetName,
814 d3drm_device3_GetName,
815 d3drm_device3_GetClassName,
816 d3drm_device3_Init,
817 d3drm_device3_InitFromD3D,
818 d3drm_device3_InitFromClipper,
819 d3drm_device3_Update,
820 d3drm_device3_AddUpdateCallback,
821 d3drm_device3_DeleteUpdateCallback,
822 d3drm_device3_SetBufferCount,
823 d3drm_device3_GetBufferCount,
824 d3drm_device3_SetDither,
825 d3drm_device3_SetShades,
826 d3drm_device3_SetQuality,
827 d3drm_device3_SetTextureQuality,
828 d3drm_device3_GetViewports,
829 d3drm_device3_GetDither,
830 d3drm_device3_GetShades,
831 d3drm_device3_GetHeight,
832 d3drm_device3_GetWidth,
833 d3drm_device3_GetTrianglesDrawn,
834 d3drm_device3_GetWireframeOptions,
835 d3drm_device3_GetQuality,
836 d3drm_device3_GetColorModel,
837 d3drm_device3_GetTextureQuality,
838 d3drm_device3_GetDirect3DDevice,
839 d3drm_device3_InitFromD3D2,
840 d3drm_device3_InitFromSurface,
841 d3drm_device3_SetRenderMode,
842 d3drm_device3_GetRenderMode,
843 d3drm_device3_GetDirect3DDevice2,
844 d3drm_device3_FindPreferredTextureFormat,
845 d3drm_device3_RenderStateChange,
846 d3drm_device3_LightStateChange,
847 d3drm_device3_GetStateChangeOptions,
848 d3drm_device3_SetStateChangeOptions,
849 };
850
851 static HRESULT WINAPI d3drm_device_win_QueryInterface(IDirect3DRMWinDevice *iface, REFIID riid, void **out)
852 {
853 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
854
855 return d3drm_device2_QueryInterface(&device->IDirect3DRMDevice2_iface, riid, out);
856 }
857
858 static ULONG WINAPI d3drm_device_win_AddRef(IDirect3DRMWinDevice *iface)
859 {
860 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
861
862 return d3drm_device2_AddRef(&device->IDirect3DRMDevice2_iface);
863 }
864
865 static ULONG WINAPI d3drm_device_win_Release(IDirect3DRMWinDevice *iface)
866 {
867 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
868
869 return d3drm_device2_Release(&device->IDirect3DRMDevice2_iface);
870 }
871
872 static HRESULT WINAPI d3drm_device_win_Clone(IDirect3DRMWinDevice *iface,
873 IUnknown *outer, REFIID iid, void **out)
874 {
875 FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
876
877 return E_NOTIMPL;
878 }
879
880 static HRESULT WINAPI d3drm_device_win_AddDestroyCallback(IDirect3DRMWinDevice *iface,
881 D3DRMOBJECTCALLBACK cb, void *ctx)
882 {
883 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
884
885 return E_NOTIMPL;
886 }
887
888 static HRESULT WINAPI d3drm_device_win_DeleteDestroyCallback(IDirect3DRMWinDevice *iface,
889 D3DRMOBJECTCALLBACK cb, void *ctx)
890 {
891 FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
892
893 return E_NOTIMPL;
894 }
895
896 static HRESULT WINAPI d3drm_device_win_SetAppData(IDirect3DRMWinDevice *iface, DWORD data)
897 {
898 FIXME("iface %p, data %#x stub!\n", iface, data);
899
900 return E_NOTIMPL;
901 }
902
903 static DWORD WINAPI d3drm_device_win_GetAppData(IDirect3DRMWinDevice *iface)
904 {
905 FIXME("iface %p stub!\n", iface);
906
907 return 0;
908 }
909
910 static HRESULT WINAPI d3drm_device_win_SetName(IDirect3DRMWinDevice *iface, const char *name)
911 {
912 FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
913
914 return E_NOTIMPL;
915 }
916
917 static HRESULT WINAPI d3drm_device_win_GetName(IDirect3DRMWinDevice *iface, DWORD *size, char *name)
918 {
919 FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
920
921 return E_NOTIMPL;
922 }
923
924 static HRESULT WINAPI d3drm_device_win_GetClassName(IDirect3DRMWinDevice *iface, DWORD *size, char *name)
925 {
926 struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface);
927
928 TRACE("iface %p, size %p, name %p.\n", iface, size, name);
929
930 return IDirect3DRMDevice3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name);
931 }
932
933 static HRESULT WINAPI d3drm_device_win_HandlePaint(IDirect3DRMWinDevice *iface, HDC dc)
934 {
935 FIXME("iface %p, dc %p stub!\n", iface, dc);
936
937 return D3DRM_OK;
938 }
939
940 static HRESULT WINAPI d3drm_device_win_HandleActivate(IDirect3DRMWinDevice *iface, WORD wparam)
941 {
942 FIXME("iface %p, wparam %#x stub!\n", iface, wparam);
943
944 return D3DRM_OK;
945 }
946
947 static const struct IDirect3DRMWinDeviceVtbl d3drm_device_win_vtbl =
948 {
949 d3drm_device_win_QueryInterface,
950 d3drm_device_win_AddRef,
951 d3drm_device_win_Release,
952 d3drm_device_win_Clone,
953 d3drm_device_win_AddDestroyCallback,
954 d3drm_device_win_DeleteDestroyCallback,
955 d3drm_device_win_SetAppData,
956 d3drm_device_win_GetAppData,
957 d3drm_device_win_SetName,
958 d3drm_device_win_GetName,
959 d3drm_device_win_GetClassName,
960 d3drm_device_win_HandlePaint,
961 d3drm_device_win_HandleActivate,
962 };
963
964 HRESULT Direct3DRMDevice_create(REFIID riid, IUnknown **out)
965 {
966 struct d3drm_device *object;
967
968 TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
969
970 if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
971 return E_OUTOFMEMORY;
972
973 object->IDirect3DRMDevice2_iface.lpVtbl = &d3drm_device2_vtbl;
974 object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl;
975 object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl;
976 object->ref = 1;
977
978 if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3))
979 *out = (IUnknown*)&object->IDirect3DRMDevice3_iface;
980 else
981 *out = (IUnknown*)&object->IDirect3DRMDevice2_iface;
982
983 return S_OK;
984 }