2010-01-07 22:43:25 +01:00
|
|
|
/*
|
|
|
|
* Implementation of IDirect3DRM Interface
|
|
|
|
*
|
2012-05-15 08:08:40 +02:00
|
|
|
* Copyright 2010, 2012 Christian Costa
|
2011-12-29 02:26:40 +01:00
|
|
|
* Copyright 2011 André Hentschel
|
2016-03-21 17:06:45 +01:00
|
|
|
* Copyright 2016 Aaryaman Vasishta
|
2010-01-07 22:43:25 +01:00
|
|
|
*
|
|
|
|
* 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"
|
2012-03-26 22:35:21 +02:00
|
|
|
#include "dxfile.h"
|
|
|
|
#include "rmxfguid.h"
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
#include "d3drm_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
|
|
|
|
|
2012-03-26 22:35:21 +02:00
|
|
|
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 "?";
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:01 +02:00
|
|
|
static HRESULT d3drm_create_texture_object(void **object, IDirect3DRM *d3drm)
|
|
|
|
{
|
|
|
|
struct d3drm_texture *texture;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (FAILED(hr = d3drm_texture_create(&texture, d3drm)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*object = &texture->IDirect3DRMTexture_iface;
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm
|
|
|
|
{
|
2010-11-29 00:55:07 +01:00
|
|
|
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;
|
2015-04-30 10:41:39 +02:00
|
|
|
LONG ref1, ref2, ref3, iface_count;
|
2013-10-06 17:33:07 +02:00
|
|
|
};
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static inline struct d3drm *impl_from_IDirect3DRM(IDirect3DRM *iface)
|
2010-11-29 00:55:07 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3drm, IDirect3DRM_iface);
|
2010-11-29 00:55:07 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static inline struct d3drm *impl_from_IDirect3DRM2(IDirect3DRM2 *iface)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3drm, IDirect3DRM2_iface);
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
return CONTAINING_RECORD(iface, struct d3drm, IDirect3DRM3_iface);
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
static void d3drm_destroy(struct d3drm *d3drm)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, d3drm);
|
|
|
|
TRACE("d3drm object %p is being destroyed.\n", d3drm);
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_QueryInterface(IDirect3DRM *iface, REFIID riid, void **out)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
if (IsEqualGUID(riid, &IID_IDirect3DRM)
|
|
|
|
|| IsEqualGUID(riid, &IID_IUnknown))
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
*out = &d3drm->IDirect3DRM_iface;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
2013-10-06 17:33:07 +02:00
|
|
|
else if (IsEqualGUID(riid, &IID_IDirect3DRM2))
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
*out = &d3drm->IDirect3DRM2_iface;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
2013-10-06 17:33:07 +02:00
|
|
|
else if (IsEqualGUID(riid, &IID_IDirect3DRM3))
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
*out = &d3drm->IDirect3DRM3_iface;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
2011-12-27 23:16:10 +01:00
|
|
|
else
|
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
*out = NULL;
|
2015-03-18 13:52:38 +01:00
|
|
|
WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid));
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
IUnknown_AddRef((IUnknown *)*out);
|
2011-12-27 23:16:10 +01:00
|
|
|
return S_OK;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static ULONG WINAPI d3drm1_AddRef(IDirect3DRM *iface)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2015-04-30 10:41:39 +02:00
|
|
|
ULONG refcount = InterlockedIncrement(&d3drm->ref1);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
if (refcount == 1)
|
|
|
|
InterlockedIncrement(&d3drm->iface_count);
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
return refcount;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static ULONG WINAPI d3drm1_Release(IDirect3DRM *iface)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2015-04-30 10:41:39 +02:00
|
|
|
ULONG refcount = InterlockedDecrement(&d3drm->ref1);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
if (!refcount && !InterlockedDecrement(&d3drm->iface_count))
|
|
|
|
d3drm_destroy(d3drm);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
return refcount;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateObject(IDirect3DRM *iface,
|
2013-08-20 10:20:13 +02:00
|
|
|
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2016-04-20 16:52:09 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
|
2013-08-20 10:20:13 +02:00
|
|
|
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-04-20 16:52:09 +02:00
|
|
|
return IDirect3DRM3_CreateObject(&d3drm->IDirect3DRM3_iface, clsid, outer, iid, out);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateFrame(IDirect3DRM *iface,
|
2013-04-19 08:34:15 +02:00
|
|
|
IDirect3DRMFrame *parent_frame, IDirect3DRMFrame **frame)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2016-06-19 21:28:08 +02:00
|
|
|
struct d3drm_frame *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-04-19 08:34:15 +02:00
|
|
|
TRACE("iface %p, parent_frame %p, frame %p.\n", iface, parent_frame, frame);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-06-19 21:28:08 +02:00
|
|
|
if (FAILED(hr = d3drm_frame_create(&object, (IUnknown *)parent_frame, iface)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*frame = &object->IDirect3DRMFrame_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateMesh(IDirect3DRM *iface, IDirect3DRMMesh **mesh)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-04-22 15:18:46 +02:00
|
|
|
TRACE("iface %p, mesh %p.\n", iface, mesh);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-04-22 15:18:46 +02:00
|
|
|
return IDirect3DRM3_CreateMesh(&d3drm->IDirect3DRM3_iface, mesh);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateMeshBuilder(IDirect3DRM *iface, IDirect3DRMMeshBuilder **mesh_builder)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-04-23 13:21:32 +02:00
|
|
|
TRACE("iface %p, mesh_builder %p.\n", iface, mesh_builder);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-04-23 13:21:32 +02:00
|
|
|
return Direct3DRMMeshBuilder_create(&IID_IDirect3DRMMeshBuilder, (IUnknown **)mesh_builder);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateFace(IDirect3DRM *iface, IDirect3DRMFace **face)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-05-09 14:43:12 +02:00
|
|
|
TRACE("iface %p, face %p.\n", iface, face);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-05-09 14:43:39 +02:00
|
|
|
return Direct3DRMFace_create(&IID_IDirect3DRMFace, (IUnknown **)face);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateAnimation(IDirect3DRM *iface, IDirect3DRMAnimation **animation)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-05-30 10:05:35 +02:00
|
|
|
FIXME("iface %p, animation %p stub!\n", iface, animation);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateAnimationSet(IDirect3DRM *iface, IDirect3DRMAnimationSet **set)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-05-30 22:34:18 +02:00
|
|
|
FIXME("iface %p, set %p stub!\n", iface, set);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateTexture(IDirect3DRM *iface,
|
2013-01-28 11:15:36 +01:00
|
|
|
D3DRMIMAGE *image, IDirect3DRMTexture **texture)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2016-05-20 23:07:41 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
|
|
|
IDirect3DRMTexture3 *texture3;
|
2016-03-21 17:06:45 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
if (!texture)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DRM3_CreateTexture(&d3drm->IDirect3DRM3_iface, image, &texture3)))
|
|
|
|
{
|
|
|
|
*texture = NULL;
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
2016-05-20 23:07:41 +02:00
|
|
|
}
|
2016-03-21 17:06:45 +01:00
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture, (void **)texture);
|
|
|
|
IDirect3DRMTexture3_Release(texture3);
|
2016-03-21 17:06:45 +01:00
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
return hr;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateLight(IDirect3DRM *iface,
|
2013-04-25 09:59:46 +02:00
|
|
|
D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2010-01-07 22:43:25 +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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-04-25 09:59:46 +02:00
|
|
|
return IDirect3DRM3_CreateLight(&d3drm->IDirect3DRM3_iface, type, color, light);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateLightRGB(IDirect3DRM *iface, D3DRMLIGHTTYPE type,
|
2013-04-25 09:59:46 +02:00
|
|
|
D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2010-01-07 22:43:25 +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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-04-25 09:59:46 +02:00
|
|
|
return IDirect3DRM3_CreateLightRGB(&d3drm->IDirect3DRM3_iface, type, red, green, blue, light);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateMaterial(IDirect3DRM *iface,
|
2013-05-28 08:55:21 +02:00
|
|
|
D3DVALUE power, IDirect3DRMMaterial **material)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-05-28 08:55:21 +02:00
|
|
|
TRACE("iface %p, power %.8e, material %p.\n", iface, power, material);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-05-28 08:55:21 +02:00
|
|
|
return IDirect3DRM3_CreateMaterial(&d3drm->IDirect3DRM3_iface, power, (IDirect3DRMMaterial2 **)material);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateDevice(IDirect3DRM *iface,
|
2013-04-17 08:48:01 +02:00
|
|
|
DWORD width, DWORD height, IDirect3DRMDevice **device)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
|
|
|
HRESULT hr;
|
2016-07-12 19:07:24 +02:00
|
|
|
|
2013-04-17 08:48:01 +02:00
|
|
|
FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, iface)))
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
|
|
|
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice_iface;
|
2015-08-06 23:47:51 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateDeviceFromSurface(IDirect3DRM *iface, GUID *guid,
|
|
|
|
IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, IDirect3DRMDevice **device)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
|
|
|
HRESULT hr;
|
2015-08-06 23:47:57 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, debugstr_guid(guid), ddraw, backbuffer, device);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2015-08-06 23:47:57 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
|
|
|
|
if (!backbuffer || !ddraw)
|
|
|
|
return D3DRMERR_BADDEVICE;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, iface)))
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (SUCCEEDED(hr = d3drm_device_init(object, 1, ddraw, backbuffer, TRUE)))
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice_iface;
|
2015-08-06 23:47:57 +02:00
|
|
|
else
|
|
|
|
d3drm_device_destroy(object);
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-06 23:47:57 +02:00
|
|
|
return hr;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateDeviceFromD3D(IDirect3DRM *iface,
|
|
|
|
IDirect3D *d3d, IDirect3DDevice *d3d_device, IDirect3DRMDevice **device)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
|
|
|
HRESULT hr;
|
2015-08-20 16:46:39 +02:00
|
|
|
TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, d3d, d3d_device, device);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2015-08-20 16:46:39 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
if (!d3d || !d3d_device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, iface)))
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_set_ddraw_device_d3d(object, d3d, d3d_device)))
|
2015-08-20 16:46:39 +02:00
|
|
|
{
|
|
|
|
d3drm_device_destroy(object);
|
|
|
|
return hr;
|
|
|
|
}
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice_iface;
|
2015-08-06 23:47:51 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateDeviceFromClipper(IDirect3DRM *iface,
|
|
|
|
IDirectDrawClipper *clipper, GUID *guid, int width, int height,
|
|
|
|
IDirect3DRMDevice **device)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
2015-08-06 23:47:53 +02:00
|
|
|
IDirectDraw *ddraw;
|
|
|
|
IDirectDrawSurface *render_target;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-06 23:47:53 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, clipper, debugstr_guid(guid), width, height, device);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2015-08-06 23:47:53 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
|
|
|
|
if (!clipper || !width || !height)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
hr = DirectDrawCreate(NULL, &ddraw, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, iface)))
|
2015-08-06 23:47:53 +02:00
|
|
|
{
|
|
|
|
IDirectDraw_Release(ddraw);
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
2015-08-06 23:47:53 +02:00
|
|
|
}
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-06 23:47:53 +02:00
|
|
|
hr = d3drm_device_create_surfaces_from_clipper(object, ddraw, clipper, width, height, &render_target);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IDirectDraw_Release(ddraw);
|
|
|
|
d3drm_device_destroy(object);
|
|
|
|
return hr;
|
|
|
|
}
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
hr = d3drm_device_init(object, 1, ddraw, render_target, TRUE);
|
2015-08-06 23:47:53 +02:00
|
|
|
IDirectDraw_Release(ddraw);
|
|
|
|
IDirectDrawSurface_Release(render_target);
|
|
|
|
if (FAILED(hr))
|
|
|
|
d3drm_device_destroy(object);
|
|
|
|
else
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice_iface;
|
2015-08-06 23:47:53 +02:00
|
|
|
|
|
|
|
return hr;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateTextureFromSurface(IDirect3DRM *iface,
|
|
|
|
IDirectDrawSurface *surface, IDirect3DRMTexture **texture)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, surface %p, texture %p stub!\n", iface, surface, texture);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateShadow(IDirect3DRM *iface, IDirect3DRMVisual *visual,
|
2013-04-22 15:18:45 +02:00
|
|
|
IDirect3DRMLight *light, D3DVALUE px, D3DVALUE py, D3DVALUE pz, D3DVALUE nx, D3DVALUE ny, D3DVALUE nz,
|
|
|
|
IDirect3DRMVisual **shadow)
|
2010-01-07 22:43:25 +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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateViewport(IDirect3DRM *iface, IDirect3DRMDevice *device,
|
2013-04-17 08:48:01 +02:00
|
|
|
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2016-06-19 21:28:09 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
|
|
|
|
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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
return IDirect3DRM2_CreateViewport(&d3drm->IDirect3DRM2_iface, device, camera, x, y, width, height, viewport);
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateWrap(IDirect3DRM *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
|
2013-04-19 08:34:15 +02:00
|
|
|
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)
|
2010-01-07 22:43:25 +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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_CreateUserVisual(IDirect3DRM *iface,
|
2013-06-03 09:19:36 +02:00
|
|
|
D3DRMUSERVISUALCALLBACK cb, void *ctx, IDirect3DRMUserVisual **visual)
|
2010-01-07 22:43:25 +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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface,
|
2013-05-27 09:22:51 +02:00
|
|
|
const char *filename, IDirect3DRMTexture **texture)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-05-27 09:22:51 +02:00
|
|
|
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_LoadTextureFromResource(IDirect3DRM *iface,
|
2013-05-27 09:22:51 +02:00
|
|
|
HRSRC resource, IDirect3DRMTexture **texture)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-05-27 09:22:51 +02:00
|
|
|
FIXME("iface %p, resource %p, texture %p stub!\n", iface, resource, texture);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_SetSearchPath(IDirect3DRM *iface, const char *path)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-09-06 09:57:43 +02:00
|
|
|
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_AddSearchPath(IDirect3DRM *iface, const char *path)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-09-06 09:57:43 +02:00
|
|
|
FIXME("iface %p, path %s stub!\n", iface, debugstr_a(path));
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_GetSearchPath(IDirect3DRM *iface, DWORD *size, char *path)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-09-09 10:26:20 +02:00
|
|
|
FIXME("iface %p, size %p, path %p stub!\n", iface, size, path);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_SetDefaultTextureColors(IDirect3DRM *iface, DWORD color_count)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, color_count %u stub!\n", iface, color_count);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_SetDefaultTextureShades(IDirect3DRM *iface, DWORD shade_count)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, shade_count %u stub!\n", iface, shade_count);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_GetDevices(IDirect3DRM *iface, IDirect3DRMDeviceArray **array)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-06-04 09:57:09 +02:00
|
|
|
FIXME("iface %p, array %p stub!\n", iface, array);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_GetNamedObject(IDirect3DRM *iface,
|
2013-04-17 08:48:00 +02:00
|
|
|
const char *name, IDirect3DRMObject **object)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-04-17 08:48:00 +02:00
|
|
|
FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_EnumerateObjects(IDirect3DRM *iface, D3DRMOBJECTCALLBACK cb, void *ctx)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-09-09 10:26:21 +02:00
|
|
|
FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_Load(IDirect3DRM *iface, void *source, void *object_id, IID **iids,
|
2013-04-19 08:34:15 +02:00
|
|
|
DWORD iid_count, D3DRMLOADOPTIONS flags, D3DRMLOADCALLBACK load_cb, void *load_ctx,
|
|
|
|
D3DRMLOADTEXTURECALLBACK load_tex_cb, void *load_tex_ctx, IDirect3DRMFrame *parent_frame)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
|
2013-04-19 08:34:15 +02:00
|
|
|
IDirect3DRMFrame3 *parent_frame3 = NULL;
|
2012-03-26 22:35:21 +02:00
|
|
|
HRESULT hr = D3DRM_OK;
|
2010-01-07 22:43:25 +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);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
2013-04-19 08:34:15 +02:00
|
|
|
if (parent_frame)
|
|
|
|
hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&parent_frame3);
|
2012-03-26 22:35:21 +02:00
|
|
|
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);
|
2012-03-26 22:35:21 +02:00
|
|
|
|
|
|
|
return hr;
|
2010-01-07 22:43:25 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm1_Tick(IDirect3DRM *iface, D3DVALUE tick)
|
2010-01-07 22:43:25 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, tick %.8e stub!\n", iface, tick);
|
2010-01-07 22:43:25 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static const struct IDirect3DRMVtbl d3drm1_vtbl =
|
|
|
|
{
|
|
|
|
d3drm1_QueryInterface,
|
|
|
|
d3drm1_AddRef,
|
|
|
|
d3drm1_Release,
|
|
|
|
d3drm1_CreateObject,
|
|
|
|
d3drm1_CreateFrame,
|
|
|
|
d3drm1_CreateMesh,
|
|
|
|
d3drm1_CreateMeshBuilder,
|
|
|
|
d3drm1_CreateFace,
|
|
|
|
d3drm1_CreateAnimation,
|
|
|
|
d3drm1_CreateAnimationSet,
|
|
|
|
d3drm1_CreateTexture,
|
|
|
|
d3drm1_CreateLight,
|
|
|
|
d3drm1_CreateLightRGB,
|
|
|
|
d3drm1_CreateMaterial,
|
|
|
|
d3drm1_CreateDevice,
|
|
|
|
d3drm1_CreateDeviceFromSurface,
|
|
|
|
d3drm1_CreateDeviceFromD3D,
|
|
|
|
d3drm1_CreateDeviceFromClipper,
|
|
|
|
d3drm1_CreateTextureFromSurface,
|
|
|
|
d3drm1_CreateShadow,
|
|
|
|
d3drm1_CreateViewport,
|
|
|
|
d3drm1_CreateWrap,
|
|
|
|
d3drm1_CreateUserVisual,
|
|
|
|
d3drm1_LoadTexture,
|
|
|
|
d3drm1_LoadTextureFromResource,
|
|
|
|
d3drm1_SetSearchPath,
|
|
|
|
d3drm1_AddSearchPath,
|
|
|
|
d3drm1_GetSearchPath,
|
|
|
|
d3drm1_SetDefaultTextureColors,
|
|
|
|
d3drm1_SetDefaultTextureShades,
|
|
|
|
d3drm1_GetDevices,
|
|
|
|
d3drm1_GetNamedObject,
|
|
|
|
d3drm1_EnumerateObjects,
|
|
|
|
d3drm1_Load,
|
|
|
|
d3drm1_Tick,
|
2010-01-07 22:43:25 +01:00
|
|
|
};
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_QueryInterface(IDirect3DRM2 *iface, REFIID riid, void **out)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
|
|
|
|
return d3drm1_QueryInterface(&d3drm->IDirect3DRM_iface, riid, out);
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static ULONG WINAPI d3drm2_AddRef(IDirect3DRM2 *iface)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2015-04-30 10:41:39 +02:00
|
|
|
ULONG refcount = InterlockedIncrement(&d3drm->ref2);
|
|
|
|
|
|
|
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
|
|
|
|
|
|
|
if (refcount == 1)
|
|
|
|
InterlockedIncrement(&d3drm->iface_count);
|
2013-10-06 17:33:07 +02:00
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
return refcount;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static ULONG WINAPI d3drm2_Release(IDirect3DRM2 *iface)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2015-04-30 10:41:39 +02:00
|
|
|
ULONG refcount = InterlockedDecrement(&d3drm->ref2);
|
|
|
|
|
|
|
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
2013-10-06 17:33:07 +02:00
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
if (!refcount && !InterlockedDecrement(&d3drm->iface_count))
|
|
|
|
d3drm_destroy(d3drm);
|
|
|
|
|
|
|
|
return refcount;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateObject(IDirect3DRM2 *iface,
|
2013-08-20 10:20:13 +02:00
|
|
|
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-04-20 16:52:09 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
|
|
|
|
TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
|
2013-08-20 10:20:13 +02:00
|
|
|
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2016-04-20 16:52:09 +02:00
|
|
|
return IDirect3DRM3_CreateObject(&d3drm->IDirect3DRM3_iface, clsid, outer, iid, out);
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateFrame(IDirect3DRM2 *iface,
|
2013-04-19 08:34:15 +02:00
|
|
|
IDirect3DRMFrame *parent_frame, IDirect3DRMFrame2 **frame)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-06-19 21:28:08 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
struct d3drm_frame *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
TRACE("iface %p, parent_frame %p, frame %p.\n", iface, parent_frame, frame);
|
2011-12-30 16:42:59 +01:00
|
|
|
|
2016-06-19 21:28:08 +02:00
|
|
|
if (FAILED(hr = d3drm_frame_create(&object, (IUnknown *)parent_frame, &d3drm->IDirect3DRM_iface)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*frame = &object->IDirect3DRMFrame2_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateMesh(IDirect3DRM2 *iface, IDirect3DRMMesh **mesh)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateTexture(IDirect3DRM2 *iface,
|
2013-01-28 11:15:36 +01:00
|
|
|
D3DRMIMAGE *image, IDirect3DRMTexture2 **texture)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2016-05-20 23:07:41 +02:00
|
|
|
IDirect3DRMTexture3 *texture3;
|
2016-03-21 17:06:45 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
if (!texture)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
if (FAILED(hr = IDirect3DRM3_CreateTexture(&d3drm->IDirect3DRM3_iface, image, &texture3)))
|
|
|
|
{
|
|
|
|
*texture = NULL;
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
2016-05-20 23:07:41 +02:00
|
|
|
}
|
2016-03-21 17:06:45 +01:00
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void **)texture);
|
|
|
|
IDirect3DRMTexture3_Release(texture3);
|
2016-03-21 17:06:45 +01:00
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateLight(IDirect3DRM2 *iface,
|
2013-04-25 09:59:46 +02:00
|
|
|
D3DRMLIGHTTYPE type, D3DCOLOR color, IDirect3DRMLight **light)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateLightRGB(IDirect3DRM2 *iface, D3DRMLIGHTTYPE type,
|
2013-04-25 09:59:46 +02:00
|
|
|
D3DVALUE red, D3DVALUE green, D3DVALUE blue, IDirect3DRMLight **light)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateMaterial(IDirect3DRM2 *iface,
|
2013-05-28 08:55:21 +02:00
|
|
|
D3DVALUE power, IDirect3DRMMaterial **material)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateDevice(IDirect3DRM2 *iface,
|
2013-04-18 09:35:14 +02:00
|
|
|
DWORD width, DWORD height, IDirect3DRMDevice2 **device)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-07-12 19:07:24 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
|
|
|
HRESULT hr;
|
2016-07-12 19:07:24 +02:00
|
|
|
|
2015-08-06 23:47:51 +02:00
|
|
|
FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device);
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface)))
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice2_iface;
|
2015-08-06 23:47:51 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateDeviceFromSurface(IDirect3DRM2 *iface, GUID *guid,
|
|
|
|
IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, IDirect3DRMDevice2 **device)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2015-08-06 23:47:58 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
IDirect3DRMDevice3 *device3;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-06 23:47:58 +02:00
|
|
|
TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, debugstr_guid(guid), ddraw, backbuffer, device);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2015-08-06 23:47:58 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
hr = IDirect3DRM3_CreateDeviceFromSurface(&d3drm->IDirect3DRM3_iface, guid, ddraw, backbuffer, 0, &device3);
|
2015-08-06 23:47:51 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2015-08-06 23:47:58 +02:00
|
|
|
hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void**)device);
|
|
|
|
IDirect3DRMDevice3_Release(device3);
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-06 23:47:58 +02:00
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateDeviceFromD3D(IDirect3DRM2 *iface,
|
2015-08-20 16:46:40 +02:00
|
|
|
IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice2 **device)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2015-08-20 16:46:40 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
IDirect3D *d3d1;
|
|
|
|
IDirect3DDevice *d3d_device1;
|
|
|
|
IDirect3DRMDevice *device1;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-20 16:46:40 +02:00
|
|
|
TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, d3d, d3d_device, device);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2015-08-20 16:46:40 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
if (!d3d || !d3d_device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
hr = IDirect3D2_QueryInterface(d3d, &IID_IDirect3D, (void **)&d3d1);
|
2015-08-06 23:47:51 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2015-08-20 16:46:40 +02:00
|
|
|
hr = IDirect3DDevice2_QueryInterface(d3d_device, &IID_IDirect3DDevice, (void **)&d3d_device1);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IDirect3D_Release(d3d1);
|
|
|
|
return hr;
|
|
|
|
}
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-20 16:46:40 +02:00
|
|
|
hr = IDirect3DRM_CreateDeviceFromD3D(&d3drm->IDirect3DRM_iface, d3d1, d3d_device1, &device1);
|
|
|
|
IDirect3D_Release(d3d1);
|
|
|
|
IDirect3DDevice_Release(d3d_device1);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice2, (void **)device);
|
|
|
|
IDirect3DRMDevice_Release(device1);
|
|
|
|
|
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateDeviceFromClipper(IDirect3DRM2 *iface,
|
|
|
|
IDirectDrawClipper *clipper, GUID *guid, int width, int height,
|
|
|
|
IDirect3DRMDevice2 **device)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2015-08-06 23:47:55 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
IDirect3DRMDevice3 *device3;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-06 23:47:55 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, clipper, debugstr_guid(guid), width, height, device);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
2015-08-06 23:47:55 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
hr = IDirect3DRM3_CreateDeviceFromClipper(&d3drm->IDirect3DRM3_iface, clipper, guid, width, height, &device3);
|
2015-08-06 23:47:51 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2015-08-06 23:47:55 +02:00
|
|
|
hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void**)device);
|
|
|
|
IDirect3DRMDevice3_Release(device3);
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-06 23:47:55 +02:00
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateTextureFromSurface(IDirect3DRM2 *iface,
|
|
|
|
IDirectDrawSurface *surface, IDirect3DRMTexture2 **texture)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, surface %p, texture %p stub!\n", iface, surface, texture);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateShadow(IDirect3DRM2 *iface, IDirect3DRMVisual *visual,
|
2013-04-22 15:18:45 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateViewport(IDirect3DRM2 *iface, IDirect3DRMDevice *device,
|
2013-04-17 08:48:01 +02:00
|
|
|
IDirect3DRMFrame *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport **viewport)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-06-19 21:28:09 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
|
|
|
struct d3drm_viewport *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
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
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
if (FAILED(hr = d3drm_viewport_create(&object, &d3drm->IDirect3DRM_iface)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*viewport = &object->IDirect3DRMViewport_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateWrap(IDirect3DRM2 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame *frame,
|
2013-04-19 08:34:15 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateUserVisual(IDirect3DRM2 *iface,
|
2013-06-03 09:19:36 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface,
|
2013-05-27 09:22:52 +02:00
|
|
|
const char *filename, IDirect3DRMTexture2 **texture)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
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
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture2_iface;
|
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE module,
|
2013-05-27 09:22:52 +02:00
|
|
|
const char *resource_name, const char *resource_type, IDirect3DRMTexture2 **texture)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
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
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture2_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_SetDefaultTextureColors(IDirect3DRM2 *iface, DWORD color_count)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, color_count %u stub!\n", iface, color_count);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_SetDefaultTextureShades(IDirect3DRM2 *iface, DWORD shade_count)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, shade_count %u stub!\n", iface, shade_count);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_GetNamedObject(IDirect3DRM2 *iface,
|
2013-04-17 08:48:00 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_Load(IDirect3DRM2 *iface, void *source, void *object_id, IID **iids,
|
2013-04-19 08:34:15 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
|
2013-04-19 08:34:15 +02:00
|
|
|
IDirect3DRMFrame3 *parent_frame3 = NULL;
|
2012-03-26 22:35:21 +02:00
|
|
|
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);
|
2012-03-26 22:35:21 +02:00
|
|
|
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);
|
2012-03-26 22:35:21 +02:00
|
|
|
|
|
|
|
return hr;
|
2011-12-27 23:16:10 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_Tick(IDirect3DRM2 *iface, D3DVALUE tick)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, tick %.8e stub!\n", iface, tick);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm2_CreateProgressiveMesh(IDirect3DRM2 *iface, IDirect3DRMProgressiveMesh **mesh)
|
2011-12-27 23:16:10 +01:00
|
|
|
{
|
2013-08-16 09:12:32 +02:00
|
|
|
FIXME("iface %p, mesh %p stub!\n", iface, mesh);
|
2011-12-27 23:16:10 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static const struct IDirect3DRM2Vtbl d3drm2_vtbl =
|
|
|
|
{
|
|
|
|
d3drm2_QueryInterface,
|
|
|
|
d3drm2_AddRef,
|
|
|
|
d3drm2_Release,
|
|
|
|
d3drm2_CreateObject,
|
|
|
|
d3drm2_CreateFrame,
|
|
|
|
d3drm2_CreateMesh,
|
|
|
|
d3drm2_CreateMeshBuilder,
|
|
|
|
d3drm2_CreateFace,
|
|
|
|
d3drm2_CreateAnimation,
|
|
|
|
d3drm2_CreateAnimationSet,
|
|
|
|
d3drm2_CreateTexture,
|
|
|
|
d3drm2_CreateLight,
|
|
|
|
d3drm2_CreateLightRGB,
|
|
|
|
d3drm2_CreateMaterial,
|
|
|
|
d3drm2_CreateDevice,
|
|
|
|
d3drm2_CreateDeviceFromSurface,
|
|
|
|
d3drm2_CreateDeviceFromD3D,
|
|
|
|
d3drm2_CreateDeviceFromClipper,
|
|
|
|
d3drm2_CreateTextureFromSurface,
|
|
|
|
d3drm2_CreateShadow,
|
|
|
|
d3drm2_CreateViewport,
|
|
|
|
d3drm2_CreateWrap,
|
|
|
|
d3drm2_CreateUserVisual,
|
|
|
|
d3drm2_LoadTexture,
|
|
|
|
d3drm2_LoadTextureFromResource,
|
|
|
|
d3drm2_SetSearchPath,
|
|
|
|
d3drm2_AddSearchPath,
|
|
|
|
d3drm2_GetSearchPath,
|
|
|
|
d3drm2_SetDefaultTextureColors,
|
|
|
|
d3drm2_SetDefaultTextureShades,
|
|
|
|
d3drm2_GetDevices,
|
|
|
|
d3drm2_GetNamedObject,
|
|
|
|
d3drm2_EnumerateObjects,
|
|
|
|
d3drm2_Load,
|
|
|
|
d3drm2_Tick,
|
|
|
|
d3drm2_CreateProgressiveMesh,
|
2011-12-27 23:16:10 +01:00
|
|
|
};
|
2011-12-29 02:26:40 +01:00
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_QueryInterface(IDirect3DRM3 *iface, REFIID riid, void **out)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
|
|
|
|
|
|
|
return d3drm1_QueryInterface(&d3drm->IDirect3DRM_iface, riid, out);
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static ULONG WINAPI d3drm3_AddRef(IDirect3DRM3 *iface)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2015-04-30 10:41:39 +02:00
|
|
|
ULONG refcount = InterlockedIncrement(&d3drm->ref3);
|
|
|
|
|
|
|
|
TRACE("%p increasing refcount to %u.\n", iface, refcount);
|
|
|
|
|
|
|
|
if (refcount == 1)
|
|
|
|
InterlockedIncrement(&d3drm->iface_count);
|
2013-10-06 17:33:07 +02:00
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
return refcount;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static ULONG WINAPI d3drm3_Release(IDirect3DRM3 *iface)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2015-04-30 10:41:39 +02:00
|
|
|
ULONG refcount = InterlockedDecrement(&d3drm->ref3);
|
|
|
|
|
|
|
|
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
|
2013-10-06 17:33:07 +02:00
|
|
|
|
2015-04-30 10:41:39 +02:00
|
|
|
if (!refcount && !InterlockedDecrement(&d3drm->iface_count))
|
|
|
|
d3drm_destroy(d3drm);
|
|
|
|
|
|
|
|
return refcount;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface,
|
2013-08-20 10:20:13 +02:00
|
|
|
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2016-04-20 16:52:09 +02:00
|
|
|
IUnknown *object;
|
2016-06-29 15:39:01 +02:00
|
|
|
unsigned int i;
|
2016-04-20 16:52:09 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
2016-06-29 15:39:01 +02:00
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const CLSID *clsid;
|
|
|
|
HRESULT (*create_object)(void **object, IDirect3DRM *d3drm);
|
|
|
|
}
|
|
|
|
object_table[] =
|
|
|
|
{
|
|
|
|
{&CLSID_CDirect3DRMTexture, d3drm_create_texture_object},
|
|
|
|
};
|
|
|
|
|
2016-04-20 16:52:09 +02:00
|
|
|
TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
|
2013-08-20 10:20:13 +02:00
|
|
|
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
2016-04-20 16:52:09 +02:00
|
|
|
if (!out)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
if (!clsid || !iid)
|
|
|
|
{
|
|
|
|
*out = NULL;
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (outer)
|
|
|
|
{
|
|
|
|
FIXME("COM aggregation for outer IUnknown (%p) not implemented. Returning E_NOTIMPL.\n", outer);
|
|
|
|
*out = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-06-29 15:39:01 +02:00
|
|
|
for (i = 0; i < ARRAY_SIZE(object_table); ++i)
|
2016-04-20 16:52:09 +02:00
|
|
|
{
|
2016-06-29 15:39:01 +02:00
|
|
|
if (IsEqualGUID(clsid, object_table[i].clsid))
|
2016-04-20 16:52:09 +02:00
|
|
|
{
|
2016-06-29 15:39:01 +02:00
|
|
|
if (FAILED(hr = object_table[i].create_object((void **)&object, &d3drm->IDirect3DRM_iface)))
|
|
|
|
{
|
|
|
|
*out = NULL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
break;
|
2016-04-20 16:52:09 +02:00
|
|
|
}
|
|
|
|
}
|
2016-06-29 15:39:01 +02:00
|
|
|
if (i == ARRAY_SIZE(object_table))
|
2016-04-20 16:52:09 +02:00
|
|
|
{
|
|
|
|
FIXME("%s not implemented. Returning CLASSFACTORY_E_FIRST.\n", debugstr_guid(clsid));
|
|
|
|
*out = NULL;
|
|
|
|
return CLASSFACTORY_E_FIRST;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr = IUnknown_QueryInterface(object, iid, out)))
|
|
|
|
*out = NULL;
|
|
|
|
IUnknown_Release(object);
|
|
|
|
|
|
|
|
return hr;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateFrame(IDirect3DRM3 *iface,
|
2013-04-22 15:18:44 +02:00
|
|
|
IDirect3DRMFrame3 *parent, IDirect3DRMFrame3 **frame)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-06-19 21:28:08 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
|
|
|
struct d3drm_frame *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2013-04-22 15:18:44 +02:00
|
|
|
TRACE("iface %p, parent %p, frame %p.\n", iface, parent, frame);
|
2012-01-04 19:12:32 +01:00
|
|
|
|
2016-06-19 21:28:08 +02:00
|
|
|
if (FAILED(hr = d3drm_frame_create(&object, (IUnknown *)parent, &d3drm->IDirect3DRM_iface)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*frame = &object->IDirect3DRMFrame3_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRMAnimationSet2 **set)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-05-30 22:34:19 +02:00
|
|
|
FIXME("iface %p, set %p stub!\n", iface, set);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateTexture(IDirect3DRM3 *iface,
|
2013-01-28 11:15:36 +01:00
|
|
|
D3DRMIMAGE *image, IDirect3DRMTexture3 **texture)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
|
|
|
|
|
|
|
|
if (!texture)
|
|
|
|
return D3DRMERR_BADVALUE;
|
2011-12-29 02:26:40 +01:00
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture3_iface;
|
|
|
|
|
2016-05-20 23:07:41 +02:00
|
|
|
if (FAILED(IDirect3DRMTexture3_InitFromImage(*texture, image)))
|
|
|
|
{
|
|
|
|
IDirect3DRMTexture3_Release(*texture);
|
|
|
|
*texture = NULL;
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
}
|
|
|
|
|
2016-03-21 17:06:45 +01:00
|
|
|
return D3DRM_OK;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateLight(IDirect3DRM3 *iface,
|
2013-04-25 09:59:46 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateLightRGB(IDirect3DRM3 *iface, D3DRMLIGHTTYPE type,
|
2013-04-25 09:59:46 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateMaterial(IDirect3DRM3 *iface,
|
2013-05-29 09:45:39 +02:00
|
|
|
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);
|
2012-05-22 22:05:32 +02:00
|
|
|
|
2013-05-29 09:45:39 +02:00
|
|
|
if (SUCCEEDED(hr = Direct3DRMMaterial_create(material)))
|
2012-05-22 22:05:32 +02:00
|
|
|
IDirect3DRMMaterial2_SetPower(*material, power);
|
|
|
|
|
2013-05-29 09:45:39 +02:00
|
|
|
return hr;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateDevice(IDirect3DRM3 *iface,
|
2013-04-18 09:35:15 +02:00
|
|
|
DWORD width, DWORD height, IDirect3DRMDevice3 **device)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-07-12 19:07:24 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
|
|
|
HRESULT hr;
|
2016-07-12 19:07:24 +02: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
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface)))
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
|
|
|
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice3_iface;
|
2015-08-06 23:47:51 +02:00
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateDeviceFromSurface(IDirect3DRM3 *iface, GUID *guid,
|
2015-07-01 01:03:38 +02:00
|
|
|
IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, DWORD flags, IDirect3DRMDevice3 **device)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2015-08-06 23:47:58 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
2015-08-06 23:47:58 +02:00
|
|
|
BOOL use_z_surface;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-06 23:47:58 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#x, device %p.\n",
|
2015-07-01 01:03:38 +02:00
|
|
|
iface, debugstr_guid(guid), ddraw, backbuffer, flags, device);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
2015-08-06 23:47:58 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
|
|
|
|
if (!backbuffer || !ddraw)
|
|
|
|
return D3DRMERR_BADDEVICE;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface)))
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
|
|
|
|
2015-08-06 23:47:58 +02:00
|
|
|
use_z_surface = !(flags & D3DRMDEVICE_NOZBUFFER);
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (SUCCEEDED(hr = d3drm_device_init(object, 3, ddraw, backbuffer, use_z_surface)))
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice3_iface;
|
2015-08-06 23:47:58 +02:00
|
|
|
else
|
|
|
|
d3drm_device_destroy(object);
|
|
|
|
|
|
|
|
return hr;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateDeviceFromD3D(IDirect3DRM3 *iface,
|
|
|
|
IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice3 **device)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2015-08-20 16:46:40 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
|
|
|
IDirect3D *d3d1;
|
|
|
|
IDirect3DDevice *d3d_device1;
|
|
|
|
IDirect3DRMDevice *device1;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-20 16:46:40 +02:00
|
|
|
TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, d3d, d3d_device, device);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
2015-08-20 16:46:40 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
if (!d3d || !d3d_device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
hr = IDirect3D2_QueryInterface(d3d, &IID_IDirect3D, (void **)&d3d1);
|
2015-08-06 23:47:51 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2015-08-20 16:46:40 +02:00
|
|
|
hr = IDirect3DDevice2_QueryInterface(d3d_device, &IID_IDirect3DDevice, (void **)&d3d_device1);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IDirect3D_Release(d3d1);
|
|
|
|
return hr;
|
|
|
|
}
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-20 16:46:40 +02:00
|
|
|
hr = IDirect3DRM_CreateDeviceFromD3D(&d3drm->IDirect3DRM_iface, d3d1, d3d_device1, &device1);
|
|
|
|
IDirect3D_Release(d3d1);
|
|
|
|
IDirect3DDevice_Release(d3d_device1);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-20 16:46:40 +02:00
|
|
|
hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice3, (void **)device);
|
|
|
|
IDirect3DRMDevice_Release(device1);
|
|
|
|
|
|
|
|
return hr;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateDeviceFromClipper(IDirect3DRM3 *iface,
|
2012-11-19 22:04:11 +01:00
|
|
|
IDirectDrawClipper *clipper, GUID *guid, int width, int height,
|
|
|
|
IDirect3DRMDevice3 **device)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2015-08-06 23:47:55 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2015-08-06 23:47:51 +02:00
|
|
|
struct d3drm_device *object;
|
2015-08-06 23:47:55 +02:00
|
|
|
IDirectDraw *ddraw;
|
|
|
|
IDirectDrawSurface *render_target;
|
2015-08-06 23:47:51 +02:00
|
|
|
HRESULT hr;
|
2015-08-06 23:47:55 +02:00
|
|
|
|
|
|
|
TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n",
|
2013-10-06 17:33:07 +02:00
|
|
|
iface, clipper, debugstr_guid(guid), width, height, device);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
2015-08-06 23:47:55 +02:00
|
|
|
if (!device)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
*device = NULL;
|
|
|
|
|
|
|
|
if (!clipper || !width || !height)
|
|
|
|
return D3DRMERR_BADVALUE;
|
|
|
|
|
|
|
|
hr = DirectDrawCreate(NULL, &ddraw, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface)))
|
2015-08-06 23:47:55 +02:00
|
|
|
{
|
|
|
|
IDirectDraw_Release(ddraw);
|
2015-08-06 23:47:51 +02:00
|
|
|
return hr;
|
2015-08-06 23:47:55 +02:00
|
|
|
}
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2015-08-06 23:47:55 +02:00
|
|
|
hr = d3drm_device_create_surfaces_from_clipper(object, ddraw, clipper, width, height, &render_target);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IDirectDraw_Release(ddraw);
|
|
|
|
d3drm_device_destroy(object);
|
|
|
|
return hr;
|
|
|
|
}
|
2015-08-06 23:47:51 +02:00
|
|
|
|
2016-07-12 19:07:24 +02:00
|
|
|
hr = d3drm_device_init(object, 3, ddraw, render_target, TRUE);
|
2015-08-06 23:47:55 +02:00
|
|
|
IDirectDraw_Release(ddraw);
|
|
|
|
IDirectDrawSurface_Release(render_target);
|
|
|
|
if (FAILED(hr))
|
|
|
|
d3drm_device_destroy(object);
|
|
|
|
else
|
2016-07-12 19:07:25 +02:00
|
|
|
*device = &object->IDirect3DRMDevice3_iface;
|
2015-08-06 23:47:55 +02:00
|
|
|
|
|
|
|
return hr;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateShadow(IDirect3DRM3 *iface, IUnknown *object, IDirect3DRMLight *light,
|
2013-04-25 09:59:46 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateTextureFromSurface(IDirect3DRM3 *iface,
|
2012-11-19 22:04:10 +01:00
|
|
|
IDirectDrawSurface *surface, IDirect3DRMTexture3 **texture)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, surface %p, texture %p stub!\n", iface, surface, texture);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateViewport(IDirect3DRM3 *iface, IDirect3DRMDevice3 *device,
|
2013-04-18 09:35:15 +02:00
|
|
|
IDirect3DRMFrame3 *camera, DWORD x, DWORD y, DWORD width, DWORD height, IDirect3DRMViewport2 **viewport)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-06-19 21:28:09 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
|
|
|
struct d3drm_viewport *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
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
|
|
|
|
2016-06-19 21:28:09 +02:00
|
|
|
if (FAILED(hr = d3drm_viewport_create(&object, &d3drm->IDirect3DRM_iface)))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*viewport = &object->IDirect3DRMViewport2_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateWrap(IDirect3DRM3 *iface, D3DRMWRAPTYPE type, IDirect3DRMFrame3 *frame,
|
2013-04-22 15:18:44 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateUserVisual(IDirect3DRM3 *iface,
|
2013-06-03 09:19:36 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface,
|
2013-05-28 08:55:20 +02:00
|
|
|
const char *filename, IDirect3DRMTexture3 **texture)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
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
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture3_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_LoadTextureFromResource(IDirect3DRM3 *iface, HMODULE module,
|
2013-05-28 08:55:20 +02:00
|
|
|
const char *resource_name, const char *resource_type, IDirect3DRMTexture3 **texture)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2016-05-20 23:07:38 +02:00
|
|
|
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
|
2016-03-21 17:06:45 +01:00
|
|
|
struct d3drm_texture *object;
|
|
|
|
HRESULT hr;
|
|
|
|
|
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
|
|
|
|
2016-05-20 23:07:38 +02:00
|
|
|
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
|
2016-03-21 17:06:45 +01:00
|
|
|
return hr;
|
|
|
|
|
|
|
|
*texture = &object->IDirect3DRMTexture3_iface;
|
|
|
|
|
|
|
|
return D3DRM_OK;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_SetDefaultTextureColors(IDirect3DRM3 *iface, DWORD color_count)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, color_count %u stub!\n", iface, color_count);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_SetDefaultTextureShades(IDirect3DRM3 *iface, DWORD shade_count)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, shade_count %u stub!\n", iface, shade_count);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_GetNamedObject(IDirect3DRM3 *iface,
|
2013-04-17 08:48:00 +02:00
|
|
|
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-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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;
|
|
|
|
}
|
|
|
|
|
2012-12-14 08:37:38 +01:00
|
|
|
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)
|
2012-05-15 08:08:22 +02:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
/* Load object only if it is top level and requested or if it is part of another object */
|
|
|
|
|
2012-05-15 08:08:22 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
if (requested || parent_frame)
|
2012-05-15 08:08:22 +02:00
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirect3DRMMeshBuilder3 *meshbuilder;
|
2012-05-15 08:08:22 +02:00
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
TRACE("Load mesh data\n");
|
2012-05-15 08:08:22 +02:00
|
|
|
|
|
|
|
hr = IDirect3DRM3_CreateMeshBuilder(iface, &meshbuilder);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2012-12-14 08:37:38 +01:00
|
|
|
hr = load_mesh_data(meshbuilder, data_object, LoadTextureProc, ArgLTP);
|
2012-05-15 08:08:22 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
/* Only top level objects are notified */
|
|
|
|
if (!parent_frame)
|
2012-05-15 08:08:40 +02:00
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirect3DRMObject *object;
|
|
|
|
|
|
|
|
hr = IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder, GUIDs[i], (void**)&object);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2012-05-15 08:08:40 +02:00
|
|
|
LoadProc(object, GUIDs[i], ArgLP);
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirect3DRMObject_Release(object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
IDirect3DRMFrame3_AddVisual(parent_frame, (IUnknown*)meshbuilder);
|
2012-05-15 08:08:40 +02:00
|
|
|
}
|
2012-05-15 08:08:22 +02:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
if (requested || parent_frame)
|
2012-05-15 08:08:22 +02:00
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirect3DRMFrame3 *frame;
|
2012-05-15 08:08:22 +02:00
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
TRACE("Load frame data\n");
|
2012-05-15 08:08:22 +02:00
|
|
|
|
2012-05-15 08:08:40 +02:00
|
|
|
hr = IDirect3DRM3_CreateFrame(iface, parent_frame, &frame);
|
2012-05-15 08:08:22 +02:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirectXFileObject *child;
|
2012-05-15 08:08:22 +02:00
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(data_object, &child)))
|
2012-05-15 08:08:22 +02:00
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirectXFileData *data;
|
|
|
|
IDirectXFileDataReference *reference;
|
|
|
|
IDirectXFileBinary *binary;
|
2012-05-15 08:08:40 +02:00
|
|
|
|
2015-04-30 16:46:40 +02:00
|
|
|
if (SUCCEEDED(IDirectXFileObject_QueryInterface(child,
|
|
|
|
&IID_IDirectXFileBinary, (void **)&binary)))
|
2012-05-15 08:08:40 +02:00
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
FIXME("Binary Object not supported yet\n");
|
|
|
|
IDirectXFileBinary_Release(binary);
|
2012-05-15 08:08:40 +02:00
|
|
|
}
|
2015-04-30 16:46:40 +02:00
|
|
|
else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child,
|
|
|
|
&IID_IDirectXFileData, (void **)&data)))
|
2012-05-15 08:08:40 +02:00
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
TRACE("Found Data Object\n");
|
|
|
|
hr = load_data(iface, data, GUIDs, nb_GUIDs, LoadProc, ArgLP, LoadTextureProc, ArgLTP, frame);
|
|
|
|
IDirectXFileData_Release(data);
|
2012-05-15 08:08:40 +02:00
|
|
|
}
|
2015-04-30 16:46:40 +02:00
|
|
|
else if (SUCCEEDED(IDirectXFileObject_QueryInterface(child,
|
|
|
|
&IID_IDirectXFileDataReference, (void **)&reference)))
|
2012-12-12 09:36:37 +01:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
2015-04-30 16:46:40 +02:00
|
|
|
IDirectXFileObject_Release(child);
|
2012-12-12 09:36:37 +01:00
|
|
|
}
|
2012-05-15 08:08:40 +02:00
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
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))
|
|
|
|
{
|
2012-05-15 08:08:40 +02:00
|
|
|
LoadProc(object, GUIDs[i], ArgLP);
|
2012-12-12 09:36:37 +01:00
|
|
|
IDirect3DRMObject_Release(object);
|
|
|
|
}
|
2012-05-15 08:08:22 +02:00
|
|
|
}
|
|
|
|
IDirect3DRMFrame3_Release(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
ERR("Cannot process frame\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(guid, &TID_D3DRMMaterial))
|
|
|
|
{
|
2012-12-12 09:36:37 +01:00
|
|
|
TRACE("Found TID_D3DRMMaterial\n");
|
|
|
|
|
|
|
|
/* Cannot be requested so nothing to do */
|
2012-05-15 08:08:22 +02:00
|
|
|
}
|
2012-05-17 10:09:31 +02:00
|
|
|
else if (IsEqualGUID(guid, &TID_D3DRMFrameTransformMatrix))
|
|
|
|
{
|
|
|
|
TRACE("Found TID_D3DRMFrameTransformMatrix\n");
|
|
|
|
|
2012-12-12 09:36:37 +01:00
|
|
|
/* Cannot be requested */
|
2012-05-17 10:09:31 +02:00
|
|
|
if (parent_frame)
|
|
|
|
{
|
2014-10-30 11:24:20 +01:00
|
|
|
D3DRMMATRIX4D *matrix;
|
2012-05-17 10:09:31 +02:00
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
TRACE("Load Frame Transform Matrix data\n");
|
|
|
|
|
2014-10-30 11:24:20 +01:00
|
|
|
hr = IDirectXFileData_GetData(data_object, NULL, &size, (void**)&matrix);
|
2012-05-17 10:09:31 +02:00
|
|
|
if ((hr != DXFILE_OK) || (size != sizeof(matrix)))
|
|
|
|
goto end;
|
|
|
|
|
2014-10-30 11:24:20 +01:00
|
|
|
hr = IDirect3DRMFrame3_AddTransform(parent_frame, D3DRMCOMBINE_REPLACE, *matrix);
|
2012-05-17 10:09:31 +02:00
|
|
|
if (FAILED(hr))
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
}
|
2012-05-15 08:08:22 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Found unknown TID %s\n", debugstr_guid(guid));
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = D3DRM_OK;
|
|
|
|
|
|
|
|
end:
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_Load(IDirect3DRM3 *iface, void *source, void *object_id, IID **iids,
|
2013-04-22 15:18:44 +02:00
|
|
|
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
|
|
|
{
|
2012-03-26 22:35:21 +02: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;
|
2012-03-26 22:35:21 +02:00
|
|
|
HRESULT hr;
|
|
|
|
const GUID* pGuid;
|
|
|
|
DWORD size;
|
2013-10-03 23:31:48 +02:00
|
|
|
struct d3drm_file_header *header;
|
2012-03-26 22:35:21 +02:00
|
|
|
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
|
|
|
|
2012-03-26 22:35:21 +02: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]));
|
2012-03-26 22:35:21 +02:00
|
|
|
|
2013-04-22 15:18:44 +02:00
|
|
|
if (flags == D3DRMLOAD_FROMMEMORY)
|
2012-03-26 22:35:21 +02:00
|
|
|
{
|
|
|
|
load_options = DXFILELOAD_FROMMEMORY;
|
|
|
|
}
|
2013-04-22 15:18:44 +02:00
|
|
|
else if (flags == D3DRMLOAD_FROMFILE)
|
2012-03-26 22:35:21 +02:00
|
|
|
{
|
|
|
|
load_options = DXFILELOAD_FROMFILE;
|
2013-04-22 15:18:44 +02:00
|
|
|
TRACE("Loading from file %s\n", debugstr_a(source));
|
2012-03-26 22:35:21 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-22 15:18:44 +02:00
|
|
|
FIXME("Load options %#x not supported yet.\n", flags);
|
2012-03-26 22:35:21 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-08-19 10:50:53 +02:00
|
|
|
hr = DirectXFileCreate(&file);
|
2012-03-26 22:35:21 +02:00
|
|
|
if (hr != DXFILE_OK)
|
|
|
|
goto end;
|
|
|
|
|
2013-08-19 10:50:53 +02:00
|
|
|
hr = IDirectXFile_RegisterTemplates(file, templates, strlen(templates));
|
2012-03-26 22:35:21 +02:00
|
|
|
if (hr != DXFILE_OK)
|
|
|
|
goto end;
|
|
|
|
|
2013-08-19 10:50:54 +02:00
|
|
|
hr = IDirectXFile_CreateEnumObject(file, source, load_options, &enum_object);
|
2012-03-26 22:35:21 +02:00
|
|
|
if (hr != DXFILE_OK)
|
|
|
|
goto end;
|
|
|
|
|
2013-08-20 10:20:12 +02:00
|
|
|
hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data);
|
2012-03-26 22:35:21 +02:00
|
|
|
if (hr != DXFILE_OK)
|
|
|
|
goto end;
|
|
|
|
|
2013-08-20 10:20:12 +02:00
|
|
|
hr = IDirectXFileData_GetType(data, &pGuid);
|
2012-03-26 22:35:21 +02:00
|
|
|
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-10-03 23:31:48 +02:00
|
|
|
hr = IDirectXFileData_GetData(data, NULL, &size, (void **)&header);
|
|
|
|
if ((hr != DXFILE_OK) || (size != sizeof(*header)))
|
2012-03-26 22:35:21 +02:00
|
|
|
goto end;
|
|
|
|
|
2013-10-03 23:31:48 +02:00
|
|
|
TRACE("Version is %u.%u, flags %#x.\n", header->major, header->minor, header->flags);
|
2012-03-26 22:35:21 +02:00
|
|
|
|
|
|
|
/* Version must be 1.0.x */
|
2013-10-03 23:31:48 +02:00
|
|
|
if ((header->major != 1) || (header->minor != 0))
|
2012-03-26 22:35:21 +02:00
|
|
|
{
|
|
|
|
ret = D3DRMERR_BADFILE;
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2013-08-20 10:20:12 +02:00
|
|
|
IDirectXFileData_Release(data);
|
|
|
|
data = NULL;
|
2012-03-26 22:35:21 +02:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2013-08-20 10:20:12 +02:00
|
|
|
hr = IDirectXFileEnumObject_GetNextDataObject(enum_object, &data);
|
2012-03-26 22:35:21 +02:00
|
|
|
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;
|
2012-03-26 22:35:21 +02:00
|
|
|
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);
|
2012-05-15 08:08:22 +02:00
|
|
|
if (ret != D3DRM_OK)
|
2012-03-26 22:35:21 +02:00
|
|
|
goto end;
|
|
|
|
|
2013-08-20 10:20:12 +02:00
|
|
|
IDirectXFileData_Release(data);
|
|
|
|
data = NULL;
|
2012-03-26 22:35:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2012-03-26 22:35:21 +02:00
|
|
|
|
|
|
|
return ret;
|
2011-12-29 02:26:40 +01:00
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_Tick(IDirect3DRM3 *iface, D3DVALUE tick)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, tick %.8e stub!\n", iface, tick);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateProgressiveMesh(IDirect3DRM3 *iface, IDirect3DRMProgressiveMesh **mesh)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-08-16 09:12:32 +02:00
|
|
|
FIXME("iface %p, mesh %p stub!\n", iface, mesh);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_UnregisterClient(IDirect3DRM3 *iface, REFGUID guid)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, guid %s stub!\n", iface, debugstr_guid(guid));
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_CreateClippedVisual(IDirect3DRM3 *iface,
|
2013-04-22 15:18:45 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_SetOptions(IDirect3DRM3 *iface, DWORD flags)
|
2011-12-29 02:26:40 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
FIXME("iface %p, flags %#x stub!\n", iface, flags);
|
2011-12-29 02:26:40 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static HRESULT WINAPI d3drm3_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;
|
|
|
|
}
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
static const struct IDirect3DRM3Vtbl d3drm3_vtbl =
|
|
|
|
{
|
|
|
|
d3drm3_QueryInterface,
|
|
|
|
d3drm3_AddRef,
|
|
|
|
d3drm3_Release,
|
|
|
|
d3drm3_CreateObject,
|
|
|
|
d3drm3_CreateFrame,
|
|
|
|
d3drm3_CreateMesh,
|
|
|
|
d3drm3_CreateMeshBuilder,
|
|
|
|
d3drm3_CreateFace,
|
|
|
|
d3drm3_CreateAnimation,
|
|
|
|
d3drm3_CreateAnimationSet,
|
|
|
|
d3drm3_CreateTexture,
|
|
|
|
d3drm3_CreateLight,
|
|
|
|
d3drm3_CreateLightRGB,
|
|
|
|
d3drm3_CreateMaterial,
|
|
|
|
d3drm3_CreateDevice,
|
|
|
|
d3drm3_CreateDeviceFromSurface,
|
|
|
|
d3drm3_CreateDeviceFromD3D,
|
|
|
|
d3drm3_CreateDeviceFromClipper,
|
|
|
|
d3drm3_CreateTextureFromSurface,
|
|
|
|
d3drm3_CreateShadow,
|
|
|
|
d3drm3_CreateViewport,
|
|
|
|
d3drm3_CreateWrap,
|
|
|
|
d3drm3_CreateUserVisual,
|
|
|
|
d3drm3_LoadTexture,
|
|
|
|
d3drm3_LoadTextureFromResource,
|
|
|
|
d3drm3_SetSearchPath,
|
|
|
|
d3drm3_AddSearchPath,
|
|
|
|
d3drm3_GetSearchPath,
|
|
|
|
d3drm3_SetDefaultTextureColors,
|
|
|
|
d3drm3_SetDefaultTextureShades,
|
|
|
|
d3drm3_GetDevices,
|
|
|
|
d3drm3_GetNamedObject,
|
|
|
|
d3drm3_EnumerateObjects,
|
|
|
|
d3drm3_Load,
|
|
|
|
d3drm3_Tick,
|
|
|
|
d3drm3_CreateProgressiveMesh,
|
|
|
|
d3drm3_RegisterClient,
|
|
|
|
d3drm3_UnregisterClient,
|
|
|
|
d3drm3_CreateClippedVisual,
|
|
|
|
d3drm3_SetOptions,
|
|
|
|
d3drm3_GetOptions,
|
2011-12-29 02:26:40 +01:00
|
|
|
};
|
2012-01-19 22:05:06 +01:00
|
|
|
|
2013-04-15 08:14:53 +02:00
|
|
|
HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
|
2012-01-19 22:05:06 +01:00
|
|
|
{
|
2013-10-06 17:33:07 +02:00
|
|
|
struct d3drm *object;
|
2012-01-19 22:05:06 +01:00
|
|
|
|
2013-04-15 08:14:53 +02:00
|
|
|
TRACE("d3drm %p.\n", d3drm);
|
2012-01-19 22:05:06 +01:00
|
|
|
|
2013-04-15 08:14:53 +02:00
|
|
|
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
|
2012-01-19 22:05:06 +01:00
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2013-10-06 17:33:07 +02:00
|
|
|
object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl;
|
|
|
|
object->IDirect3DRM2_iface.lpVtbl = &d3drm2_vtbl;
|
|
|
|
object->IDirect3DRM3_iface.lpVtbl = &d3drm3_vtbl;
|
2015-04-30 10:41:39 +02:00
|
|
|
object->ref1 = 1;
|
|
|
|
object->iface_count = 1;
|
2012-01-19 22:05:06 +01:00
|
|
|
|
2013-04-15 08:14:53 +02:00
|
|
|
*d3drm = &object->IDirect3DRM_iface;
|
2012-01-19 22:05:06 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2015-07-07 02:15:55 +02:00
|
|
|
|
|
|
|
HRESULT WINAPI DllCanUnloadNow(void)
|
|
|
|
{
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
TRACE("(%s, %s, %p): stub\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if(!ppv)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|