Sweden-Number/dlls/d3drm/d3drm.c

1555 lines
52 KiB
C
Raw Normal View History

/*
* Implementation of IDirect3DRM Interface
*
* Copyright 2010, 2012 Christian Costa
2011-12-29 02:26:40 +01:00
* Copyright 2011 André Hentschel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/debug.h"
#define COBJMACROS
#include "winbase.h"
#include "wingdi.h"
#include "dxfile.h"
#include "rmxfguid.h"
#include "d3drm_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
static const char* get_IID_string(const GUID* guid)
{
if (IsEqualGUID(guid, &IID_IDirect3DRMFrame))
return "IID_IDirect3DRMFrame";
else if (IsEqualGUID(guid, &IID_IDirect3DRMFrame2))
return "IID_IDirect3DRMFrame2";
else if (IsEqualGUID(guid, &IID_IDirect3DRMFrame3))
return "IID_IDirect3DRMFrame3";
else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder))
return "IID_IDirect3DRMMeshBuilder";
else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder2))
return "IID_IDirect3DRMMeshBuilder2";
else if (IsEqualGUID(guid, &IID_IDirect3DRMMeshBuilder3))
return "IID_IDirect3DRMMeshBuilder3";
return "?";
}
typedef struct {
IDirect3DRM IDirect3DRM_iface;
2011-12-27 23:16:10 +01:00
IDirect3DRM2 IDirect3DRM2_iface;
2011-12-29 02:26:40 +01:00
IDirect3DRM3 IDirect3DRM3_iface;
LONG ref;
} IDirect3DRMImpl;
static inline IDirect3DRMImpl *impl_from_IDirect3DRM(IDirect3DRM *iface)
{
return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM_iface);
}
2011-12-27 23:16:10 +01:00
static inline IDirect3DRMImpl *impl_from_IDirect3DRM2(IDirect3DRM2 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM2_iface);
}
2011-12-29 02:26:40 +01:00
static inline IDirect3DRMImpl *impl_from_IDirect3DRM3(IDirect3DRM3 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DRMImpl, IDirect3DRM3_iface);
}
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRMImpl_QueryInterface(IDirect3DRM* iface, REFIID riid, void** ppvObject)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
2011-12-27 23:16:10 +01:00
*ppvObject = NULL;
if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IDirect3DRM))
{
2011-12-27 23:16:10 +01:00
*ppvObject = &This->IDirect3DRM_iface;
}
else if(IsEqualGUID(riid, &IID_IDirect3DRM2))
{
*ppvObject = &This->IDirect3DRM2_iface;
}
2011-12-29 02:26:40 +01:00
else if(IsEqualGUID(riid, &IID_IDirect3DRM3))
{
*ppvObject = &This->IDirect3DRM3_iface;
}
2011-12-27 23:16:10 +01:00
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
2011-12-27 23:16:10 +01:00
IDirect3DRM_AddRef(iface);
return S_OK;
}
static ULONG WINAPI IDirect3DRMImpl_AddRef(IDirect3DRM* iface)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p/%p)->(): new ref = %d\n", iface, This, ref);
return ref;
}
static ULONG WINAPI IDirect3DRMImpl_Release(IDirect3DRM* iface)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)->(): new ref = %d\n", iface, This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
/*** IDirect3DRM methods ***/
2013-08-20 10:20:13 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateObject(IDirect3DRM *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
{
2013-08-20 10:20:13 +02:00
FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
return E_NOTIMPL;
}
2013-04-19 08:34:15 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateFrame(IDirect3DRM *iface,
IDirect3DRMFrame *parent_frame, IDirect3DRMFrame **frame)
{
2013-04-19 08:34:15 +02:00
TRACE("iface %p, parent_frame %p, frame %p.\n", iface, parent_frame, frame);
2013-04-19 08:34:15 +02:00
return Direct3DRMFrame_create(&IID_IDirect3DRMFrame, (IUnknown *)parent_frame, (IUnknown **)frame);
}
2013-04-22 15:18:46 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateMesh(IDirect3DRM *iface, IDirect3DRMMesh **mesh)
{
2013-04-22 15:18:46 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
2013-04-22 15:18:46 +02:00
TRACE("iface %p, mesh %p.\n", iface, mesh);
2013-04-22 15:18:46 +02:00
return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh);
}
2013-04-23 13:21:32 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateMeshBuilder(IDirect3DRM *iface, IDirect3DRMMeshBuilder **mesh_builder)
{
2013-04-23 13:21:32 +02:00
TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
2013-04-23 13:21:32 +02:00
return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder, (IUnknown **)mesh_builder);
}
2013-04-25 09:59:44 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateFace(IDirect3DRM* iface, IDirect3DRMFace **face)
{
2013-05-09 14:43:12 +02:00
TRACE("iface %p, face %p.\n", iface, face);
2013-05-09 14:43:39 +02:00
return Direct3DRMFace_create(&IID_IDirect3DRMFace, (IUnknown **)face);
}
2013-05-30 10:05:35 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateAnimation(IDirect3DRM *iface, IDirect3DRMAnimation **animation)
{
2013-05-30 10:05:35 +02:00
FIXME("iface %p, animation %p stub!\n", iface, animation);
return E_NOTIMPL;
}
2013-05-30 22:34:18 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateAnimationSet(IDirect3DRM *iface, IDirect3DRMAnimationSet **set)
{
2013-05-30 22:34:18 +02:00
FIXME("iface %p, set %p stub!\n", iface, set);
return E_NOTIMPL;
}
2013-01-28 11:15:36 +01:00
static HRESULT WINAPI IDirect3DRMImpl_CreateTexture(IDirect3DRM *iface,
D3DRMIMAGE *image, IDirect3DRMTexture **texture)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
2013-01-28 11:15:36 +01:00
FIXME("(%p/%p)->(%p,%p): partial stub\n", iface, This, image, texture);
2013-01-28 11:15:36 +01:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateLight(IDirect3DRM *iface,
D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
{
2013-04-25 09:59:46 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
2013-04-25 09:59:46 +02:00
TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface, type, color, light);
2013-04-25 09:59:46 +02:00
return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light);
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateLightRGB(IDirect3DRM *iface, D3DRMLIGHTTYPE type,
D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
{
2013-04-25 09:59:46 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
2013-04-25 09:59:46 +02:00
TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
iface, type, red, green, blue, light);
2013-04-25 09:59:46 +02:00
return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light);
}
2013-05-28 08:55:21 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateMaterial(IDirect3DRM *iface,
D3DVALUE power, IDirect3DRMMaterial **material)
{
2013-05-28 08:55:21 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
2013-05-28 08:55:21 +02:00
TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
2013-05-28 08:55:21 +02:00
return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material);
}
2013-04-17 08:48:01 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateDevice(IDirect3DRM *iface,
DWORD width, DWORD height, IDirect3DRMDevice **device)
{
2013-04-17 08:48:01 +02:00
FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device);
2013-04-17 08:48:01 +02:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown **)device);
}
2012-11-19 22:04:10 +01:00
static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromSurface(IDirect3DRM *iface, GUID *pGUID,
IDirectDraw *pDD, IDirectDrawSurface *pDDSBack, IDirect3DRMDevice **ppDevice)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%s,%p,%p,%p): partial stub\n", iface, This, debugstr_guid(pGUID), pDD,
pDDSBack, ppDevice);
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown**)ppDevice);
}
2012-11-20 22:40:20 +01:00
static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromD3D(IDirect3DRM *iface,
IDirect3D *pD3D, IDirect3DDevice *pD3DDev, IDirect3DRMDevice **ppDevice)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%p,%p,%p): partial stub\n", iface, This, pD3D, pD3DDev, ppDevice);
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown**)ppDevice);
}
2012-11-19 22:04:11 +01:00
static HRESULT WINAPI IDirect3DRMImpl_CreateDeviceFromClipper(IDirect3DRM *iface,
IDirectDrawClipper *pDDClipper, GUID *pGUID, int width, int height,
IDirect3DRMDevice **ppDevice)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%p,%s,%d,%d,%p): partial stub\n", iface, This, pDDClipper,
debugstr_guid(pGUID), width, height, ppDevice);
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown**)ppDevice);
}
2012-11-19 22:04:10 +01:00
static HRESULT WINAPI IDirect3DRMImpl_CreateTextureFromSurface(IDirect3DRM *iface,
IDirectDrawSurface *pDDS, IDirect3DRMTexture **ppTexture)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pDDS, ppTexture);
return E_NOTIMPL;
}
2013-04-22 15:18:45 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateShadow(IDirect3DRM *iface, IDirect3DRMVisual *visual,
IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
IDirect3DRMVisual **shadow)
{
2013-04-22 15:18:45 +02:00
FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
iface, visual, light, px, py, pz, nx, ny, nz, shadow);
return E_NOTIMPL;
}
2013-04-17 08:48:01 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateViewport(IDirect3DRM *iface, IDirect3DRMDevice *device,
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
{
2013-04-17 08:48:01 +02:00
FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
iface, device, camera, x, y, width, height, viewport);
2013-04-17 08:48:01 +02:00
return Direct3DRMViewport_create(&IID_IDirect3DRMViewport, (IUnknown **)viewport);
}
2013-04-19 08:34:15 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateWrap(IDirect3DRM *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
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,
IDirect3DRMWrap **wrap)
{
2013-04-19 08:34:15 +02:00
FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
"ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap);
return E_NOTIMPL;
}
2013-06-03 09:19:36 +02:00
static HRESULT WINAPI IDirect3DRMImpl_CreateUserVisual(IDirect3DRM *iface,
D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
{
2013-06-03 09:19:36 +02:00
FIXME("iface %p, cb %p, ctx %p visual %p stub!\n", iface, cb, ctx, visual);
return E_NOTIMPL;
}
2013-05-27 09:22:51 +02:00
static HRESULT WINAPI IDirect3DRMImpl_LoadTexture(IDirect3DRM *iface,
const char *filename, IDirect3DRMTexture **texture)
{
2013-05-27 09:22:51 +02:00
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
2013-05-27 09:22:51 +02:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
}
2013-05-27 09:22:51 +02:00
static HRESULT WINAPI IDirect3DRMImpl_LoadTextureFromResource(IDirect3DRM *iface,
HRSRC resource, IDirect3DRMTexture **texture)
{
2013-05-27 09:22:51 +02:00
FIXME("iface %p, resource %p, texture %p stub!\n", iface, resource, texture);
2013-05-27 09:22:51 +02:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
}
2013-09-06 09:57:43 +02:00
static HRESULT WINAPI IDirect3DRMImpl_SetSearchPath(IDirect3DRM *iface, const char *path)
{
2013-09-06 09:57:43 +02:00
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
return E_NOTIMPL;
}
2013-09-06 09:57:43 +02:00
static HRESULT WINAPI IDirect3DRMImpl_AddSearchPath(IDirect3DRM *iface, const char *path)
{
2013-09-06 09:57:43 +02:00
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
return E_NOTIMPL;
}
2013-09-09 10:26:20 +02:00
static HRESULT WINAPI IDirect3DRMImpl_GetSearchPath(IDirect3DRM *iface, DWORD *size, char *path)
{
2013-09-09 10:26:20 +02:00
FIXME("iface %p, size %p, path %p stub!\n", iface, size, path);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMImpl_SetDefaultTextureColors(IDirect3DRM* iface, DWORD nb_colors)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRMImpl_SetDefaultTextureShades(IDirect3DRM* iface, DWORD nb_shades)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
return E_NOTIMPL;
}
2013-06-04 09:57:09 +02:00
static HRESULT WINAPI IDirect3DRMImpl_GetDevices(IDirect3DRM *iface, IDirect3DRMDeviceArray **array)
{
2013-06-04 09:57:09 +02:00
FIXME("iface %p, array %p stub!\n", iface, array);
return E_NOTIMPL;
}
2013-04-17 08:48:00 +02:00
static HRESULT WINAPI IDirect3DRMImpl_GetNamedObject(IDirect3DRM *iface,
const char *name, IDirect3DRMObject **object)
{
2013-04-17 08:48:00 +02:00
FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
return E_NOTIMPL;
}
2013-09-09 10:26:21 +02:00
static HRESULT WINAPI IDirect3DRMImpl_EnumerateObjects(IDirect3DRM *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
{
2013-09-09 10:26:21 +02:00
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
return E_NOTIMPL;
}
2013-04-19 08:34:15 +02:00
static HRESULT WINAPI IDirect3DRMImpl_Load(IDirect3DRM *iface, void *source, void *object_id, IID **iids,
DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame)
{
2013-04-19 08:34:15 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM(iface);
IDirect3DRMFrame3 *parent_frame3 = NULL;
HRESULT hr = D3DRM_OK;
2013-04-19 08:34:15 +02:00
TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
"load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
iface, source, object_id, iids, iid_count, flags,
load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
2013-04-19 08:34:15 +02:00
if (parent_frame)
hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3);
if (SUCCEEDED(hr))
2013-04-19 08:34:15 +02:00
hr = IDirect3DRM3_Load(&d3drm->IDirect3DRM3_iface, source, object_id, iids, iid_count,
flags, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame3);
if (parent_frame3)
IDirect3DRMFrame3_Release(parent_frame3);
return hr;
}
static HRESULT WINAPI IDirect3DRMImpl_Tick(IDirect3DRM* iface, D3DVALUE tick)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM(iface);
FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
return E_NOTIMPL;
}
static const struct IDirect3DRMVtbl Direct3DRM_Vtbl =
{
IDirect3DRMImpl_QueryInterface,
IDirect3DRMImpl_AddRef,
IDirect3DRMImpl_Release,
IDirect3DRMImpl_CreateObject,
IDirect3DRMImpl_CreateFrame,
IDirect3DRMImpl_CreateMesh,
IDirect3DRMImpl_CreateMeshBuilder,
IDirect3DRMImpl_CreateFace,
IDirect3DRMImpl_CreateAnimation,
IDirect3DRMImpl_CreateAnimationSet,
IDirect3DRMImpl_CreateTexture,
IDirect3DRMImpl_CreateLight,
IDirect3DRMImpl_CreateLightRGB,
IDirect3DRMImpl_CreateMaterial,
IDirect3DRMImpl_CreateDevice,
IDirect3DRMImpl_CreateDeviceFromSurface,
IDirect3DRMImpl_CreateDeviceFromD3D,
IDirect3DRMImpl_CreateDeviceFromClipper,
IDirect3DRMImpl_CreateTextureFromSurface,
IDirect3DRMImpl_CreateShadow,
IDirect3DRMImpl_CreateViewport,
IDirect3DRMImpl_CreateWrap,
IDirect3DRMImpl_CreateUserVisual,
IDirect3DRMImpl_LoadTexture,
IDirect3DRMImpl_LoadTextureFromResource,
IDirect3DRMImpl_SetSearchPath,
IDirect3DRMImpl_AddSearchPath,
IDirect3DRMImpl_GetSearchPath,
IDirect3DRMImpl_SetDefaultTextureColors,
IDirect3DRMImpl_SetDefaultTextureShades,
IDirect3DRMImpl_GetDevices,
IDirect3DRMImpl_GetNamedObject,
IDirect3DRMImpl_EnumerateObjects,
IDirect3DRMImpl_Load,
IDirect3DRMImpl_Tick
};
2011-12-27 23:16:10 +01:00
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRM2Impl_QueryInterface(IDirect3DRM2* iface, REFIID riid,
void** ppvObject)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
return IDirect3DRM_QueryInterface(&This->IDirect3DRM_iface, riid, ppvObject);
}
static ULONG WINAPI IDirect3DRM2Impl_AddRef(IDirect3DRM2* iface)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
return IDirect3DRM_AddRef(&This->IDirect3DRM_iface);
2011-12-27 23:16:10 +01:00
}
static ULONG WINAPI IDirect3DRM2Impl_Release(IDirect3DRM2* iface)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
return IDirect3DRM_Release(&This->IDirect3DRM_iface);
2011-12-27 23:16:10 +01:00
}
/*** IDirect3DRM2 methods ***/
2013-08-20 10:20:13 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateObject(IDirect3DRM2 *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
2011-12-27 23:16:10 +01:00
{
2013-08-20 10:20:13 +02:00
FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-04-19 08:34:15 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateFrame(IDirect3DRM2 *iface,
IDirect3DRMFrame *parent_frame, IDirect3DRMFrame2 **frame)
2011-12-27 23:16:10 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
TRACE("(%p/%p)->(%p,%p)\n", iface, This, parent_frame, frame);
return Direct3DRMFrame_create(&IID_IDirect3DRMFrame2, (IUnknown*)parent_frame, (IUnknown**)frame);
2011-12-27 23:16:10 +01:00
}
2013-04-22 15:18:46 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateMesh(IDirect3DRM2 *iface, IDirect3DRMMesh **mesh)
2011-12-27 23:16:10 +01:00
{
2013-04-22 15:18:46 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
2011-12-27 23:16:10 +01:00
2013-04-22 15:18:46 +02:00
TRACE("iface %p, mesh %p.\n", iface, mesh);
2011-12-27 23:16:10 +01:00
2013-04-22 15:18:46 +02:00
return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh);
2011-12-27 23:16:10 +01:00
}
2013-04-23 13:21:33 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateMeshBuilder(IDirect3DRM2 *iface, IDirect3DRMMeshBuilder2 **mesh_builder)
2011-12-27 23:16:10 +01:00
{
2013-04-23 13:21:33 +02:00
TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
2011-12-27 23:16:10 +01:00
2013-04-23 13:21:33 +02:00
return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder2, (IUnknown **)mesh_builder);
2011-12-27 23:16:10 +01:00
}
2013-04-25 09:59:44 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateFace(IDirect3DRM2 *iface, IDirect3DRMFace **face)
2011-12-27 23:16:10 +01:00
{
2013-05-09 14:43:12 +02:00
TRACE("iface %p, face %p.\n", iface, face);
2011-12-27 23:16:10 +01:00
2013-05-09 14:43:39 +02:00
return Direct3DRMFace_create(&IID_IDirect3DRMFace, (IUnknown **)face);
2011-12-27 23:16:10 +01:00
}
2013-05-30 10:05:35 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateAnimation(IDirect3DRM2 *iface, IDirect3DRMAnimation **animation)
2011-12-27 23:16:10 +01:00
{
2013-05-30 10:05:35 +02:00
FIXME("iface %p, animation %p stub!\n", iface, animation);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-05-30 22:34:18 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateAnimationSet(IDirect3DRM2 *iface, IDirect3DRMAnimationSet **set)
2011-12-27 23:16:10 +01:00
{
2013-05-30 22:34:18 +02:00
FIXME("iface %p, set %p stub!\n", iface, set);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-01-28 11:15:36 +01:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateTexture(IDirect3DRM2 *iface,
D3DRMIMAGE *image, IDirect3DRMTexture2 **texture)
2011-12-27 23:16:10 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
2013-01-28 11:15:36 +01:00
FIXME("(%p/%p)->(%p,%p): partial stub\n", iface, This, image, texture);
2011-12-27 23:16:10 +01:00
2013-01-28 11:15:36 +01:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
2011-12-27 23:16:10 +01:00
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateLight(IDirect3DRM2 *iface,
D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
2011-12-27 23:16:10 +01:00
{
2013-04-25 09:59:46 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
2011-12-27 23:16:10 +01:00
2013-04-25 09:59:46 +02:00
TRACE("iface %p, type %#x, color 0x%08x, light %p.\n", iface, type, color, light);
2011-12-27 23:16:10 +01:00
2013-04-25 09:59:46 +02:00
return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light);
2011-12-27 23:16:10 +01:00
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateLightRGB(IDirect3DRM2 *iface, D3DRMLIGHTTYPE type,
D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
2011-12-27 23:16:10 +01:00
{
2013-04-25 09:59:46 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
2011-12-27 23:16:10 +01:00
2013-04-25 09:59:46 +02:00
TRACE("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p.\n",
iface, type, red, green, blue, light);
2011-12-27 23:16:10 +01:00
2013-04-25 09:59:46 +02:00
return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light);
2011-12-27 23:16:10 +01:00
}
2013-05-28 08:55:21 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateMaterial(IDirect3DRM2 *iface,
D3DVALUE power, IDirect3DRMMaterial **material)
2011-12-27 23:16:10 +01:00
{
2013-05-28 08:55:21 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
2011-12-27 23:16:10 +01:00
2013-05-28 08:55:21 +02:00
TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
2011-12-27 23:16:10 +01:00
2013-05-28 08:55:21 +02:00
return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material);
2011-12-27 23:16:10 +01:00
}
2013-04-18 09:35:14 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateDevice(IDirect3DRM2 *iface,
DWORD width, DWORD height, IDirect3DRMDevice2 **device)
2011-12-27 23:16:10 +01:00
{
2013-04-18 09:35:14 +02:00
FIXME("iface %p, width %u, height %u, device %p.\n", iface, width, height, device);
2011-12-27 23:16:10 +01:00
2013-04-18 09:35:14 +02:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown **)device);
2011-12-27 23:16:10 +01:00
}
2012-11-19 22:04:10 +01:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateDeviceFromSurface(IDirect3DRM2 *iface, GUID *pGUID,
IDirectDraw *pDD, IDirectDrawSurface *pDDSBack, IDirect3DRMDevice2 **ppDevice)
2011-12-27 23:16:10 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%s,%p,%p,%p): partial stub\n", iface, This, debugstr_guid(pGUID),
pDD, pDDSBack, ppDevice);
2011-12-27 23:16:10 +01:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown**)ppDevice);
2011-12-27 23:16:10 +01:00
}
2012-11-20 22:40:19 +01:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateDeviceFromD3D(IDirect3DRM2 *iface,
IDirect3D2 *pD3D, IDirect3DDevice2 *pD3DDev, IDirect3DRMDevice2 **ppDevice)
2011-12-27 23:16:10 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%p,%p,%p): partial stub\n", iface, This, pD3D, pD3DDev, ppDevice);
2011-12-27 23:16:10 +01:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown**)ppDevice);
2011-12-27 23:16:10 +01:00
}
2012-11-19 22:04:11 +01:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateDeviceFromClipper(IDirect3DRM2 *iface,
IDirectDrawClipper *pDDClipper, GUID *pGUID, int width, int height,
IDirect3DRMDevice2 **ppDevice)
2011-12-27 23:16:10 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%p,%s,%d,%d,%p): partial stub\n", iface, This, pDDClipper,
debugstr_guid(pGUID), width, height, ppDevice);
2011-12-27 23:16:10 +01:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown**)ppDevice);
2011-12-27 23:16:10 +01:00
}
2012-11-19 22:04:10 +01:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateTextureFromSurface(IDirect3DRM2 *iface,
IDirectDrawSurface *pDDS, IDirect3DRMTexture2 **ppTexture)
2011-12-27 23:16:10 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, pDDS, ppTexture);
return E_NOTIMPL;
}
2013-04-22 15:18:45 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateShadow(IDirect3DRM2 *iface, IDirect3DRMVisual *visual,
IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
IDirect3DRMVisual **shadow)
2011-12-27 23:16:10 +01:00
{
2013-04-22 15:18:45 +02:00
FIXME("iface %p, visual %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
iface, visual, light, px, py, pz, nx, ny, nz, shadow);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-04-17 08:48:01 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateViewport(IDirect3DRM2 *iface, IDirect3DRMDevice *device,
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
2011-12-27 23:16:10 +01:00
{
2013-04-17 08:48:01 +02:00
FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
iface, device, camera, x, y, width, height, viewport);
2011-12-27 23:16:10 +01:00
2013-04-17 08:48:01 +02:00
return Direct3DRMViewport_create(&IID_IDirect3DRMViewport, (IUnknown **)viewport);
2011-12-27 23:16:10 +01:00
}
2013-04-19 08:34:15 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateWrap(IDirect3DRM2 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
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,
IDirect3DRMWrap **wrap)
2011-12-27 23:16:10 +01:00
{
2013-04-19 08:34:15 +02:00
FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
"ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-06-03 09:19:36 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_CreateUserVisual(IDirect3DRM2 *iface,
D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
2011-12-27 23:16:10 +01:00
{
2013-06-03 09:19:36 +02:00
FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface, cb, ctx, visual);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-05-27 09:22:52 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_LoadTexture(IDirect3DRM2 *iface,
const char *filename, IDirect3DRMTexture2 **texture)
2011-12-27 23:16:10 +01:00
{
2013-05-27 09:22:52 +02:00
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
2011-12-27 23:16:10 +01:00
2013-05-27 09:22:52 +02:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
2011-12-27 23:16:10 +01:00
}
2013-05-27 09:22:52 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE module,
const char *resource_name, const char *resource_type, IDirect3DRMTexture2 **texture)
2011-12-27 23:16:10 +01:00
{
2013-05-27 09:22:52 +02:00
FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
iface, debugstr_a(resource_name), debugstr_a(resource_type), texture);
2011-12-27 23:16:10 +01:00
2013-05-27 09:22:52 +02:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
2011-12-27 23:16:10 +01:00
}
2013-09-06 09:57:43 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_SetSearchPath(IDirect3DRM2 *iface, const char *path)
2011-12-27 23:16:10 +01:00
{
2013-09-06 09:57:43 +02:00
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-09-06 09:57:43 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_AddSearchPath(IDirect3DRM2 *iface, const char *path)
2011-12-27 23:16:10 +01:00
{
2013-09-06 09:57:43 +02:00
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-09-09 10:26:20 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_GetSearchPath(IDirect3DRM2 *iface, DWORD *size, char *path)
2011-12-27 23:16:10 +01:00
{
2013-09-09 10:26:20 +02:00
FIXME("iface %p, size %p, path %p stub!\n", iface, size, path);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM2Impl_SetDefaultTextureColors(IDirect3DRM2* iface, DWORD nb_colors)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM2Impl_SetDefaultTextureShades(IDirect3DRM2* iface, DWORD nb_shades)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
return E_NOTIMPL;
}
2013-06-04 09:57:09 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_GetDevices(IDirect3DRM2 *iface, IDirect3DRMDeviceArray **array)
2011-12-27 23:16:10 +01:00
{
2013-06-04 09:57:09 +02:00
FIXME("iface %p, array %p stub!\n", iface, array);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-04-17 08:48:00 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_GetNamedObject(IDirect3DRM2 *iface,
const char *name, IDirect3DRMObject **object)
2011-12-27 23:16:10 +01:00
{
2013-04-17 08:48:00 +02:00
FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-09-09 10:26:21 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_EnumerateObjects(IDirect3DRM2 *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
2011-12-27 23:16:10 +01:00
{
2013-09-09 10:26:21 +02:00
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
2013-04-19 08:34:15 +02:00
static HRESULT WINAPI IDirect3DRM2Impl_Load(IDirect3DRM2 *iface, void *source, void *object_id, IID **iids,
DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame)
2011-12-27 23:16:10 +01:00
{
2013-04-19 08:34:15 +02:00
IDirect3DRMImpl *d3drm = impl_from_IDirect3DRM2(iface);
IDirect3DRMFrame3 *parent_frame3 = NULL;
HRESULT hr = D3DRM_OK;
2011-12-27 23:16:10 +01:00
2013-04-19 08:34:15 +02:00
TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
"load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
iface, source, object_id, iids, iid_count, flags,
load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
2011-12-27 23:16:10 +01:00
2013-04-19 08:34:15 +02:00
if (parent_frame)
hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3);
if (SUCCEEDED(hr))
2013-04-19 08:34:15 +02:00
hr = IDirect3DRM3_Load(&d3drm->IDirect3DRM3_iface, source, object_id, iids, iid_count,
flags, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame3);
if (parent_frame3)
IDirect3DRMFrame3_Release(parent_frame3);
return hr;
2011-12-27 23:16:10 +01:00
}
static HRESULT WINAPI IDirect3DRM2Impl_Tick(IDirect3DRM2* iface, D3DVALUE tick)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM2(iface);
FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM2Impl_CreateProgressiveMesh(IDirect3DRM2 *iface, IDirect3DRMProgressiveMesh **mesh)
2011-12-27 23:16:10 +01:00
{
FIXME("iface %p, mesh %p stub!\n", iface, mesh);
2011-12-27 23:16:10 +01:00
return E_NOTIMPL;
}
static const struct IDirect3DRM2Vtbl Direct3DRM2_Vtbl =
{
IDirect3DRM2Impl_QueryInterface,
IDirect3DRM2Impl_AddRef,
IDirect3DRM2Impl_Release,
IDirect3DRM2Impl_CreateObject,
IDirect3DRM2Impl_CreateFrame,
IDirect3DRM2Impl_CreateMesh,
IDirect3DRM2Impl_CreateMeshBuilder,
IDirect3DRM2Impl_CreateFace,
IDirect3DRM2Impl_CreateAnimation,
IDirect3DRM2Impl_CreateAnimationSet,
IDirect3DRM2Impl_CreateTexture,
IDirect3DRM2Impl_CreateLight,
IDirect3DRM2Impl_CreateLightRGB,
IDirect3DRM2Impl_CreateMaterial,
2011-12-27 23:16:10 +01:00
IDirect3DRM2Impl_CreateDevice,
IDirect3DRM2Impl_CreateDeviceFromSurface,
IDirect3DRM2Impl_CreateDeviceFromD3D,
IDirect3DRM2Impl_CreateDeviceFromClipper,
IDirect3DRM2Impl_CreateTextureFromSurface,
IDirect3DRM2Impl_CreateShadow,
IDirect3DRM2Impl_CreateViewport,
IDirect3DRM2Impl_CreateWrap,
IDirect3DRM2Impl_CreateUserVisual,
IDirect3DRM2Impl_LoadTexture,
IDirect3DRM2Impl_LoadTextureFromResource,
IDirect3DRM2Impl_SetSearchPath,
IDirect3DRM2Impl_AddSearchPath,
IDirect3DRM2Impl_GetSearchPath,
IDirect3DRM2Impl_SetDefaultTextureColors,
IDirect3DRM2Impl_SetDefaultTextureShades,
IDirect3DRM2Impl_GetDevices,
IDirect3DRM2Impl_GetNamedObject,
IDirect3DRM2Impl_EnumerateObjects,
IDirect3DRM2Impl_Load,
IDirect3DRM2Impl_Tick,
IDirect3DRM2Impl_CreateProgressiveMesh
};
2011-12-29 02:26:40 +01:00
/*** IUnknown methods ***/
static HRESULT WINAPI IDirect3DRM3Impl_QueryInterface(IDirect3DRM3* iface, REFIID riid,
void** ppvObject)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
return IDirect3DRM_QueryInterface(&This->IDirect3DRM_iface, riid, ppvObject);
}
static ULONG WINAPI IDirect3DRM3Impl_AddRef(IDirect3DRM3* iface)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
return IDirect3DRM_AddRef(&This->IDirect3DRM_iface);
2011-12-29 02:26:40 +01:00
}
static ULONG WINAPI IDirect3DRM3Impl_Release(IDirect3DRM3* iface)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
return IDirect3DRM_Release(&This->IDirect3DRM_iface);
2011-12-29 02:26:40 +01:00
}
/*** IDirect3DRM3 methods ***/
2013-08-20 10:20:13 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateObject(IDirect3DRM3 *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
2011-12-29 02:26:40 +01:00
{
2013-08-20 10:20:13 +02:00
FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-04-22 15:18:44 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateFrame(IDirect3DRM3 *iface,
IDirect3DRMFrame3 *parent, IDirect3DRMFrame3 **frame)
2011-12-29 02:26:40 +01:00
{
2013-04-22 15:18:44 +02:00
TRACE("iface %p, parent %p, frame %p.\n", iface, parent, frame);
2013-04-22 15:18:44 +02:00
return Direct3DRMFrame_create(&IID_IDirect3DRMFrame3, (IUnknown *)parent, (IUnknown **)frame);
2011-12-29 02:26:40 +01:00
}
2013-04-22 15:18:46 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateMesh(IDirect3DRM3 *iface, IDirect3DRMMesh **mesh)
2011-12-29 02:26:40 +01:00
{
2013-04-22 15:18:46 +02:00
TRACE("iface %p, mesh %p.\n", iface, mesh);
2011-12-29 02:26:40 +01:00
2013-04-22 15:18:46 +02:00
return Direct3DRMMesh_create(mesh);
2011-12-29 02:26:40 +01:00
}
2013-04-23 13:21:34 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateMeshBuilder(IDirect3DRM3 *iface, IDirect3DRMMeshBuilder3 **mesh_builder)
2011-12-29 02:26:40 +01:00
{
2013-04-23 13:21:34 +02:00
TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
2011-12-29 02:26:40 +01:00
2013-04-23 13:21:34 +02:00
return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder3, (IUnknown **)mesh_builder);
2011-12-29 02:26:40 +01:00
}
2013-04-25 09:59:45 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateFace(IDirect3DRM3 *iface, IDirect3DRMFace2 **face)
2011-12-29 02:26:40 +01:00
{
2013-05-09 14:43:39 +02:00
TRACE("iface %p, face %p.\n", iface, face);
2011-12-29 02:26:40 +01:00
2013-05-09 14:43:39 +02:00
return Direct3DRMFace_create(&IID_IDirect3DRMFace2, (IUnknown **)face);
2011-12-29 02:26:40 +01:00
}
2013-05-30 10:05:36 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateAnimation(IDirect3DRM3 *iface, IDirect3DRMAnimation2 **animation)
2011-12-29 02:26:40 +01:00
{
2013-05-30 10:05:36 +02:00
FIXME("iface %p, animation %p stub!\n", iface, animation);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM3Impl_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRMAnimationSet2 **set)
2011-12-29 02:26:40 +01:00
{
FIXME("iface %p, set %p stub!\n", iface, set);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-01-28 11:15:36 +01:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateTexture(IDirect3DRM3 *iface,
D3DRMIMAGE *image, IDirect3DRMTexture3 **texture)
2011-12-29 02:26:40 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
2013-01-28 11:15:36 +01:00
FIXME("(%p/%p)->(%p,%p): partial stub\n", iface, This, image, texture);
2011-12-29 02:26:40 +01:00
2013-01-28 11:15:36 +01:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
2011-12-29 02:26:40 +01:00
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateLight(IDirect3DRM3 *iface,
D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
2011-12-29 02:26:40 +01:00
{
2013-04-25 09:59:46 +02:00
HRESULT hr;
2011-12-29 02:26:40 +01:00
2013-04-25 09:59:46 +02:00
FIXME("iface %p, type %#x, color 0x%08x, light %p partial stub!\n", iface, type, color, light);
2012-05-01 22:15:39 +02:00
2013-04-25 09:59:46 +02:00
if (SUCCEEDED(hr = Direct3DRMLight_create((IUnknown **)light)))
2012-05-01 22:15:39 +02:00
{
2013-04-25 09:59:46 +02:00
IDirect3DRMLight_SetType(*light, type);
IDirect3DRMLight_SetColor(*light, color);
2012-05-01 22:15:39 +02:00
}
2013-04-25 09:59:46 +02:00
return hr;
2011-12-29 02:26:40 +01:00
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateLightRGB(IDirect3DRM3 *iface, D3DRMLIGHTTYPE type,
D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
2011-12-29 02:26:40 +01:00
{
2013-04-25 09:59:46 +02:00
HRESULT hr;
2011-12-29 02:26:40 +01:00
2013-04-25 09:59:46 +02:00
FIXME("iface %p, type %#x, red %.8e, green %.8e, blue %.8e, light %p partial stub!\n",
iface, type, red, green, blue, light);
2012-05-01 22:15:39 +02:00
2013-04-25 09:59:46 +02:00
if (SUCCEEDED(hr = Direct3DRMLight_create((IUnknown **)light)))
2012-05-01 22:15:39 +02:00
{
2013-04-25 09:59:46 +02:00
IDirect3DRMLight_SetType(*light, type);
IDirect3DRMLight_SetColorRGB(*light, red, green, blue);
2012-05-01 22:15:39 +02:00
}
2013-04-25 09:59:46 +02:00
return hr;
2011-12-29 02:26:40 +01:00
}
2013-05-29 09:45:39 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateMaterial(IDirect3DRM3 *iface,
D3DVALUE power, IDirect3DRMMaterial2 **material)
2011-12-29 02:26:40 +01:00
{
2013-05-29 09:45:39 +02:00
HRESULT hr;
2011-12-29 02:26:40 +01:00
2013-05-29 09:45:39 +02:00
TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
2013-05-29 09:45:39 +02:00
if (SUCCEEDED(hr = Direct3DRMMaterial_create(material)))
IDirect3DRMMaterial2_SetPower(*material, power);
2013-05-29 09:45:39 +02:00
return hr;
2011-12-29 02:26:40 +01:00
}
2013-04-18 09:35:15 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateDevice(IDirect3DRM3 *iface,
DWORD width, DWORD height, IDirect3DRMDevice3 **device)
2011-12-29 02:26:40 +01:00
{
2013-04-18 09:35:15 +02:00
FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device);
2011-12-29 02:26:40 +01:00
2013-04-18 09:35:15 +02:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown **)device);
2011-12-29 02:26:40 +01:00
}
2012-11-19 22:04:10 +01:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateDeviceFromSurface(IDirect3DRM3 *iface, GUID *pGUID,
IDirectDraw *dd, IDirectDrawSurface *back, IDirect3DRMDevice3 **device)
2011-12-29 02:26:40 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%s,%p,%p,%p): partial stub\n", iface, This, debugstr_guid(pGUID), dd, back, device);
2011-12-29 02:26:40 +01:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown**)device);
2011-12-29 02:26:40 +01:00
}
2012-11-20 22:40:19 +01:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateDeviceFromD3D(IDirect3DRM3 *iface,
IDirect3D2 *d3d, IDirect3DDevice2 *d3ddev, IDirect3DRMDevice3 **device)
2011-12-29 02:26:40 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%p,%p,%p): partial stub\n", iface, This, d3d, d3ddev, device);
2011-12-29 02:26:40 +01:00
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown**)device);
2011-12-29 02:26:40 +01:00
}
2012-11-19 22:04:11 +01:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateDeviceFromClipper(IDirect3DRM3 *iface,
IDirectDrawClipper *clipper, GUID *guid, int width, int height,
IDirect3DRMDevice3 **device)
2011-12-29 02:26:40 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
2012-11-19 22:04:11 +01:00
FIXME("(%p/%p)->(%p,%s,%d,%d,%p): partial stub\n", iface, This, clipper, debugstr_guid(guid),
2011-12-29 02:26:40 +01:00
width, height, device);
return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown**)device);
2011-12-29 02:26:40 +01:00
}
2013-04-25 09:59:46 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateShadow(IDirect3DRM3 *iface, IUnknown *object, IDirect3DRMLight *light,
D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz, IDirect3DRMShadow2 **shadow)
2011-12-29 02:26:40 +01:00
{
2013-04-25 09:59:46 +02:00
FIXME("iface %p, object %p, light %p, px %.8e, py %.8e, pz %.8e, nx %.8e, ny %.8e, nz %.8e, shadow %p stub!\n",
iface, object, light, px, py, pz, nx, ny, nz, shadow);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2012-11-19 22:04:10 +01:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateTextureFromSurface(IDirect3DRM3 *iface,
IDirectDrawSurface *surface, IDirect3DRMTexture3 **texture)
2011-12-29 02:26:40 +01:00
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", iface, This, surface, texture);
return E_NOTIMPL;
}
2013-04-18 09:35:15 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateViewport(IDirect3DRM3 *iface, IDirect3DRMDevice3 *device,
IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport)
2011-12-29 02:26:40 +01:00
{
2013-04-18 09:35:15 +02:00
FIXME("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p partial stub!\n",
iface, device, camera, x, y, width, height, viewport);
2011-12-29 02:26:40 +01:00
2013-04-18 09:35:15 +02:00
return Direct3DRMViewport_create(&IID_IDirect3DRMViewport2, (IUnknown **)viewport);
2011-12-29 02:26:40 +01:00
}
2013-04-22 15:18:44 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateWrap(IDirect3DRM3 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame3 *frame,
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,
IDirect3DRMWrap **wrap)
2011-12-29 02:26:40 +01:00
{
2013-04-22 15:18:44 +02:00
FIXME("iface %p, type %#x, frame %p, ox %.8e, oy %.8e, oz %.8e, dx %.8e, dy %.8e, dz %.8e, "
"ux %.8e, uy %.8e, uz %.8e, ou %.8e, ov %.8e, su %.8e, sv %.8e, wrap %p stub!\n",
iface, type, frame, ox, oy, oz, dx, dy, dz, ux, uy, uz, ou, ov, su, sv, wrap);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-06-03 09:19:36 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateUserVisual(IDirect3DRM3 *iface,
D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
2011-12-29 02:26:40 +01:00
{
2013-06-03 09:19:36 +02:00
FIXME("iface %p, cb %p, ctx %p, visual %p stub!\n", iface, cb, ctx, visual);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-05-28 08:55:20 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_LoadTexture(IDirect3DRM3 *iface,
const char *filename, IDirect3DRMTexture3 **texture)
2011-12-29 02:26:40 +01:00
{
2013-05-28 08:55:20 +02:00
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
2011-12-29 02:26:40 +01:00
2013-05-28 08:55:20 +02:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
2011-12-29 02:26:40 +01:00
}
2013-05-28 08:55:20 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_LoadTextureFromResource(IDirect3DRM3 *iface, HMODULE module,
const char *resource_name, const char *resource_type, IDirect3DRMTexture3 **texture)
2011-12-29 02:26:40 +01:00
{
2013-05-28 08:55:20 +02:00
FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n",
iface, module, debugstr_a(resource_name), debugstr_a(resource_type), texture);
2011-12-29 02:26:40 +01:00
2013-05-28 08:55:20 +02:00
return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
2011-12-29 02:26:40 +01:00
}
2013-09-06 09:57:43 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_SetSearchPath(IDirect3DRM3 *iface, const char *path)
2011-12-29 02:26:40 +01:00
{
2013-09-06 09:57:43 +02:00
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-09-06 09:57:43 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_AddSearchPath(IDirect3DRM3* iface, const char *path)
2011-12-29 02:26:40 +01:00
{
2013-09-06 09:57:43 +02:00
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-09-09 10:26:20 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_GetSearchPath(IDirect3DRM3 *iface, DWORD *size, char *path)
2011-12-29 02:26:40 +01:00
{
2013-09-09 10:26:20 +02:00
FIXME("iface %p, size %p, path %p stub!\n", iface, size, path);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM3Impl_SetDefaultTextureColors(IDirect3DRM3* iface, DWORD nb_colors)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_colors);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM3Impl_SetDefaultTextureShades(IDirect3DRM3* iface, DWORD nb_shades)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, nb_shades);
return E_NOTIMPL;
}
2013-06-04 09:57:09 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_GetDevices(IDirect3DRM3 *iface, IDirect3DRMDeviceArray **array)
2011-12-29 02:26:40 +01:00
{
2013-06-04 09:57:09 +02:00
FIXME("iface %p, array %p stub!\n", iface, array);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-04-17 08:48:00 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_GetNamedObject(IDirect3DRM3 *iface,
const char *name, IDirect3DRMObject **object)
2011-12-29 02:26:40 +01:00
{
2013-04-17 08:48:00 +02:00
FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-09-09 10:26:21 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_EnumerateObjects(IDirect3DRM3 *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
2011-12-29 02:26:40 +01:00
{
2013-09-09 10:26:21 +02:00
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
static HRESULT load_data(IDirect3DRM3 *iface, IDirectXFileData *data_object, IID **GUIDs, DWORD nb_GUIDs, D3DRMLOADCALLBACK LoadProc,
void *ArgLP, D3DRMLOADTEXTURECALLBACK LoadTextureProc, void *ArgLTP, IDirect3DRMFrame3 *parent_frame)
{
HRESULT ret = D3DRMERR_BADOBJECT;
HRESULT hr;
const GUID* guid;
DWORD i;
BOOL requested = FALSE;
hr = IDirectXFileData_GetType(data_object, &guid);
if (hr != DXFILE_OK)
goto end;
TRACE("Found object type whose GUID = %s\n", debugstr_guid(guid));
/* Load object only if it is top level and requested or if it is part of another object */
if (IsEqualGUID(guid, &TID_D3DRMMesh))
{
TRACE("Found TID_D3DRMMesh\n");
for (i = 0; i < nb_GUIDs; i++)
if (IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder) ||
IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder2) ||
IsEqualGUID(GUIDs[i], &IID_IDirect3DRMMeshBuilder3))
{
requested = TRUE;
break;
}
if (requested || parent_frame)
{
IDirect3DRMMeshBuilder3 *meshbuilder;
TRACE("Load mesh data\n");
hr = IDirect3DRM3_CreateMeshBuilder(iface, &meshbuilder);
if (SUCCEEDED(hr))
{
hr = load_mesh_data(meshbuilder, data_object, LoadTextureProc, ArgLTP);
if (SUCCEEDED(hr))
{
/* Only top level objects are notified */
if (!parent_frame)
{
IDirect3DRMObject *object;
hr = IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder, GUIDs[i], (void**)&object);
if (SUCCEEDED(hr))
{
LoadProc(object, GUIDs[i], ArgLP);
IDirect3DRMObject_Release(object);
}
}
else
{
IDirect3DRMFrame3_AddVisual(parent_frame, (IUnknown*)meshbuilder);
}
}
IDirect3DRMMeshBuilder3_Release(meshbuilder);
}
if (FAILED(hr))
ERR("Cannot process mesh\n");
}
}
else if (IsEqualGUID(guid, &TID_D3DRMFrame))
{
TRACE("Found TID_D3DRMFrame\n");
for (i = 0; i < nb_GUIDs; i++)
if (IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame) ||
IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame2) ||
IsEqualGUID(GUIDs[i], &IID_IDirect3DRMFrame3))
{
requested = TRUE;
break;
}
if (requested || parent_frame)
{
IDirect3DRMFrame3 *frame;
TRACE("Load frame data\n");
hr = IDirect3DRM3_CreateFrame(iface, parent_frame, &frame);
if (SUCCEEDED(hr))
{
IDirectXFileObject *child;
while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(data_object, &child)))
{
IDirectXFileData *data;
IDirectXFileDataReference *reference;
IDirectXFileBinary *binary;
hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileBinary, (void **)&binary);
if (SUCCEEDED(hr))
{
FIXME("Binary Object not supported yet\n");
IDirectXFileBinary_Release(binary);
continue;
}
hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileData, (void **)&data);
if (SUCCEEDED(hr))
{
TRACE("Found Data Object\n");
hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame);
IDirectXFileData_Release(data);
continue;
}
hr = IDirectXFileObject_QueryInterface(child, &IID_IDirectXFileDataReference, (void **)&reference);
if (SUCCEEDED(hr))
{
TRACE("Found Data Object Reference\n");
IDirectXFileDataReference_Resolve(reference, &data);
hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame);
IDirectXFileData_Release(data);
IDirectXFileDataReference_Release(reference);
continue;
}
}
if (hr != DXFILEERR_NOMOREOBJECTS)
{
IDirect3DRMFrame3_Release(frame);
goto end;
}
hr = S_OK;
/* Only top level objects are notified */
if (!parent_frame)
{
IDirect3DRMObject *object;
hr = IDirect3DRMFrame3_QueryInterface(frame, GUIDs[i], (void**)&object);
if (SUCCEEDED(hr))
{
LoadProc(object, GUIDs[i], ArgLP);
IDirect3DRMObject_Release(object);
}
}
IDirect3DRMFrame3_Release(frame);
}
if (FAILED(hr))
ERR("Cannot process frame\n");
}
}
else if (IsEqualGUID(guid, &TID_D3DRMMaterial))
{
TRACE("Found TID_D3DRMMaterial\n");
/* Cannot be requested so nothing to do */
}
else if (IsEqualGUID(guid, &TID_D3DRMFrameTransformMatrix))
{
TRACE("Found TID_D3DRMFrameTransformMatrix\n");
/* Cannot be requested */
if (parent_frame)
{
D3DRMMATRIX4D matrix;
DWORD size;
TRACE("Load Frame Transform Matrix data\n");
size = sizeof(matrix);
hr = IDirectXFileData_GetData(data_object, NULL, &size, (void**)matrix);
if ((hr != DXFILE_OK) || (size != sizeof(matrix)))
goto end;
hr = IDirect3DRMFrame3_AddTransform(parent_frame, D3DRMCOMBINE_REPLACE, matrix);
if (FAILED(hr))
goto end;
}
}
else
{
FIXME("Found unknown TID %s\n", debugstr_guid(guid));
}
ret = D3DRM_OK;
end:
return ret;
}
2013-04-22 15:18:44 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_Load(IDirect3DRM3 *iface, void *source, void *object_id, IID **iids,
DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame3 *parent_frame)
2011-12-29 02:26:40 +01:00
{
DXFILELOADOPTIONS load_options;
2013-08-19 10:50:53 +02:00
IDirectXFile *file = NULL;
2013-08-19 10:50:54 +02:00
IDirectXFileEnumObject *enum_object = NULL;
2013-08-20 10:20:12 +02:00
IDirectXFileData *data = NULL;
HRESULT hr;
const GUID* pGuid;
DWORD size;
Header* pHeader;
HRESULT ret = D3DRMERR_BADOBJECT;
DWORD i;
2013-04-22 15:18:44 +02:00
TRACE("iface %p, source %p, object_id %p, iids %p, iid_count %u, flags %#x, "
"load_cb %p, load_ctx %p, load_tex_cb %p, load_tex_ctx %p, parent_frame %p.\n",
iface, source, object_id, iids, iid_count, flags,
load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
2011-12-29 02:26:40 +01:00
TRACE("Looking for GUIDs:\n");
2013-04-22 15:18:44 +02:00
for (i = 0; i < iid_count; ++i)
TRACE("- %s (%s)\n", debugstr_guid(iids[i]), get_IID_string(iids[i]));
2013-04-22 15:18:44 +02:00
if (flags == D3DRMLOAD_FROMMEMORY)
{
load_options = DXFILELOAD_FROMMEMORY;
}
2013-04-22 15:18:44 +02:00
else if (flags == D3DRMLOAD_FROMFILE)
{
load_options = DXFILELOAD_FROMFILE;
2013-04-22 15:18:44 +02:00
TRACE("Loading from file %s\n", debugstr_a(source));
}
else
{
2013-04-22 15:18:44 +02:00
FIXME("Load options %#x not supported yet.\n", flags);
return E_NOTIMPL;
}
2013-08-19 10:50:53 +02:00
hr = DirectXFileCreate(&file);
if (hr != DXFILE_OK)
goto end;
2013-08-19 10:50:53 +02:00
hr = IDirectXFile_RegisterTemplates(file, templates, strlen(templates));
if (hr != DXFILE_OK)
goto end;
2013-08-19 10:50:54 +02:00
hr = IDirectXFile_CreateEnumObject(file, source, load_options, &enum_object);
if (hr != DXFILE_OK)
goto end;
2013-08-20 10:20:12 +02:00
hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data);
if (hr != DXFILE_OK)
goto end;
2013-08-20 10:20:12 +02:00
hr = IDirectXFileData_GetType(data, &pGuid);
if (hr != DXFILE_OK)
goto end;
TRACE("Found object type whose GUID = %s\n", debugstr_guid(pGuid));
if (!IsEqualGUID(pGuid, &TID_DXFILEHeader))
{
ret = D3DRMERR_BADFILE;
goto end;
}
2013-08-20 10:20:12 +02:00
hr = IDirectXFileData_GetData(data, NULL, &size, (void **)&pHeader);
if ((hr != DXFILE_OK) || (size != sizeof(Header)))
goto end;
TRACE("Version is %d %d %d\n", pHeader->major, pHeader->minor, pHeader->flags);
/* Version must be 1.0.x */
if ((pHeader->major != 1) || (pHeader->minor != 0))
{
ret = D3DRMERR_BADFILE;
goto end;
}
2013-08-20 10:20:12 +02:00
IDirectXFileData_Release(data);
data = NULL;
while (1)
{
2013-08-20 10:20:12 +02:00
hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data);
if (hr == DXFILEERR_NOMOREOBJECTS)
{
TRACE("No more object\n");
break;
}
else if (hr != DXFILE_OK)
{
2012-12-17 10:11:51 +01:00
ret = D3DRMERR_BADFILE;
goto end;
}
2013-08-20 10:20:12 +02:00
ret = load_data(iface, data, iids, iid_count, load_cb, load_ctx, load_tex_cb, load_tex_ctx, parent_frame);
if (ret != D3DRM_OK)
goto end;
2013-08-20 10:20:12 +02:00
IDirectXFileData_Release(data);
data = NULL;
}
ret = D3DRM_OK;
end:
2013-08-20 10:20:12 +02:00
if (data)
IDirectXFileData_Release(data);
2013-08-19 10:50:54 +02:00
if (enum_object)
IDirectXFileEnumObject_Release(enum_object);
2013-08-19 10:50:53 +02:00
if (file)
IDirectXFile_Release(file);
return ret;
2011-12-29 02:26:40 +01:00
}
static HRESULT WINAPI IDirect3DRM3Impl_Tick(IDirect3DRM3* iface, D3DVALUE tick)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%f): stub\n", iface, This, tick);
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM3Impl_CreateProgressiveMesh(IDirect3DRM3 *iface, IDirect3DRMProgressiveMesh **mesh)
2011-12-29 02:26:40 +01:00
{
FIXME("iface %p, mesh %p stub!\n", iface, mesh);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
2013-09-10 09:32:35 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_RegisterClient(IDirect3DRM3 *iface, REFGUID guid, DWORD *id)
2011-12-29 02:26:40 +01:00
{
2013-09-10 09:32:35 +02:00
FIXME("iface %p, guid %s, id %p stub!\n", iface, debugstr_guid(guid), id);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM3Impl_UnregisterClient(IDirect3DRM3* iface, REFGUID rguid)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%s): stub\n", iface, This, debugstr_guid(rguid));
return E_NOTIMPL;
}
2013-04-22 15:18:45 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_CreateClippedVisual(IDirect3DRM3 *iface,
IDirect3DRMVisual *visual, IDirect3DRMClippedVisual **clipped_visual)
2011-12-29 02:26:40 +01:00
{
2013-04-22 15:18:45 +02:00
FIXME("iface %p, visual %p, clipped_visual %p stub!\n", iface, visual, clipped_visual);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
static HRESULT WINAPI IDirect3DRM3Impl_SetOptions(IDirect3DRM3* iface, DWORD opt)
{
IDirect3DRMImpl *This = impl_from_IDirect3DRM3(iface);
FIXME("(%p/%p)->(%d): stub\n", iface, This, opt);
return E_NOTIMPL;
}
2013-09-10 09:32:35 +02:00
static HRESULT WINAPI IDirect3DRM3Impl_GetOptions(IDirect3DRM3 *iface, DWORD *flags)
2011-12-29 02:26:40 +01:00
{
2013-09-10 09:32:35 +02:00
FIXME("iface %p, flags %p stub!\n", iface, flags);
2011-12-29 02:26:40 +01:00
return E_NOTIMPL;
}
static const struct IDirect3DRM3Vtbl Direct3DRM3_Vtbl =
{
IDirect3DRM3Impl_QueryInterface,
IDirect3DRM3Impl_AddRef,
IDirect3DRM3Impl_Release,
IDirect3DRM3Impl_CreateObject,
IDirect3DRM3Impl_CreateFrame,
IDirect3DRM3Impl_CreateMesh,
IDirect3DRM3Impl_CreateMeshBuilder,
IDirect3DRM3Impl_CreateFace,
IDirect3DRM3Impl_CreateAnimation,
IDirect3DRM3Impl_CreateAnimationSet,
IDirect3DRM3Impl_CreateTexture,
IDirect3DRM3Impl_CreateLight,
IDirect3DRM3Impl_CreateLightRGB,
IDirect3DRM3Impl_CreateMaterial,
2011-12-29 02:26:40 +01:00
IDirect3DRM3Impl_CreateDevice,
IDirect3DRM3Impl_CreateDeviceFromSurface,
IDirect3DRM3Impl_CreateDeviceFromD3D,
IDirect3DRM3Impl_CreateDeviceFromClipper,
IDirect3DRM3Impl_CreateTextureFromSurface,
IDirect3DRM3Impl_CreateShadow,
IDirect3DRM3Impl_CreateViewport,
IDirect3DRM3Impl_CreateWrap,
IDirect3DRM3Impl_CreateUserVisual,
IDirect3DRM3Impl_LoadTexture,
IDirect3DRM3Impl_LoadTextureFromResource,
IDirect3DRM3Impl_SetSearchPath,
IDirect3DRM3Impl_AddSearchPath,
IDirect3DRM3Impl_GetSearchPath,
IDirect3DRM3Impl_SetDefaultTextureColors,
IDirect3DRM3Impl_SetDefaultTextureShades,
IDirect3DRM3Impl_GetDevices,
IDirect3DRM3Impl_GetNamedObject,
IDirect3DRM3Impl_EnumerateObjects,
IDirect3DRM3Impl_Load,
IDirect3DRM3Impl_Tick,
IDirect3DRM3Impl_CreateProgressiveMesh,
IDirect3DRM3Impl_RegisterClient,
IDirect3DRM3Impl_UnregisterClient,
IDirect3DRM3Impl_CreateClippedVisual,
IDirect3DRM3Impl_SetOptions,
IDirect3DRM3Impl_GetOptions
};
2013-04-15 08:14:53 +02:00
HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
{
2013-04-15 08:14:53 +02:00
IDirect3DRMImpl *object;
2013-04-15 08:14:53 +02:00
TRACE("d3drm %p.\n", d3drm);
2013-04-15 08:14:53 +02:00
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRM_iface.lpVtbl = &Direct3DRM_Vtbl;
object->IDirect3DRM2_iface.lpVtbl = &Direct3DRM2_Vtbl;
object->IDirect3DRM3_iface.lpVtbl = &Direct3DRM3_Vtbl;
object->ref = 1;
2013-04-15 08:14:53 +02:00
*d3drm = &object->IDirect3DRM_iface;
return S_OK;
}