Commit 177aa5c2 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3dx9: Get rid of the ID3DXFileImpl typedef.

parent 4a9da034
......@@ -46,11 +46,12 @@ static HRESULT error_dxfile_to_d3dxfile(HRESULT error)
}
}
typedef struct {
struct d3dx9_file
{
ID3DXFile ID3DXFile_iface;
LONG ref;
IDirectXFile *dxfile;
} ID3DXFileImpl;
};
typedef struct {
ID3DXFileEnumObject ID3DXFileEnumObject_iface;
......@@ -69,9 +70,9 @@ typedef struct {
} ID3DXFileDataImpl;
static inline ID3DXFileImpl* impl_from_ID3DXFile(ID3DXFile *iface)
static inline struct d3dx9_file *impl_from_ID3DXFile(ID3DXFile *iface)
{
return CONTAINING_RECORD(iface, ID3DXFileImpl, ID3DXFile_iface);
return CONTAINING_RECORD(iface, struct d3dx9_file, ID3DXFile_iface);
}
static inline ID3DXFileEnumObjectImpl* impl_from_ID3DXFileEnumObject(ID3DXFileEnumObject *iface)
......@@ -493,60 +494,54 @@ static const ID3DXFileEnumObjectVtbl ID3DXFileEnumObject_Vtbl =
ID3DXFileEnumObjectImpl_GetDataObjectByName
};
/*** IUnknown methods ***/
static HRESULT WINAPI ID3DXFileImpl_QueryInterface(ID3DXFile *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI d3dx9_file_QueryInterface(ID3DXFile *iface, REFIID riid, void **out)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ID3DXFile))
if (IsEqualGUID(riid, &IID_ID3DXFile)
|| IsEqualGUID(riid, &IID_IUnknown))
{
iface->lpVtbl->AddRef(iface);
*ret_iface = iface;
*out = iface;
return S_OK;
}
WARN("(%p)->(%s, %p), not found\n", iface, debugstr_guid(riid), ret_iface);
*ret_iface = NULL;
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*out = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI ID3DXFileImpl_AddRef(ID3DXFile *iface)
static ULONG WINAPI d3dx9_file_AddRef(ID3DXFile *iface)
{
ID3DXFileImpl *This = impl_from_ID3DXFile(iface);
ULONG ref = InterlockedIncrement(&This->ref);
struct d3dx9_file *file = impl_from_ID3DXFile(iface);
ULONG refcount = InterlockedIncrement(&file->ref);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
TRACE("%p increasing refcount to %u.\n", file, refcount);
return ref;
return refcount;
}
static ULONG WINAPI ID3DXFileImpl_Release(ID3DXFile *iface)
static ULONG WINAPI d3dx9_file_Release(ID3DXFile *iface)
{
ID3DXFileImpl *This = impl_from_ID3DXFile(iface);
ULONG ref = InterlockedDecrement(&This->ref);
struct d3dx9_file *file = impl_from_ID3DXFile(iface);
ULONG refcount = InterlockedDecrement(&file->ref);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
TRACE("%p decreasing refcount to %u.\n", file, refcount);
if (!ref)
if (!refcount)
{
IDirectXFile_Release(This->dxfile);
HeapFree(GetProcessHeap(), 0, This);
IDirectXFile_Release(file->dxfile);
HeapFree(GetProcessHeap(), 0, file);
}
return ref;
return refcount;
}
/*** ID3DXFile methods ***/
static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const void *source, D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object)
static HRESULT WINAPI d3dx9_file_CreateEnumObject(ID3DXFile *iface, const void *source,
D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object)
{
ID3DXFileImpl *This = impl_from_ID3DXFile(iface);
struct d3dx9_file *file = impl_from_ID3DXFile(iface);
ID3DXFileEnumObjectImpl *object;
IDirectXFileEnumObject *dxfile_enum_object;
void *dxfile_source;
......@@ -556,7 +551,7 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi
IDirectXFileData *data_object;
HRESULT ret;
TRACE("(%p)->(%p, %x, %p)\n", iface, source, options, enum_object);
TRACE("iface %p, source %p, options %#x, enum_object %p.\n", iface, source, options, enum_object);
if (!enum_object)
return E_POINTER;
......@@ -600,7 +595,7 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi
object->ID3DXFileEnumObject_iface.lpVtbl = &ID3DXFileEnumObject_Vtbl;
object->ref = 1;
ret = IDirectXFile_CreateEnumObject(This->dxfile, dxfile_source, dxfile_options, &dxfile_enum_object);
ret = IDirectXFile_CreateEnumObject(file->dxfile, dxfile_source, dxfile_options, &dxfile_enum_object);
if (ret != S_OK)
{
......@@ -638,23 +633,23 @@ static HRESULT WINAPI ID3DXFileImpl_CreateEnumObject(ID3DXFile *iface, const voi
return S_OK;
}
static HRESULT WINAPI ID3DXFileImpl_CreateSaveObject(ID3DXFile *iface, const void *data, D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object)
static HRESULT WINAPI d3dx9_file_CreateSaveObject(ID3DXFile *iface, const void *data,
D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object)
{
FIXME("(%p)->(%p, %x, %u, %p): stub\n", iface, data, options, format, save_object);
FIXME("iface %p, data %p, options %#x, format %#x, save_object %p stub!\n",
iface, data, options, format, save_object);
return E_NOTIMPL;
}
static HRESULT WINAPI ID3DXFileImpl_RegisterTemplates(ID3DXFile *iface, const void *data, SIZE_T size)
static HRESULT WINAPI d3dx9_file_RegisterTemplates(ID3DXFile *iface, const void *data, SIZE_T size)
{
ID3DXFileImpl *This = impl_from_ID3DXFile(iface);
struct d3dx9_file *file = impl_from_ID3DXFile(iface);
HRESULT ret;
TRACE("(%p)->(%p, %lu)\n", iface, data, size);
TRACE("iface %p, data %p, size %lu.\n", iface, data, size);
ret = IDirectXFile_RegisterTemplates(This->dxfile, (void*)data, size);
ret = IDirectXFile_RegisterTemplates(file->dxfile, (void *)data, size);
if (ret != DXFILE_OK)
{
WARN("Error %#x\n", ret);
......@@ -664,32 +659,30 @@ static HRESULT WINAPI ID3DXFileImpl_RegisterTemplates(ID3DXFile *iface, const vo
return S_OK;
}
static HRESULT WINAPI ID3DXFileImpl_RegisterEnumTemplates(ID3DXFile *iface, ID3DXFileEnumObject *enum_object)
static HRESULT WINAPI d3dx9_file_RegisterEnumTemplates(ID3DXFile *iface, ID3DXFileEnumObject *enum_object)
{
FIXME("(%p)->(%p): stub\n", iface, enum_object);
FIXME("iface %p, enum_object %p stub!\n", iface, enum_object);
return E_NOTIMPL;
}
static const ID3DXFileVtbl ID3DXFile_Vtbl =
static const ID3DXFileVtbl d3dx9_file_vtbl =
{
ID3DXFileImpl_QueryInterface,
ID3DXFileImpl_AddRef,
ID3DXFileImpl_Release,
ID3DXFileImpl_CreateEnumObject,
ID3DXFileImpl_CreateSaveObject,
ID3DXFileImpl_RegisterTemplates,
ID3DXFileImpl_RegisterEnumTemplates
d3dx9_file_QueryInterface,
d3dx9_file_AddRef,
d3dx9_file_Release,
d3dx9_file_CreateEnumObject,
d3dx9_file_CreateSaveObject,
d3dx9_file_RegisterTemplates,
d3dx9_file_RegisterEnumTemplates,
};
HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
{
ID3DXFileImpl *object;
struct d3dx9_file *object;
HRESULT ret;
TRACE("(%p)\n", d3dxfile);
TRACE("d3dxfile %p.\n", d3dxfile);
if (!d3dxfile)
return E_POINTER;
......@@ -709,7 +702,7 @@ HRESULT WINAPI D3DXFileCreate(ID3DXFile **d3dxfile)
return E_FAIL;
}
object->ID3DXFile_iface.lpVtbl = &ID3DXFile_Vtbl;
object->ID3DXFile_iface.lpVtbl = &d3dx9_file_vtbl;
object->ref = 1;
*d3dxfile = &object->ID3DXFile_iface;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment