Author: akhaldi
Date: Sat Jul 2 15:33:46 2016
New Revision: 71757
URL:
http://svn.reactos.org/svn/reactos?rev=71757&view=rev
Log:
[D3DRM] Sync with Wine Staging 1.9.11. CORE-11368
Modified:
trunk/reactos/dll/directx/wine/d3drm/d3drm.c
trunk/reactos/dll/directx/wine/d3drm/d3drm_main.c
trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h
trunk/reactos/dll/directx/wine/d3drm/meshbuilder.c
trunk/reactos/dll/directx/wine/d3drm/texture.c
trunk/reactos/dll/directx/wine/d3drm/viewport.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/directx/wine/d3drm/d3drm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/d3d…
==============================================================================
--- trunk/reactos/dll/directx/wine/d3drm/d3drm.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/d3drm/d3drm.c [iso-8859-1] Sat Jul 2 15:33:46 2016
@@ -3,6 +3,7 @@
*
* Copyright 2010, 2012 Christian Costa
* Copyright 2011 André Hentschel
+ * Copyright 2016 Aaryaman Vasishta
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -127,10 +128,12 @@
static HRESULT WINAPI d3drm1_CreateObject(IDirect3DRM *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
{
- FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
+ struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
+
+ TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
- return E_NOTIMPL;
+ return IDirect3DRM3_CreateObject(&d3drm->IDirect3DRM3_iface, clsid, outer,
iid, out);
}
static HRESULT WINAPI d3drm1_CreateFrame(IDirect3DRM *iface,
@@ -181,9 +184,25 @@
static HRESULT WINAPI d3drm1_CreateTexture(IDirect3DRM *iface,
D3DRMIMAGE *image, IDirect3DRMTexture **texture)
{
- FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image,
texture);
-
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
+ struct d3drm *d3drm = impl_from_IDirect3DRM(iface);
+ IDirect3DRMTexture3 *texture3;
+ HRESULT hr;
+
+ TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
+
+ if (!texture)
+ return D3DRMERR_BADVALUE;
+
+ if (FAILED(hr = IDirect3DRM3_CreateTexture(&d3drm->IDirect3DRM3_iface, image,
&texture3)))
+ {
+ *texture = NULL;
+ return hr;
+ }
+
+ hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture, (void
**)texture);
+ IDirect3DRMTexture3_Release(texture3);
+
+ return hr;
}
static HRESULT WINAPI d3drm1_CreateLight(IDirect3DRM *iface,
@@ -391,17 +410,33 @@
static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface,
const char *filename, IDirect3DRMTexture **texture)
{
+ struct d3drm_texture *object;
+ HRESULT hr;
+
FIXME("iface %p, filename %s, texture %p stub!\n", iface,
debugstr_a(filename), texture);
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
+ if (FAILED(hr = d3drm_texture_create(&object, iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture_iface;
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm1_LoadTextureFromResource(IDirect3DRM *iface,
HRSRC resource, IDirect3DRMTexture **texture)
{
+ struct d3drm_texture *object;
+ HRESULT hr;
+
FIXME("iface %p, resource %p, texture %p stub!\n", iface, resource,
texture);
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture, (IUnknown **)texture);
+ if (FAILED(hr = d3drm_texture_create(&object, iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture_iface;
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm1_SetSearchPath(IDirect3DRM *iface, const char *path)
@@ -567,10 +602,12 @@
static HRESULT WINAPI d3drm2_CreateObject(IDirect3DRM2 *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
{
- FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
+ struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
+
+ TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
- return E_NOTIMPL;
+ return IDirect3DRM3_CreateObject(&d3drm->IDirect3DRM3_iface, clsid, outer,
iid, out);
}
static HRESULT WINAPI d3drm2_CreateFrame(IDirect3DRM2 *iface,
@@ -621,9 +658,25 @@
static HRESULT WINAPI d3drm2_CreateTexture(IDirect3DRM2 *iface,
D3DRMIMAGE *image, IDirect3DRMTexture2 **texture)
{
- FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image,
texture);
-
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
+ struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
+ IDirect3DRMTexture3 *texture3;
+ HRESULT hr;
+
+ TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
+
+ if (!texture)
+ return D3DRMERR_BADVALUE;
+
+ if (FAILED(hr = IDirect3DRM3_CreateTexture(&d3drm->IDirect3DRM3_iface, image,
&texture3)))
+ {
+ *texture = NULL;
+ return hr;
+ }
+
+ hr = IDirect3DRMTexture3_QueryInterface(texture3, &IID_IDirect3DRMTexture2, (void
**)texture);
+ IDirect3DRMTexture3_Release(texture3);
+
+ return hr;
}
static HRESULT WINAPI d3drm2_CreateLight(IDirect3DRM2 *iface,
@@ -809,18 +862,36 @@
static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface,
const char *filename, IDirect3DRMTexture2 **texture)
{
+ struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
+ struct d3drm_texture *object;
+ HRESULT hr;
+
FIXME("iface %p, filename %s, texture %p stub!\n", iface,
debugstr_a(filename), texture);
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
+ if (FAILED(hr = d3drm_texture_create(&object,
&d3drm->IDirect3DRM_iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture2_iface;
+
+ return hr;
}
static HRESULT WINAPI d3drm2_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE
module,
const char *resource_name, const char *resource_type, IDirect3DRMTexture2
**texture)
{
+ struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
+ struct d3drm_texture *object;
+ HRESULT hr;
+
FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
iface, debugstr_a(resource_name), debugstr_a(resource_type), texture);
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture2, (IUnknown **)texture);
+ if (FAILED(hr = d3drm_texture_create(&object,
&d3drm->IDirect3DRM_iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture2_iface;
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm2_SetSearchPath(IDirect3DRM2 *iface, const char *path)
@@ -994,10 +1065,51 @@
static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
{
- FIXME("iface %p, clsid %s, outer %p, iid %s, out %p stub!\n",
+ struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
+ IUnknown *object;
+ HRESULT hr;
+
+ TRACE("iface %p, clsid %s, outer %p, iid %s, out %p.\n",
iface, debugstr_guid(clsid), outer, debugstr_guid(iid), out);
- return E_NOTIMPL;
+ 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;
+ }
+
+ if (IsEqualGUID(clsid, &CLSID_CDirect3DRMTexture))
+ {
+ struct d3drm_texture *texture;
+ if (FAILED(hr = d3drm_texture_create(&texture,
&d3drm->IDirect3DRM_iface)))
+ {
+ *out = NULL;
+ return hr;
+ }
+ object = (IUnknown *)&texture->IDirect3DRMTexture3_iface;
+ }
+ else
+ {
+ 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;
}
static HRESULT WINAPI d3drm3_CreateFrame(IDirect3DRM3 *iface,
@@ -1046,9 +1158,28 @@
static HRESULT WINAPI d3drm3_CreateTexture(IDirect3DRM3 *iface,
D3DRMIMAGE *image, IDirect3DRMTexture3 **texture)
{
- FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image,
texture);
-
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
+ struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
+ struct d3drm_texture *object;
+ HRESULT hr;
+
+ TRACE("iface %p, image %p, texture %p.\n", iface, image, texture);
+
+ if (!texture)
+ return D3DRMERR_BADVALUE;
+
+ if (FAILED(hr = d3drm_texture_create(&object,
&d3drm->IDirect3DRM_iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture3_iface;
+
+ if (FAILED(IDirect3DRMTexture3_InitFromImage(*texture, image)))
+ {
+ IDirect3DRMTexture3_Release(*texture);
+ *texture = NULL;
+ return D3DRMERR_BADVALUE;
+ }
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm3_CreateLight(IDirect3DRM3 *iface,
@@ -1284,18 +1415,36 @@
static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface,
const char *filename, IDirect3DRMTexture3 **texture)
{
+ struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
+ struct d3drm_texture *object;
+ HRESULT hr;
+
FIXME("iface %p, filename %s, texture %p stub!\n", iface,
debugstr_a(filename), texture);
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
+ if (FAILED(hr = d3drm_texture_create(&object,
&d3drm->IDirect3DRM_iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture3_iface;
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm3_LoadTextureFromResource(IDirect3DRM3 *iface, HMODULE
module,
const char *resource_name, const char *resource_type, IDirect3DRMTexture3
**texture)
{
+ struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
+ struct d3drm_texture *object;
+ HRESULT hr;
+
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);
- return Direct3DRMTexture_create(&IID_IDirect3DRMTexture3, (IUnknown **)texture);
+ if (FAILED(hr = d3drm_texture_create(&object,
&d3drm->IDirect3DRM_iface)))
+ return hr;
+
+ *texture = &object->IDirect3DRMTexture3_iface;
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm3_SetSearchPath(IDirect3DRM3 *iface, const char *path)
Modified: trunk/reactos/dll/directx/wine/d3drm/d3drm_main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/d3d…
==============================================================================
--- trunk/reactos/dll/directx/wine/d3drm/d3drm_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/d3drm/d3drm_main.c [iso-8859-1] Sat Jul 2 15:33:46
2016
@@ -34,3 +34,67 @@
}
return TRUE;
}
+
+void d3drm_object_init(struct d3drm_object *object)
+{
+ object->ref = 1;
+ object->appdata = 0;
+ list_init(&object->destroy_callbacks);
+}
+
+struct destroy_callback
+{
+ struct list entry;
+ D3DRMOBJECTCALLBACK cb;
+ void *ctx;
+};
+
+HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object,
D3DRMOBJECTCALLBACK cb, void *ctx)
+{
+ struct destroy_callback *callback;
+
+ if (!cb)
+ return D3DRMERR_BADVALUE;
+
+ callback = HeapAlloc(GetProcessHeap(), 0, sizeof(*callback));
+ if (!callback)
+ return E_OUTOFMEMORY;
+
+ callback->cb = cb;
+ callback->ctx = ctx;
+
+ list_add_head(&object->destroy_callbacks, &callback->entry);
+ return D3DRM_OK;
+}
+
+HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object,
D3DRMOBJECTCALLBACK cb, void *ctx)
+{
+ struct destroy_callback *callback;
+
+ if (!cb)
+ return D3DRMERR_BADVALUE;
+
+ LIST_FOR_EACH_ENTRY(callback, &object->destroy_callbacks, struct
destroy_callback, entry)
+ {
+ if (callback->cb == cb && callback->ctx == ctx)
+ {
+ list_remove(&callback->entry);
+ HeapFree(GetProcessHeap(), 0, callback);
+ break;
+ }
+ }
+
+ return D3DRM_OK;
+}
+
+void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
+{
+ struct destroy_callback *callback, *callback2;
+
+ LIST_FOR_EACH_ENTRY_SAFE(callback, callback2, &object->destroy_callbacks,
struct destroy_callback, entry)
+ {
+ callback->cb(iface, callback->ctx);
+ list_remove(&callback->entry);
+ HeapFree(GetProcessHeap(), 0, callback);
+ }
+}
Modified: trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/d3d…
==============================================================================
--- trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h [iso-8859-1] Sat Jul 2 15:33:46
2016
@@ -38,9 +38,33 @@
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
+#include "wine/list.h"
+
struct d3drm_device;
+struct d3drm_object
+{
+ LONG ref;
+ DWORD appdata;
+ struct list destroy_callbacks;
+};
+
+struct d3drm_texture
+{
+ struct d3drm_object obj;
+ IDirect3DRMTexture IDirect3DRMTexture_iface;
+ IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
+ IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
+ IDirect3DRM *d3drm;
+ D3DRMIMAGE *image;
+};
+
+void d3drm_object_init(struct d3drm_object *object) DECLSPEC_HIDDEN;
+HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object,
D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
+HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object,
D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
+void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
DECLSPEC_HIDDEN;
HRESULT d3drm_device_create(struct d3drm_device **out) DECLSPEC_HIDDEN;
+HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
DECLSPEC_HIDDEN;
IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device)
DECLSPEC_HIDDEN;
IDirect3DRMDevice2 *IDirect3DRMDevice2_from_impl(struct d3drm_device *device)
DECLSPEC_HIDDEN;
IDirect3DRMDevice3 *IDirect3DRMDevice3_from_impl(struct d3drm_device *device)
DECLSPEC_HIDDEN;
@@ -51,7 +75,6 @@
HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN;
HRESULT Direct3DRMViewport_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN;
HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2** ret_iface) DECLSPEC_HIDDEN;
-HRESULT Direct3DRMTexture_create(REFIID riid, IUnknown** ret_iface) DECLSPEC_HIDDEN;
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data,
D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg)
DECLSPEC_HIDDEN;
Modified: trunk/reactos/dll/directx/wine/d3drm/meshbuilder.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/mes…
==============================================================================
--- trunk/reactos/dll/directx/wine/d3drm/meshbuilder.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/d3drm/meshbuilder.c [iso-8859-1] Sat Jul 2 15:33:46
2016
@@ -1056,7 +1056,7 @@
return hr;
}
- TRACE("Mesh name is '%s'\n", This->name ? This->name :
"");
+ TRACE("Mesh name is %s\n", debugstr_a(This->name));
This->nb_normals = 0;
@@ -1149,6 +1149,7 @@
IDirectXFileObject *child;
DWORD i = 0;
float* values;
+ struct d3drm_texture *texture_object;
TRACE("Process MeshMaterialList\n");
@@ -1286,13 +1287,12 @@
if (file != INVALID_HANDLE_VALUE)
{
CloseHandle(file);
-
- hr =
Direct3DRMTexture_create(&IID_IDirect3DRMTexture3,
(IUnknown**)&This->materials[i].texture);
- if (FAILED(hr))
+ if (FAILED(hr = d3drm_texture_create(&texture_object,
NULL)))
{
IDirectXFileData_Release(data);
goto end;
}
+ This->materials[i].texture =
&texture_object->IDirect3DRMTexture3_iface;
}
}
}
Modified: trunk/reactos/dll/directx/wine/d3drm/texture.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/tex…
==============================================================================
--- trunk/reactos/dll/directx/wine/d3drm/texture.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/d3drm/texture.c [iso-8859-1] Sat Jul 2 15:33:46 2016
@@ -20,15 +20,6 @@
#include "d3drm_private.h"
-struct d3drm_texture
-{
- IDirect3DRMTexture IDirect3DRMTexture_iface;
- IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
- IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
- LONG ref;
- DWORD app_data;
-};
-
static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture
*iface)
{
return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface);
@@ -42,6 +33,31 @@
static inline struct d3drm_texture *impl_from_IDirect3DRMTexture3(IDirect3DRMTexture3
*iface)
{
return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture3_iface);
+}
+
+static void d3drm_texture_destroy(struct d3drm_texture *texture)
+{
+ TRACE("texture %p is being destroyed.\n", texture);
+
+ d3drm_object_cleanup((IDirect3DRMObject*)&texture->IDirect3DRMTexture3_iface,
&texture->obj);
+ if (texture->image)
+ IDirect3DRM_Release(texture->d3drm);
+ HeapFree(GetProcessHeap(), 0, texture);
+}
+
+static BOOL d3drm_validate_image(D3DRMIMAGE *image)
+{
+ if (!image
+ || !image->red_mask
+ || !image->green_mask
+ || !image->blue_mask
+ || !image->buffer1
+ || !(image->rgb || (image->palette &&
image->palette_size)))
+ {
+ return FALSE;
+ }
+
+ return TRUE;
}
static HRESULT WINAPI d3drm_texture1_QueryInterface(IDirect3DRMTexture *iface, REFIID
riid, void **out)
@@ -84,17 +100,21 @@
static HRESULT WINAPI d3drm_texture1_AddDestroyCallback(IDirect3DRMTexture *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return
IDirect3DRMTexture3_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb,
ctx);
}
static HRESULT WINAPI d3drm_texture1_DeleteDestroyCallback(IDirect3DRMTexture *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return
IDirect3DRMTexture3_DeleteDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb,
ctx);
}
static HRESULT WINAPI d3drm_texture1_SetAppData(IDirect3DRMTexture *iface, DWORD data)
@@ -380,17 +400,21 @@
static HRESULT WINAPI d3drm_texture2_AddDestroyCallback(IDirect3DRMTexture2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return
IDirect3DRMTexture3_AddDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb,
ctx);
}
static HRESULT WINAPI d3drm_texture2_DeleteDestroyCallback(IDirect3DRMTexture2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return
IDirect3DRMTexture3_DeleteDestroyCallback(&texture->IDirect3DRMTexture3_iface, cb,
ctx);
}
static HRESULT WINAPI d3drm_texture2_SetAppData(IDirect3DRMTexture2 *iface, DWORD data)
@@ -604,9 +628,11 @@
static HRESULT WINAPI d3drm_texture2_InitFromImage(IDirect3DRMTexture2 *iface, D3DRMIMAGE
*image)
{
- FIXME("iface %p, image %p stub!\n", iface, image);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface);
+
+ TRACE("iface %p, image %p.\n", iface, image);
+
+ return IDirect3DRMTexture3_InitFromImage(&texture->IDirect3DRMTexture3_iface,
image);
}
static HRESULT WINAPI d3drm_texture2_InitFromResource2(IDirect3DRMTexture2 *iface,
@@ -699,7 +725,7 @@
static ULONG WINAPI d3drm_texture3_AddRef(IDirect3DRMTexture3 *iface)
{
struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
- ULONG refcount = InterlockedIncrement(&texture->ref);
+ ULONG refcount = InterlockedIncrement(&texture->obj.ref);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
@@ -709,12 +735,12 @@
static ULONG WINAPI d3drm_texture3_Release(IDirect3DRMTexture3 *iface)
{
struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
- ULONG refcount = InterlockedDecrement(&texture->ref);
+ ULONG refcount = InterlockedDecrement(&texture->obj.ref);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
- HeapFree(GetProcessHeap(), 0, texture);
+ d3drm_texture_destroy(texture);
return refcount;
}
@@ -730,17 +756,21 @@
static HRESULT WINAPI d3drm_texture3_AddDestroyCallback(IDirect3DRMTexture3 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return d3drm_object_add_destroy_callback(&texture->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_texture3_DeleteDestroyCallback(IDirect3DRMTexture3 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return d3drm_object_delete_destroy_callback(&texture->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_texture3_SetAppData(IDirect3DRMTexture3 *iface, DWORD data)
@@ -749,7 +779,7 @@
TRACE("iface %p, data %#x.\n", iface, data);
- texture->app_data = data;
+ texture->obj.appdata = data;
return D3DRM_OK;
}
@@ -760,7 +790,7 @@
TRACE("iface %p.\n", iface);
- return texture->app_data;
+ return texture->obj.appdata;
}
static HRESULT WINAPI d3drm_texture3_SetName(IDirect3DRMTexture3 *iface, const char
*name)
@@ -781,7 +811,7 @@
{
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
- if (!size || *size < strlen("Texture") || !name)
+ if (!size || *size < sizeof("Texture") || !name)
return E_INVALIDARG;
strcpy(name, "Texture");
@@ -885,51 +915,66 @@
static D3DRMIMAGE * WINAPI d3drm_texture3_GetImage(IDirect3DRMTexture3 *iface)
{
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
+
+ TRACE("iface %p.\n", iface);
+
+ return texture->image;
+}
+
+static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface)
+{
FIXME("iface %p stub!\n", iface);
- return NULL;
-}
-
-static DWORD WINAPI d3drm_texture3_GetShades(IDirect3DRMTexture3 *iface)
+ return 0;
+}
+
+static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface)
{
FIXME("iface %p stub!\n", iface);
return 0;
}
-static DWORD WINAPI d3drm_texture3_GetColors(IDirect3DRMTexture3 *iface)
+static DWORD WINAPI d3drm_texture3_GetDecalScale(IDirect3DRMTexture3 *iface)
{
FIXME("iface %p stub!\n", iface);
return 0;
}
-static DWORD WINAPI d3drm_texture3_GetDecalScale(IDirect3DRMTexture3 *iface)
+static BOOL WINAPI d3drm_texture3_GetDecalTransparency(IDirect3DRMTexture3 *iface)
{
FIXME("iface %p stub!\n", iface);
+ return FALSE;
+}
+
+static D3DCOLOR WINAPI d3drm_texture3_GetDecalTransparentColor(IDirect3DRMTexture3
*iface)
+{
+ FIXME("iface %p stub!\n", iface);
+
return 0;
}
-static BOOL WINAPI d3drm_texture3_GetDecalTransparency(IDirect3DRMTexture3 *iface)
-{
- FIXME("iface %p stub!\n", iface);
-
- return FALSE;
-}
-
-static D3DCOLOR WINAPI d3drm_texture3_GetDecalTransparentColor(IDirect3DRMTexture3
*iface)
-{
- FIXME("iface %p stub!\n", iface);
-
- return 0;
-}
-
static HRESULT WINAPI d3drm_texture3_InitFromImage(IDirect3DRMTexture3 *iface, D3DRMIMAGE
*image)
{
- FIXME("iface %p, image %p stub!\n", iface, image);
-
- return E_NOTIMPL;
+ struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
+
+ TRACE("iface %p, image %p.\n", iface, image);
+
+ if (!d3drm_validate_image(image))
+ return D3DRMERR_BADOBJECT;
+
+ /* d3drm intentionally leaks a reference to IDirect3DRM here if texture has already
been initialized. */
+ IDirect3DRM_AddRef(texture->d3drm);
+
+ if (texture->image)
+ return D3DRMERR_BADOBJECT;
+
+ texture->image = image;
+
+ return D3DRM_OK;
}
static HRESULT WINAPI d3drm_texture3_InitFromResource2(IDirect3DRMTexture3 *iface,
@@ -1029,12 +1074,11 @@
d3drm_texture3_SetValidationCallback,
};
-HRESULT Direct3DRMTexture_create(REFIID riid, IUnknown **out)
+HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
{
struct d3drm_texture *object;
- HRESULT hr;
-
- TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
+
+ TRACE("texture %p.\n", texture);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
@@ -1042,10 +1086,11 @@
object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl;
object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl;
- object->ref = 1;
-
- hr = IDirect3DRMTexture3_QueryInterface(&object->IDirect3DRMTexture3_iface,
riid, (void **)out);
- IDirect3DRMTexture3_Release(&object->IDirect3DRMTexture3_iface);
-
- return hr;
-}
+ object->d3drm = d3drm;
+
+ d3drm_object_init(&object->obj);
+
+ *texture = object;
+
+ return D3DRM_OK;
+}
Modified: trunk/reactos/dll/directx/wine/d3drm/viewport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/vie…
==============================================================================
--- trunk/reactos/dll/directx/wine/d3drm/viewport.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/d3drm/viewport.c [iso-8859-1] Sat Jul 2 15:33:46 2016
@@ -22,9 +22,9 @@
struct d3drm_viewport
{
+ struct d3drm_object obj;
IDirect3DRMViewport IDirect3DRMViewport_iface;
IDirect3DRMViewport2 IDirect3DRMViewport2_iface;
- LONG ref;
D3DVALUE back;
D3DVALUE front;
D3DVALUE field;
@@ -48,6 +48,7 @@
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IDirect3DRMViewport)
+ || IsEqualGUID(riid, &IID_IDirect3DRMObject)
|| IsEqualGUID(riid, &IID_IUnknown))
{
*out = &viewport->IDirect3DRMViewport_iface;
@@ -70,7 +71,7 @@
static ULONG WINAPI d3drm_viewport1_AddRef(IDirect3DRMViewport *iface)
{
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- ULONG refcount = InterlockedIncrement(&viewport->ref);
+ ULONG refcount = InterlockedIncrement(&viewport->obj.ref);
TRACE("%p increasing refcount to %u.\n", iface, refcount);
@@ -80,12 +81,15 @@
static ULONG WINAPI d3drm_viewport1_Release(IDirect3DRMViewport *iface)
{
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
- ULONG refcount = InterlockedDecrement(&viewport->ref);
+ ULONG refcount = InterlockedDecrement(&viewport->obj.ref);
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount)
+ {
+ d3drm_object_cleanup((IDirect3DRMObject*)iface, &viewport->obj);
HeapFree(GetProcessHeap(), 0, viewport);
+ }
return refcount;
}
@@ -101,31 +105,39 @@
static HRESULT WINAPI d3drm_viewport1_AddDestroyCallback(IDirect3DRMViewport *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return
IDirect3DRMViewport2_AddDestroyCallback(&viewport->IDirect3DRMViewport2_iface, cb,
ctx);
}
static HRESULT WINAPI d3drm_viewport1_DeleteDestroyCallback(IDirect3DRMViewport *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return
IDirect3DRMViewport2_DeleteDestroyCallback(&viewport->IDirect3DRMViewport2_iface,
cb, ctx);
}
static HRESULT WINAPI d3drm_viewport1_SetAppData(IDirect3DRMViewport *iface, DWORD data)
{
- FIXME("iface %p, data %#x stub!\n", iface, data);
-
- return E_NOTIMPL;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
+
+ TRACE("iface %p, data %#x\n", iface, data);
+
+ return IDirect3DRMViewport2_SetAppData(&viewport->IDirect3DRMViewport2_iface,
data);
}
static DWORD WINAPI d3drm_viewport1_GetAppData(IDirect3DRMViewport *iface)
{
- FIXME("iface %p.\n", iface);
-
- return 0;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
+
+ TRACE("iface %p.\n", iface);
+
+ return
IDirect3DRMViewport2_GetAppData(&viewport->IDirect3DRMViewport2_iface);
}
static HRESULT WINAPI d3drm_viewport1_SetName(IDirect3DRMViewport *iface, const char
*name)
@@ -454,31 +466,40 @@
static HRESULT WINAPI d3drm_viewport2_AddDestroyCallback(IDirect3DRMViewport2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return d3drm_object_add_destroy_callback(&viewport->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_viewport2_DeleteDestroyCallback(IDirect3DRMViewport2 *iface,
D3DRMOBJECTCALLBACK cb, void *ctx)
{
- FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx);
-
- return E_NOTIMPL;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
+
+ TRACE("iface %p, cb %p, ctx %p\n", iface, cb, ctx);
+
+ return d3drm_object_delete_destroy_callback(&viewport->obj, cb, ctx);
}
static HRESULT WINAPI d3drm_viewport2_SetAppData(IDirect3DRMViewport2 *iface, DWORD
data)
{
- FIXME("iface %p, data %#x stub!\n", iface, data);
-
- return E_NOTIMPL;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
+
+ TRACE("iface %p, data %#x\n", iface, data);
+
+ viewport->obj.appdata = data;
+ return S_OK;
}
static DWORD WINAPI d3drm_viewport2_GetAppData(IDirect3DRMViewport2 *iface)
{
- FIXME("iface %p stub!\n", iface);
-
- return 0;
+ struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
+
+ TRACE("iface %p\n", iface);
+
+ return viewport->obj.appdata;
}
static HRESULT WINAPI d3drm_viewport2_SetName(IDirect3DRMViewport2 *iface, const char
*name)
@@ -810,7 +831,7 @@
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl;
- object->ref = 1;
+ d3drm_object_init(&object->obj);
if (IsEqualGUID(riid, &IID_IDirect3DRMViewport2))
*out = (IUnknown *)&object->IDirect3DRMViewport2_iface;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jul 2 15:33:46 2016
@@ -25,7 +25,7 @@
reactos/dll/directx/wine/d3d8 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3d9 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-1.9.4
-reactos/dll/directx/wine/d3drm # Synced to WineStaging-1.9.4
+reactos/dll/directx/wine/d3drm # Synced to WineStaging-1.9.11
reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.4
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4