d3drm: Added IDirect3DRMAnimation stub.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-06-23 16:15:00 +03:00 committed by Alexandre Julliard
parent 8d461c1f42
commit 7fd7f6557e
4 changed files with 583 additions and 38 deletions

View File

@ -162,6 +162,19 @@ static HRESULT d3drm_create_mesh_object(void **object, IDirect3DRM *d3drm)
return hr;
}
static HRESULT d3drm_create_animation_object(void **object, IDirect3DRM *d3drm)
{
struct d3drm_animation *animation;
HRESULT hr;
if (FAILED(hr = d3drm_animation_create(&animation, d3drm)))
return hr;
*object = &animation->IDirect3DRMAnimation_iface;
return hr;
}
struct d3drm
{
IDirect3DRM IDirect3DRM_iface;
@ -309,9 +322,20 @@ static HRESULT WINAPI d3drm1_CreateFace(IDirect3DRM *iface, IDirect3DRMFace **fa
static HRESULT WINAPI d3drm1_CreateAnimation(IDirect3DRM *iface, IDirect3DRMAnimation **animation)
{
FIXME("iface %p, animation %p stub!\n", iface, animation);
struct d3drm_animation *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, animation %p.\n", iface, animation);
if (!animation)
return D3DRMERR_BADVALUE;
if (FAILED(hr = d3drm_animation_create(&object, iface)))
return hr;
*animation = &object->IDirect3DRMAnimation_iface;
return S_OK;
}
static HRESULT WINAPI d3drm1_CreateAnimationSet(IDirect3DRM *iface, IDirect3DRMAnimationSet **set)
@ -840,9 +864,11 @@ static HRESULT WINAPI d3drm2_CreateFace(IDirect3DRM2 *iface, IDirect3DRMFace **f
static HRESULT WINAPI d3drm2_CreateAnimation(IDirect3DRM2 *iface, IDirect3DRMAnimation **animation)
{
FIXME("iface %p, animation %p stub!\n", iface, animation);
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
return E_NOTIMPL;
TRACE("iface %p, animation %p.\n", iface, animation);
return IDirect3DRM_CreateAnimation(&d3drm->IDirect3DRM_iface, animation);
}
static HRESULT WINAPI d3drm2_CreateAnimationSet(IDirect3DRM2 *iface, IDirect3DRMAnimationSet **set)
@ -1313,6 +1339,7 @@ static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface,
{&CLSID_CDirect3DRMLight, d3drm_create_light_object},
{&CLSID_CDirect3DRMMaterial, d3drm_create_material_object},
{&CLSID_CDirect3DRMMesh, d3drm_create_mesh_object},
{&CLSID_CDirect3DRMAnimation, d3drm_create_animation_object},
};
TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
@ -1428,9 +1455,18 @@ static HRESULT WINAPI d3drm3_CreateFace(IDirect3DRM3 *iface, IDirect3DRMFace2 **
static HRESULT WINAPI d3drm3_CreateAnimation(IDirect3DRM3 *iface, IDirect3DRMAnimation2 **animation)
{
FIXME("iface %p, animation %p stub!\n", iface, animation);
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
struct d3drm_animation *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, animation %p.\n", iface, animation);
if (FAILED(hr = d3drm_animation_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*animation = &object->IDirect3DRMAnimation2_iface;
return hr;
}
static HRESULT WINAPI d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRMAnimationSet2 **set)

View File

@ -206,6 +206,16 @@ struct d3drm_material
struct color_rgb ambient;
};
struct d3drm_animation
{
struct d3drm_object obj;
IDirect3DRMAnimation2 IDirect3DRMAnimation2_iface;
IDirect3DRMAnimation IDirect3DRMAnimation_iface;
LONG ref;
IDirect3DRM *d3drm;
};
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw,
IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) DECLSPEC_HIDDEN;
@ -232,6 +242,7 @@ HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDir
HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN;

View File

@ -89,6 +89,16 @@ static inline struct d3drm_light_array *impl_from_IDirect3DRMLightArray(IDirect3
return CONTAINING_RECORD(iface, struct d3drm_light_array, IDirect3DRMLightArray_iface);
}
static inline struct d3drm_animation *impl_from_IDirect3DRMAnimation(IDirect3DRMAnimation *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_animation, IDirect3DRMAnimation_iface);
}
static inline struct d3drm_animation *impl_from_IDirect3DRMAnimation2(IDirect3DRMAnimation2 *iface)
{
return CONTAINING_RECORD(iface, struct d3drm_animation, IDirect3DRMAnimation2_iface);
}
static HRESULT WINAPI d3drm_frame_array_QueryInterface(IDirect3DRMFrameArray *iface, REFIID riid, void **out)
{
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
@ -3005,3 +3015,453 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
return hr;
}
static HRESULT WINAPI d3drm_animation2_QueryInterface(IDirect3DRMAnimation2 *iface, REFIID riid, void **out)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DRMAnimation)
|| IsEqualGUID(riid, &IID_IDirect3DRMObject)
|| IsEqualGUID(riid, &IID_IUnknown))
{
*out = &animation->IDirect3DRMAnimation_iface;
}
else if (IsEqualGUID(riid, &IID_IDirect3DRMAnimation2))
{
*out = &animation->IDirect3DRMAnimation2_iface;
}
else
{
*out = NULL;
WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
return CLASS_E_CLASSNOTAVAILABLE;
}
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static HRESULT WINAPI d3drm_animation1_QueryInterface(IDirect3DRMAnimation *iface, REFIID riid, void **out)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
return IDirect3DRMAnimation2_QueryInterface(&animation->IDirect3DRMAnimation2_iface, riid, out);
}
static ULONG WINAPI d3drm_animation2_AddRef(IDirect3DRMAnimation2 *iface)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
ULONG refcount = InterlockedIncrement(&animation->ref);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
return refcount;
}
static ULONG WINAPI d3drm_animation1_AddRef(IDirect3DRMAnimation *iface)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
return IDirect3DRMAnimation2_AddRef(&animation->IDirect3DRMAnimation2_iface);
}
static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
ULONG refcount = InterlockedDecrement(&animation->ref);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
{
d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj);
IDirect3DRM_Release(animation->d3drm);
HeapFree(GetProcessHeap(), 0, animation);
}
return refcount;
}
static ULONG WINAPI d3drm_animation1_Release(IDirect3DRMAnimation *iface)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
return IDirect3DRMAnimation2_Release(&animation->IDirect3DRMAnimation2_iface);
}
static HRESULT WINAPI d3drm_animation2_Clone(IDirect3DRMAnimation2 *iface, IUnknown *outer, REFIID iid, void **out)
{
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_Clone(IDirect3DRMAnimation *iface, IUnknown *outer, REFIID iid, void **out)
{
FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_AddDestroyCallback(IDirect3DRMAnimation2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_add_destroy_callback(&animation->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_animation1_AddDestroyCallback(IDirect3DRMAnimation *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return IDirect3DRMAnimation2_AddDestroyCallback(&animation->IDirect3DRMAnimation2_iface, cb, ctx);
}
static HRESULT WINAPI d3drm_animation2_DeleteDestroyCallback(IDirect3DRMAnimation2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return d3drm_object_delete_destroy_callback(&animation->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_animation1_DeleteDestroyCallback(IDirect3DRMAnimation *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, cb %p, ctx %p.\n", iface, cb, ctx);
return IDirect3DRMAnimation2_DeleteDestroyCallback(&animation->IDirect3DRMAnimation2_iface, cb, ctx);
}
static HRESULT WINAPI d3drm_animation2_SetAppData(IDirect3DRMAnimation2 *iface, DWORD data)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, data %#x.\n", iface, data);
animation->obj.appdata = data;
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_animation1_SetAppData(IDirect3DRMAnimation *iface, DWORD data)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, data %#x.\n", iface, data);
return d3drm_animation2_SetAppData(&animation->IDirect3DRMAnimation2_iface, data);
}
static DWORD WINAPI d3drm_animation2_GetAppData(IDirect3DRMAnimation2 *iface)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p.\n", iface);
return animation->obj.appdata;
}
static DWORD WINAPI d3drm_animation1_GetAppData(IDirect3DRMAnimation *iface)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p.\n", iface);
return d3drm_animation2_GetAppData(&animation->IDirect3DRMAnimation2_iface);
}
static HRESULT WINAPI d3drm_animation2_SetName(IDirect3DRMAnimation2 *iface, const char *name)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&animation->obj, name);
}
static HRESULT WINAPI d3drm_animation1_SetName(IDirect3DRMAnimation *iface, const char *name)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_animation2_SetName(&animation->IDirect3DRMAnimation2_iface, name);
}
static HRESULT WINAPI d3drm_animation2_GetName(IDirect3DRMAnimation2 *iface, DWORD *size, char *name)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&animation->obj, size, name);
}
static HRESULT WINAPI d3drm_animation1_GetName(IDirect3DRMAnimation *iface, DWORD *size, char *name)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_animation2_GetName(&animation->IDirect3DRMAnimation2_iface, size, name);
}
static HRESULT WINAPI d3drm_animation2_GetClassName(IDirect3DRMAnimation2 *iface, DWORD *size, char *name)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_class_name(&animation->obj, size, name);
}
static HRESULT WINAPI d3drm_animation1_GetClassName(IDirect3DRMAnimation *iface, DWORD *size, char *name)
{
struct d3drm_animation *animation = impl_from_IDirect3DRMAnimation(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_animation2_GetClassName(&animation->IDirect3DRMAnimation2_iface, size, name);
}
static HRESULT WINAPI d3drm_animation1_SetOptions(IDirect3DRMAnimation *iface, D3DRMANIMATIONOPTIONS options)
{
FIXME("iface %p, %#x.\n", iface, options);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_AddRotateKey(IDirect3DRMAnimation *iface, D3DVALUE time, D3DRMQUATERNION *q)
{
FIXME("iface %p, time %.8e, q %p.\n", iface, time, q);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_AddPositionKey(IDirect3DRMAnimation *iface, D3DVALUE time,
D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_AddScaleKey(IDirect3DRMAnimation *iface, D3DVALUE time,
D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_DeleteKey(IDirect3DRMAnimation *iface, D3DVALUE time)
{
FIXME("iface %p, time %.8e.\n", iface, time);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_SetFrame(IDirect3DRMAnimation *iface, IDirect3DRMFrame *frame)
{
FIXME("iface %p, frame %p.\n", iface, frame);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation1_SetTime(IDirect3DRMAnimation *iface, D3DVALUE time)
{
FIXME("iface %p, time %.8e.\n", iface, time);
return E_NOTIMPL;
}
static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation1_GetOptions(IDirect3DRMAnimation *iface)
{
FIXME("iface %p.\n", iface);
return 0;
}
static HRESULT WINAPI d3drm_animation2_SetOptions(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONOPTIONS options)
{
FIXME("iface %p, options %#x.\n", iface, options);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_AddRotateKey(IDirect3DRMAnimation2 *iface, D3DVALUE time, D3DRMQUATERNION *q)
{
FIXME("iface %p, time %.8e, q %p.\n", iface, time, q);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_AddPositionKey(IDirect3DRMAnimation2 *iface, D3DVALUE time,
D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_AddScaleKey(IDirect3DRMAnimation2 *iface, D3DVALUE time,
D3DVALUE x, D3DVALUE y, D3DVALUE z)
{
FIXME("iface %p, time %.8e, x %.8e, y %.8e, z %.8e.\n", iface, time, x, y, z);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_DeleteKey(IDirect3DRMAnimation2 *iface, D3DVALUE time)
{
FIXME("iface %p, time %.8e.\n", iface, time);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_SetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 *frame)
{
FIXME("iface %p, frame %p.\n", iface, frame);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_SetTime(IDirect3DRMAnimation2 *iface, D3DVALUE time)
{
FIXME("iface %p, time %.8e.\n", iface, time);
return E_NOTIMPL;
}
static D3DRMANIMATIONOPTIONS WINAPI d3drm_animation2_GetOptions(IDirect3DRMAnimation2 *iface)
{
FIXME("iface %p.\n", iface);
return 0;
}
static HRESULT WINAPI d3drm_animation2_GetFrame(IDirect3DRMAnimation2 *iface, IDirect3DRMFrame3 **frame)
{
FIXME("iface %p, frame %p.\n", iface, frame);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_DeleteKeyByID(IDirect3DRMAnimation2 *iface, DWORD id)
{
FIXME("iface %p, id %#x.\n", iface, id);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_AddKey(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONKEY *key)
{
FIXME("iface %p, key %p.\n", iface, key);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_ModifyKey(IDirect3DRMAnimation2 *iface, D3DRMANIMATIONKEY *key)
{
FIXME("iface %p, key %p.\n", iface, key);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_animation2_GetKeys(IDirect3DRMAnimation2 *iface, D3DVALUE time_min, D3DVALUE time_max,
DWORD *key_count, D3DRMANIMATIONKEY *keys)
{
FIXME("iface %p, time min %.e, time max %.e, count %p, keys %p.\n", iface, time_min, time_max, key_count, keys);
return E_NOTIMPL;
}
static const struct IDirect3DRMAnimationVtbl d3drm_animation1_vtbl =
{
d3drm_animation1_QueryInterface,
d3drm_animation1_AddRef,
d3drm_animation1_Release,
d3drm_animation1_Clone,
d3drm_animation1_AddDestroyCallback,
d3drm_animation1_DeleteDestroyCallback,
d3drm_animation1_SetAppData,
d3drm_animation1_GetAppData,
d3drm_animation1_SetName,
d3drm_animation1_GetName,
d3drm_animation1_GetClassName,
d3drm_animation1_SetOptions,
d3drm_animation1_AddRotateKey,
d3drm_animation1_AddPositionKey,
d3drm_animation1_AddScaleKey,
d3drm_animation1_DeleteKey,
d3drm_animation1_SetFrame,
d3drm_animation1_SetTime,
d3drm_animation1_GetOptions,
};
static const struct IDirect3DRMAnimation2Vtbl d3drm_animation2_vtbl =
{
d3drm_animation2_QueryInterface,
d3drm_animation2_AddRef,
d3drm_animation2_Release,
d3drm_animation2_Clone,
d3drm_animation2_AddDestroyCallback,
d3drm_animation2_DeleteDestroyCallback,
d3drm_animation2_SetAppData,
d3drm_animation2_GetAppData,
d3drm_animation2_SetName,
d3drm_animation2_GetName,
d3drm_animation2_GetClassName,
d3drm_animation2_SetOptions,
d3drm_animation2_AddRotateKey,
d3drm_animation2_AddPositionKey,
d3drm_animation2_AddScaleKey,
d3drm_animation2_DeleteKey,
d3drm_animation2_SetFrame,
d3drm_animation2_SetTime,
d3drm_animation2_GetOptions,
d3drm_animation2_GetFrame,
d3drm_animation2_DeleteKeyByID,
d3drm_animation2_AddKey,
d3drm_animation2_ModifyKey,
d3drm_animation2_GetKeys,
};
HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *d3drm)
{
static const char classname[] = "Animation";
struct d3drm_animation *object;
HRESULT hr = D3DRM_OK;
TRACE("animation %p, d3drm %p.\n", animation, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl;
object->IDirect3DRMAnimation2_iface.lpVtbl = &d3drm_animation2_vtbl;
object->d3drm = d3drm;
object->ref = 1;
d3drm_object_init(&object->obj, classname);
IDirect3DRM_AddRef(object->d3drm);
*animation = object;
return hr;
}

View File

@ -1463,31 +1463,33 @@ static void test_object(void)
{
REFCLSID clsid;
REFIID iid;
BOOL todo;
BOOL takes_d3drm_ref;
}
tests[] =
{
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice, FALSE },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice2, FALSE },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice3, FALSE },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMWinDevice, FALSE },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture, FALSE },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture2, FALSE },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture3, FALSE },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport, FALSE },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport2, FALSE },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace2 },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder2 },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder3 },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame2 },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame3 },
{ &CLSID_CDirect3DRMLight, &IID_IDirect3DRMLight },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial2 },
{ &CLSID_CDirect3DRMMesh, &IID_IDirect3DRMMesh },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice2 },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMDevice3 },
{ &CLSID_CDirect3DRMDevice, &IID_IDirect3DRMWinDevice },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture2 },
{ &CLSID_CDirect3DRMTexture, &IID_IDirect3DRMTexture3 },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport },
{ &CLSID_CDirect3DRMViewport, &IID_IDirect3DRMViewport2 },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace },
{ &CLSID_CDirect3DRMFace, &IID_IDirect3DRMFace2 },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder, TRUE },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder2, TRUE },
{ &CLSID_CDirect3DRMMeshBuilder, &IID_IDirect3DRMMeshBuilder3, TRUE },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame, TRUE },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame2, TRUE },
{ &CLSID_CDirect3DRMFrame, &IID_IDirect3DRMFrame3, TRUE },
{ &CLSID_CDirect3DRMLight, &IID_IDirect3DRMLight, TRUE },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial, TRUE },
{ &CLSID_CDirect3DRMMaterial, &IID_IDirect3DRMMaterial2, TRUE },
{ &CLSID_CDirect3DRMMesh, &IID_IDirect3DRMMesh, TRUE },
{ &CLSID_CDirect3DRMAnimation, &IID_IDirect3DRMAnimation, TRUE },
{ &CLSID_CDirect3DRMAnimation, &IID_IDirect3DRMAnimation2, TRUE },
};
IDirect3DRM *d3drm1;
IDirect3DRM2 *d3drm2;
@ -1511,12 +1513,6 @@ static void test_object(void)
for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i)
{
BOOL takes_ref = IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMMeshBuilder) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMFrame) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMLight) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMMaterial) ||
IsEqualGUID(tests[i].clsid, &CLSID_CDirect3DRMMesh);
unknown = (IUnknown *)0xdeadbeef;
hr = IDirect3DRM_CreateObject(d3drm1, NULL, NULL, tests[i].iid, (void **)&unknown);
ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
@ -1529,12 +1525,11 @@ static void test_object(void)
ok(hr == D3DRMERR_BADVALUE, "Test %u: expected hr == D3DRMERR_BADVALUE, got %#x.\n", i, hr);
hr = IDirect3DRM_CreateObject(d3drm1, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
todo_wine_if(tests[i].todo)
ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
if (SUCCEEDED(hr))
{
ref2 = get_refcount((IUnknown *)d3drm1);
if (takes_ref)
if (tests[i].takes_d3drm_ref)
ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
else
ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
@ -1557,7 +1552,7 @@ static void test_object(void)
hr = IDirect3DRM2_CreateObject(d3drm2, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
ref2 = get_refcount((IUnknown *)d3drm1);
if (takes_ref)
if (tests[i].takes_d3drm_ref)
ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
else
ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
@ -1576,7 +1571,7 @@ static void test_object(void)
hr = IDirect3DRM3_CreateObject(d3drm3, tests[i].clsid, NULL, tests[i].iid, (void **)&unknown);
ok(SUCCEEDED(hr), "Test %u: expected hr == D3DRM_OK, got %#x.\n", i, hr);
ref2 = get_refcount((IUnknown *)d3drm1);
if (takes_ref)
if (tests[i].takes_d3drm_ref)
ok(ref2 > ref1, "Test %u: expected ref2 > ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
else
ok(ref2 == ref1, "Test %u: expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", i, ref1, ref2);
@ -6706,6 +6701,48 @@ static void test_create_texture_from_surface(void)
IDirectDraw_Release(ddraw);
}
static void test_animation(void)
{
IDirect3DRMAnimation2 *animation2;
IDirect3DRMAnimation *animation;
IDirect3DRMObject *obj, *obj2;
IDirect3DRM *d3drm1;
HRESULT hr;
hr = Direct3DRMCreate(&d3drm1);
ok(SUCCEEDED(hr), "Failed to create IDirect3DRM instance, hr 0x%08x.\n", hr);
hr = IDirect3DRM_CreateAnimation(d3drm1, NULL);
ok(hr == D3DRMERR_BADVALUE, "Unexpected hr 0x%08x.\n", hr);
CHECK_REFCOUNT(d3drm1, 1);
hr = IDirect3DRM_CreateAnimation(d3drm1, &animation);
ok(SUCCEEDED(hr), "Failed to create animation hr 0x%08x.\n", hr);
CHECK_REFCOUNT(d3drm1, 2);
test_class_name((IDirect3DRMObject *)animation, "Animation");
hr = IDirect3DRMAnimation_QueryInterface(animation, &IID_IDirect3DRMAnimation2, (void **)&animation2);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMAnimation2, hr 0x%08x.\n", hr);
ok(animation != (void *)animation2, "Expected different interface pointer.\n");
hr = IDirect3DRMAnimation_QueryInterface(animation, &IID_IDirect3DRMObject, (void **)&obj);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, hr 0x%08x.\n", hr);
hr = IDirect3DRMAnimation2_QueryInterface(animation2, &IID_IDirect3DRMObject, (void **)&obj2);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, hr 0x%08x.\n", hr);
ok(obj == obj2 && obj == (IDirect3DRMObject *)animation, "Unexpected object pointer.\n");
IDirect3DRMObject_Release(obj);
IDirect3DRMObject_Release(obj2);
IDirect3DRMAnimation2_Release(animation2);
IDirect3DRMAnimation_Release(animation);
IDirect3DRM_Release(d3drm1);
}
START_TEST(d3drm)
{
test_MeshBuilder();
@ -6740,4 +6777,5 @@ START_TEST(d3drm)
test_viewport_clear1();
test_viewport_clear2();
test_create_texture_from_surface();
test_animation();
}