ReactOS 0.4.16-dev-197-g92996da
xfile.c File Reference
#include "d3dx9_private.h"
#include "d3dx9xof.h"
#include "dxfile.h"
Include dependency graph for xfile.c:

Go to the source code of this file.

Classes

struct  d3dx9_file
 
struct  d3dx9_file_enum_object
 
struct  d3dx9_file_data
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static HRESULT error_dxfile_to_d3dxfile (HRESULT error)
 
static struct d3dx9_fileimpl_from_ID3DXFile (ID3DXFile *iface)
 
static struct d3dx9_file_enum_objectimpl_from_ID3DXFileEnumObject (ID3DXFileEnumObject *iface)
 
static struct d3dx9_file_dataimpl_from_ID3DXFileData (ID3DXFileData *iface)
 
static HRESULT WINAPI d3dx9_file_data_QueryInterface (ID3DXFileData *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx9_file_data_AddRef (ID3DXFileData *iface)
 
static ULONG WINAPI d3dx9_file_data_Release (ID3DXFileData *iface)
 
static HRESULT WINAPI d3dx9_file_data_GetEnum (ID3DXFileData *iface, ID3DXFileEnumObject **enum_object)
 
static HRESULT WINAPI d3dx9_file_data_GetName (ID3DXFileData *iface, char *name, SIZE_T *size)
 
static HRESULT WINAPI d3dx9_file_data_GetId (ID3DXFileData *iface, GUID *guid)
 
static HRESULT WINAPI d3dx9_file_data_Lock (ID3DXFileData *iface, SIZE_T *size, const void **data)
 
static HRESULT WINAPI d3dx9_file_data_Unlock (ID3DXFileData *iface)
 
static HRESULT WINAPI d3dx9_file_data_GetType (ID3DXFileData *iface, GUID *guid)
 
static BOOL WINAPI d3dx9_file_data_IsReference (ID3DXFileData *iface)
 
static HRESULT WINAPI d3dx9_file_data_GetChildren (ID3DXFileData *iface, SIZE_T *children)
 
static HRESULT WINAPI d3dx9_file_data_GetChild (ID3DXFileData *iface, SIZE_T id, ID3DXFileData **object)
 
static HRESULT d3dx9_file_data_create (IDirectXFileObject *dxfile_object, ID3DXFileData **ret_iface)
 
static HRESULT WINAPI d3dx9_file_enum_object_QueryInterface (ID3DXFileEnumObject *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx9_file_enum_object_AddRef (ID3DXFileEnumObject *iface)
 
static ULONG WINAPI d3dx9_file_enum_object_Release (ID3DXFileEnumObject *iface)
 
static HRESULT WINAPI d3dx9_file_enum_object_GetFile (ID3DXFileEnumObject *iface, ID3DXFile **file)
 
static HRESULT WINAPI d3dx9_file_enum_object_GetChildren (ID3DXFileEnumObject *iface, SIZE_T *children)
 
static HRESULT WINAPI d3dx9_file_enum_object_GetChild (ID3DXFileEnumObject *iface, SIZE_T id, ID3DXFileData **object)
 
static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectById (ID3DXFileEnumObject *iface, REFGUID guid, ID3DXFileData **object)
 
static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectByName (ID3DXFileEnumObject *iface, const char *name, ID3DXFileData **object)
 
static HRESULT WINAPI d3dx9_file_QueryInterface (ID3DXFile *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx9_file_AddRef (ID3DXFile *iface)
 
static ULONG WINAPI d3dx9_file_Release (ID3DXFile *iface)
 
static HRESULT WINAPI d3dx9_file_CreateEnumObject (ID3DXFile *iface, const void *source, D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object)
 
static HRESULT WINAPI d3dx9_file_CreateSaveObject (ID3DXFile *iface, const void *data, D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object)
 
static HRESULT WINAPI d3dx9_file_RegisterTemplates (ID3DXFile *iface, const void *data, SIZE_T size)
 
static HRESULT WINAPI d3dx9_file_RegisterEnumTemplates (ID3DXFile *iface, ID3DXFileEnumObject *enum_object)
 
HRESULT WINAPI D3DXFileCreate (ID3DXFile **d3dxfile)
 

Variables

static const ID3DXFileDataVtbl d3dx9_file_data_vtbl
 
static const ID3DXFileEnumObjectVtbl d3dx9_file_enum_object_vtbl
 
static const ID3DXFileVtbl d3dx9_file_vtbl
 

Function Documentation

◆ d3dx9_file_AddRef()

static ULONG WINAPI d3dx9_file_AddRef ( ID3DXFile *  iface)
static

Definition at line 527 of file xfile.c.

528{
529 struct d3dx9_file *file = impl_from_ID3DXFile(iface);
530 ULONG refcount = InterlockedIncrement(&file->ref);
531
532 TRACE("%p increasing refcount to %u.\n", file, refcount);
533
534 return refcount;
535}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3dx9_file * impl_from_ID3DXFile(ID3DXFile *iface)
Definition: xfile.c:77
#define TRACE(s)
Definition: solgame.cpp:4
Definition: fci.c:127
LONG ref
Definition: filesystem.c:120
uint32_t ULONG
Definition: typedefs.h:59

◆ d3dx9_file_CreateEnumObject()

static HRESULT WINAPI d3dx9_file_CreateEnumObject ( ID3DXFile *  iface,
const void source,
D3DXF_FILELOADOPTIONS  options,
ID3DXFileEnumObject **  enum_object 
)
static

Definition at line 553 of file xfile.c.

555{
556 struct d3dx9_file *file = impl_from_ID3DXFile(iface);
558 IDirectXFileEnumObject *dxfile_enum_object;
559 void *dxfile_source;
560 DXFILELOADOPTIONS dxfile_options;
561 DXFILELOADRESOURCE dxfile_resource;
562 DXFILELOADMEMORY dxfile_memory;
563 IDirectXFileData *data_object;
564 unsigned children_array_size = 0;
565 HRESULT ret;
566
567 TRACE("iface %p, source %p, options %#x, enum_object %p.\n", iface, source, options, enum_object);
568
569 if (!enum_object)
570 return E_POINTER;
571
572 *enum_object = NULL;
573
575 {
576 dxfile_source = (void*)source;
577 dxfile_options = DXFILELOAD_FROMFILE;
578 }
580 {
582
583 dxfile_resource.hModule = resource->hModule;
584 dxfile_resource.lpName = resource->lpName;
585 dxfile_resource.lpType = resource->lpType;
586 dxfile_source = &dxfile_resource;
587 dxfile_options = DXFILELOAD_FROMRESOURCE;
588 }
590 {
592
593 dxfile_memory.lpMemory = (void *)memory->lpMemory;
594 dxfile_memory.dSize = memory->dSize;
595 dxfile_source = &dxfile_memory;
596 dxfile_options = DXFILELOAD_FROMMEMORY;
597 }
598 else
599 {
600 FIXME("Source type %u is not handled yet\n", options);
601 return E_NOTIMPL;
602 }
603
604 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
605 if (!object)
606 return E_OUTOFMEMORY;
607
608 object->ID3DXFileEnumObject_iface.lpVtbl = &d3dx9_file_enum_object_vtbl;
609 object->ref = 1;
610
611 ret = IDirectXFile_CreateEnumObject(file->dxfile, dxfile_source, dxfile_options, &dxfile_enum_object);
612
613 if (ret != S_OK)
614 {
615 HeapFree(GetProcessHeap(), 0, object);
616 return ret;
617 }
618
619 /* Fill enum object with top level data objects */
620 while (SUCCEEDED(ret = IDirectXFileEnumObject_GetNextDataObject(dxfile_enum_object, &data_object)))
621 {
622 if (object->nb_children >= children_array_size)
623 {
624 ID3DXFileData **new_children;
625
626 if (object->children)
627 {
628 children_array_size *= 2;
629 new_children = HeapReAlloc(GetProcessHeap(), 0, object->children,
630 sizeof(*object->children) * children_array_size);
631 }
632 else
633 {
634 children_array_size = 4;
635 new_children = HeapAlloc(GetProcessHeap(), 0, sizeof(*object->children) * children_array_size);
636 }
637 if (!new_children)
638 {
640 break;
641 }
642 object->children = new_children;
643 }
644 ret = d3dx9_file_data_create((IDirectXFileObject*)data_object,
645 &object->children[object->nb_children]);
646 IUnknown_Release(data_object);
647 if (FAILED(ret))
648 break;
649 object->nb_children++;
650 }
651 if (object->children)
652 {
653 ID3DXFileData **new_children;
654
655 new_children = HeapReAlloc(GetProcessHeap(), 0, object->children,
656 sizeof(*object->children) * object->nb_children);
657 if (new_children)
658 object->children = new_children;
659 }
660
661 IDirectXFileEnumObject_Release(dxfile_enum_object);
662
664 WARN("Cannot get all top level data objects\n");
665
666 TRACE("Found %u children\n", object->nb_children);
667
668 *enum_object = &object->ID3DXFileEnumObject_iface;
669
670 return S_OK;
671}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define D3DXF_FILELOAD_FROMFILE
Definition: d3dx9xof.h:38
#define D3DXF_FILELOAD_FROMRESOURCE
Definition: d3dx9xof.h:40
#define D3DXF_FILELOAD_FROMMEMORY
Definition: d3dx9xof.h:41
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
static const ID3DXFileEnumObjectVtbl d3dx9_file_enum_object_vtbl
Definition: xfile.c:497
static HRESULT d3dx9_file_data_create(IDirectXFileObject *dxfile_object, ID3DXFileData **ret_iface)
Definition: xfile.c:299
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
DWORD DXFILELOADOPTIONS
Definition: dxfile.h:35
#define IDirectXFileEnumObject_GetNextDataObject(p, a)
Definition: dxfile.h:109
#define IDirectXFileEnumObject_Release(p)
Definition: dxfile.h:107
#define DXFILELOAD_FROMFILE
Definition: dxfile.h:37
#define IDirectXFile_CreateEnumObject(p, a, b, c)
Definition: dxfile.h:84
#define DXFILELOAD_FROMRESOURCE
Definition: dxfile.h:38
#define DXFILEERR_NOMOREOBJECTS
Definition: dxfile.h:291
#define DXFILELOAD_FROMMEMORY
Definition: dxfile.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static char memory[1024 *256]
Definition: process.c:116
LPVOID lpMemory
Definition: dxfile.h:50
HMODULE hModule
Definition: dxfile.h:44
int ret
#define E_POINTER
Definition: winerror.h:2365

◆ d3dx9_file_CreateSaveObject()

static HRESULT WINAPI d3dx9_file_CreateSaveObject ( ID3DXFile *  iface,
const void data,
D3DXF_FILESAVEOPTIONS  options,
D3DXF_FILEFORMAT  format,
ID3DXFileSaveObject **  save_object 
)
static

Definition at line 673 of file xfile.c.

675{
676 FIXME("iface %p, data %p, options %#x, format %#x, save_object %p stub!\n",
677 iface, data, options, format, save_object);
678
679 return E_NOTIMPL;
680}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: format.c:58

◆ d3dx9_file_data_AddRef()

static ULONG WINAPI d3dx9_file_data_AddRef ( ID3DXFileData *  iface)
static

Definition at line 110 of file xfile.c.

111{
112 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
113 ULONG refcount = InterlockedIncrement(&file_data->ref);
114
115 TRACE("%p increasing refcount to %u.\n", file_data, refcount);
116
117 return refcount;
118}
static struct d3dx9_file_data * impl_from_ID3DXFileData(ID3DXFileData *iface)
Definition: xfile.c:87
LONG ref
Definition: xfile.c:70

◆ d3dx9_file_data_create()

static HRESULT d3dx9_file_data_create ( IDirectXFileObject *  dxfile_object,
ID3DXFileData **  ret_iface 
)
static

Definition at line 299 of file xfile.c.

300{
301 struct d3dx9_file_data *object;
302 IDirectXFileObject *data_object;
303 unsigned int children_array_size = 0;
304 HRESULT ret;
305
306 TRACE("dxfile_object %p, ret_iface %p.\n", dxfile_object, ret_iface);
307
308 *ret_iface = NULL;
309
310 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
311 if (!object)
312 return E_OUTOFMEMORY;
313
314 object->ID3DXFileData_iface.lpVtbl = &d3dx9_file_data_vtbl;
315 object->ref = 1;
316
317 ret = IDirectXFileObject_QueryInterface(dxfile_object, &IID_IDirectXFileData, (void **)&object->dxfile_data);
318 if (FAILED(ret))
319 {
320 IDirectXFileDataReference *reference;
321
322 ret = IDirectXFileObject_QueryInterface(dxfile_object, &IID_IDirectXFileDataReference, (void **)&reference);
323 if (SUCCEEDED(ret))
324 {
326 IUnknown_Release(reference);
327 if (FAILED(ret))
328 {
329 HeapFree(GetProcessHeap(), 0, object);
330 return E_FAIL;
331 }
332 object->reference = TRUE;
333 }
334 else
335 {
336 FIXME("Don't know what to do with binary object\n");
337 HeapFree(GetProcessHeap(), 0, object);
338 return E_FAIL;
339 }
340 }
341
342 while (SUCCEEDED(ret = IDirectXFileData_GetNextObject(object->dxfile_data, &data_object)))
343 {
344 if (object->nb_children >= children_array_size)
345 {
346 ID3DXFileData **new_children;
347
348 if (object->children)
349 {
350 children_array_size *= 2;
351 new_children = HeapReAlloc(GetProcessHeap(), 0, object->children,
352 sizeof(*object->children) * children_array_size);
353 }
354 else
355 {
356 children_array_size = 4;
357 new_children = HeapAlloc(GetProcessHeap(), 0, sizeof(*object->children) * children_array_size);
358 }
359 if (!new_children)
360 {
362 break;
363 }
364 object->children = new_children;
365 }
366 ret = d3dx9_file_data_create(data_object, &object->children[object->nb_children]);
367 IUnknown_Release(data_object);
368 if (FAILED(ret))
369 break;
370 object->nb_children++;
371 }
373 {
374 (&object->ID3DXFileData_iface)->lpVtbl->Release(&object->ID3DXFileData_iface);
375 return ret;
376 }
377 if (object->children)
378 {
379 ID3DXFileData **new_children;
380
381 new_children = HeapReAlloc(GetProcessHeap(), 0, object->children,
382 sizeof(*object->children) * object->nb_children);
383 if (new_children)
384 object->children = new_children;
385 }
386
387 TRACE("Found %u children\n", object->nb_children);
388
389 *ret_iface = &object->ID3DXFileData_iface;
390
391 return S_OK;
392}
#define E_FAIL
Definition: ddrawi.h:102
#define TRUE
Definition: types.h:120
static const ID3DXFileDataVtbl d3dx9_file_data_vtbl
Definition: xfile.c:283
#define IDirectXFileObject_QueryInterface(p, a, b)
Definition: dxfile.h:158
#define IDirectXFileDataReference_Resolve(p, a)
Definition: dxfile.h:217
#define IDirectXFileData_GetNextObject(p, a)
Definition: dxfile.h:192
GLint reference
Definition: glext.h:11729

Referenced by d3dx9_file_CreateEnumObject(), and d3dx9_file_data_create().

◆ d3dx9_file_data_GetChild()

static HRESULT WINAPI d3dx9_file_data_GetChild ( ID3DXFileData *  iface,
SIZE_T  id,
ID3DXFileData **  object 
)
static

Definition at line 268 of file xfile.c.

269{
270 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
271
272 TRACE("iface %p, id %#lx, object %p.\n", iface, id, object);
273
274 if (!object)
275 return E_POINTER;
276
277 *object = file_data->children[id];
278 (*object)->lpVtbl->AddRef(*object);
279
280 return S_OK;
281}
GLuint id
Definition: glext.h:5910
ID3DXFileData ** children
Definition: xfile.c:74

◆ d3dx9_file_data_GetChildren()

static HRESULT WINAPI d3dx9_file_data_GetChildren ( ID3DXFileData *  iface,
SIZE_T children 
)
static

Definition at line 254 of file xfile.c.

255{
256 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
257
258 TRACE("iface %p, children %p.\n", iface, children);
259
260 if (!children)
261 return E_POINTER;
262
263 *children = file_data->nb_children;
264
265 return S_OK;
266}
ULONG nb_children
Definition: xfile.c:73

◆ d3dx9_file_data_GetEnum()

static HRESULT WINAPI d3dx9_file_data_GetEnum ( ID3DXFileData *  iface,
ID3DXFileEnumObject **  enum_object 
)
static

Definition at line 144 of file xfile.c.

145{
146 FIXME("iface %p, enum_object %p stub!\n", iface, enum_object);
147
148 return E_NOTIMPL;
149}

◆ d3dx9_file_data_GetId()

static HRESULT WINAPI d3dx9_file_data_GetId ( ID3DXFileData *  iface,
GUID guid 
)
static

Definition at line 182 of file xfile.c.

183{
184 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
185 HRESULT ret;
186
187 TRACE("iface %p, guid %p.\n", iface, guid);
188
189 if (!guid)
190 return E_POINTER;
191
193 if (ret != DXFILE_OK)
195
196 return S_OK;
197}
static HRESULT error_dxfile_to_d3dxfile(HRESULT error)
Definition: xfile.c:32
#define IDirectXFileData_GetId(p, a)
Definition: dxfile.h:188
#define DXFILE_OK
Definition: dxfile.h:268
const GUID * guid
IDirectXFileData * dxfile_data
Definition: xfile.c:72

◆ d3dx9_file_data_GetName()

static HRESULT WINAPI d3dx9_file_data_GetName ( ID3DXFileData *  iface,
char name,
SIZE_T size 
)
static

Definition at line 151 of file xfile.c.

152{
153 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
154 DWORD dxfile_size;
155 HRESULT ret;
156
157 TRACE("iface %p, name %p, size %p.\n", iface, name, size);
158
159 if (!size)
160 return D3DXFERR_BADVALUE;
161
162 dxfile_size = *size;
163
164 ret = IDirectXFileData_GetName(file_data->dxfile_data, name, &dxfile_size);
165 if (ret != DXFILE_OK)
167
168 if (!dxfile_size)
169 {
170 /* Contrary to d3dxof, d3dx9_36 returns an empty string with a null byte when no name is available.
171 * If the input size is 0, it returns a length of 1 without touching the buffer */
172 dxfile_size = 1;
173 if (name && *size)
174 name[0] = 0;
175 }
176
177 *size = dxfile_size;
178
179 return S_OK;
180}
#define D3DXFERR_BADVALUE
Definition: d3dx9xof.h:164
#define IDirectXFileData_GetName(p, a, b)
Definition: dxfile.h:187
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
Definition: name.c:39

◆ d3dx9_file_data_GetType()

static HRESULT WINAPI d3dx9_file_data_GetType ( ID3DXFileData *  iface,
GUID guid 
)
static

Definition at line 228 of file xfile.c.

229{
230 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
231 const GUID *dxfile_guid;
232 HRESULT ret;
233
234 TRACE("iface %p, guid %p.\n", iface, guid);
235
236 ret = IDirectXFileData_GetType(file_data->dxfile_data, &dxfile_guid);
237 if (ret != DXFILE_OK)
239
240 *guid = *dxfile_guid;
241
242 return S_OK;
243}
#define IDirectXFileData_GetType(p, a)
Definition: dxfile.h:191

◆ d3dx9_file_data_IsReference()

static BOOL WINAPI d3dx9_file_data_IsReference ( ID3DXFileData *  iface)
static

Definition at line 245 of file xfile.c.

246{
247 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
248
249 TRACE("iface %p.\n", iface);
250
251 return file_data->reference;
252}
BOOL reference
Definition: xfile.c:71

◆ d3dx9_file_data_Lock()

static HRESULT WINAPI d3dx9_file_data_Lock ( ID3DXFileData *  iface,
SIZE_T size,
const void **  data 
)
static

Definition at line 199 of file xfile.c.

200{
201 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
202 DWORD dxfile_size;
203 HRESULT ret;
204
205 TRACE("iface %p, size %p, data %p.\n", iface, size, data);
206
207 if (!size || !data)
208 return E_POINTER;
209
210 ret = IDirectXFileData_GetData(file_data->dxfile_data, NULL, &dxfile_size, (void **)data);
211 if (ret != DXFILE_OK)
213
214 *size = dxfile_size;
215
216 return S_OK;
217}
#define IDirectXFileData_GetData(p, a, b, c)
Definition: dxfile.h:190

◆ d3dx9_file_data_QueryInterface()

static HRESULT WINAPI d3dx9_file_data_QueryInterface ( ID3DXFileData *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 92 of file xfile.c.

93{
94 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
95
96 if (IsEqualGUID(riid, &IID_ID3DXFileData)
98 {
99 iface->lpVtbl->AddRef(iface);
100 *out = iface;
101 return S_OK;
102 }
103
104 WARN("Interface %s not found.\n", debugstr_guid(riid));
105
106 *out = NULL;
107 return E_NOINTERFACE;
108}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static FILE * out
Definition: regtests2xml.c:44
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ d3dx9_file_data_Release()

static ULONG WINAPI d3dx9_file_data_Release ( ID3DXFileData *  iface)
static

Definition at line 120 of file xfile.c.

121{
122 struct d3dx9_file_data *file_data = impl_from_ID3DXFileData(iface);
123 ULONG refcount = InterlockedDecrement(&file_data->ref);
124
125 TRACE("%p decreasing refcount to %u.\n", file_data, refcount);
126
127 if (!refcount)
128 {
129 ULONG i;
130
131 for (i = 0; i < file_data->nb_children; ++i)
132 {
133 ID3DXFileData *child = file_data->children[i];
134 child->lpVtbl->Release(child);
135 }
136 HeapFree(GetProcessHeap(), 0, file_data->children);
138 HeapFree(GetProcessHeap(), 0, file_data);
139 }
140
141 return refcount;
142}
#define InterlockedDecrement
Definition: armddk.h:52
#define IDirectXFileData_Release(p)
Definition: dxfile.h:185
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
nsrefcnt Release()
static HWND child
Definition: cursoricon.c:298

◆ d3dx9_file_data_Unlock()

static HRESULT WINAPI d3dx9_file_data_Unlock ( ID3DXFileData *  iface)
static

Definition at line 219 of file xfile.c.

220{
221 TRACE("iface %p.\n", iface);
222
223 /* Nothing to do */
224
225 return S_OK;
226}

◆ d3dx9_file_enum_object_AddRef()

static ULONG WINAPI d3dx9_file_enum_object_AddRef ( ID3DXFileEnumObject *  iface)
static

Definition at line 412 of file xfile.c.

413{
414 struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
415 ULONG refcount = InterlockedIncrement(&file_enum->ref);
416
417 TRACE("%p increasing refcount to %u.\n", file_enum, refcount);
418
419 return refcount;
420}
static struct d3dx9_file_enum_object * impl_from_ID3DXFileEnumObject(ID3DXFileEnumObject *iface)
Definition: xfile.c:82

◆ d3dx9_file_enum_object_GetChild()

static HRESULT WINAPI d3dx9_file_enum_object_GetChild ( ID3DXFileEnumObject *  iface,
SIZE_T  id,
ID3DXFileData **  object 
)
static

Definition at line 466 of file xfile.c.

467{
468 struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
469
470 TRACE("iface %p, id %#lx, object %p.\n", iface, id, object);
471
472 if (!object)
473 return E_POINTER;
474
475 *object = file_enum->children[id];
476 (*object)->lpVtbl->AddRef(*object);
477
478 return S_OK;
479}
ID3DXFileData ** children
Definition: xfile.c:64

◆ d3dx9_file_enum_object_GetChildren()

static HRESULT WINAPI d3dx9_file_enum_object_GetChildren ( ID3DXFileEnumObject *  iface,
SIZE_T children 
)
static

Definition at line 452 of file xfile.c.

453{
454 struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
455
456 TRACE("iface %p, children %p.\n", iface, children);
457
458 if (!children)
459 return E_POINTER;
460
461 *children = file_enum->nb_children;
462
463 return S_OK;
464}

◆ d3dx9_file_enum_object_GetDataObjectById()

static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectById ( ID3DXFileEnumObject *  iface,
REFGUID  guid,
ID3DXFileData **  object 
)
static

Definition at line 481 of file xfile.c.

483{
484 FIXME("iface %p, guid %s, object %p stub!\n", iface, debugstr_guid(guid), object);
485
486 return E_NOTIMPL;
487}

◆ d3dx9_file_enum_object_GetDataObjectByName()

static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectByName ( ID3DXFileEnumObject *  iface,
const char name,
ID3DXFileData **  object 
)
static

Definition at line 489 of file xfile.c.

491{
492 FIXME("iface %p, name %s, object %p stub!\n", iface, debugstr_a(name), object);
493
494 return E_NOTIMPL;
495}
#define debugstr_a
Definition: kernel32.h:31

◆ d3dx9_file_enum_object_GetFile()

static HRESULT WINAPI d3dx9_file_enum_object_GetFile ( ID3DXFileEnumObject *  iface,
ID3DXFile **  file 
)
static

Definition at line 445 of file xfile.c.

446{
447 FIXME("iface %p, file %p stub!\n", iface, file);
448
449 return E_NOTIMPL;
450}

◆ d3dx9_file_enum_object_QueryInterface()

static HRESULT WINAPI d3dx9_file_enum_object_QueryInterface ( ID3DXFileEnumObject *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 394 of file xfile.c.

395{
396 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
397
398 if (IsEqualGUID(riid, &IID_ID3DXFileEnumObject)
400 {
401 iface->lpVtbl->AddRef(iface);
402 *out = iface;
403 return S_OK;
404 }
405
406 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
407
408 *out = NULL;
409 return E_NOINTERFACE;
410}

◆ d3dx9_file_enum_object_Release()

static ULONG WINAPI d3dx9_file_enum_object_Release ( ID3DXFileEnumObject *  iface)
static

Definition at line 422 of file xfile.c.

423{
424 struct d3dx9_file_enum_object *file_enum = impl_from_ID3DXFileEnumObject(iface);
425 ULONG refcount = InterlockedDecrement(&file_enum->ref);
426
427 TRACE("%p decreasing refcount to %u.\n", file_enum, refcount);
428
429 if (!refcount)
430 {
431 ULONG i;
432
433 for (i = 0; i < file_enum->nb_children; ++i)
434 {
435 ID3DXFileData *child = file_enum->children[i];
436 child->lpVtbl->Release(child);
437 }
438 HeapFree(GetProcessHeap(), 0, file_enum->children);
439 HeapFree(GetProcessHeap(), 0, file_enum);
440 }
441
442 return refcount;
443}

◆ d3dx9_file_QueryInterface()

static HRESULT WINAPI d3dx9_file_QueryInterface ( ID3DXFile *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 509 of file xfile.c.

510{
511 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
512
513 if (IsEqualGUID(riid, &IID_ID3DXFile)
515 {
516 iface->lpVtbl->AddRef(iface);
517 *out = iface;
518 return S_OK;
519 }
520
521 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
522
523 *out = NULL;
524 return E_NOINTERFACE;
525}

◆ d3dx9_file_RegisterEnumTemplates()

static HRESULT WINAPI d3dx9_file_RegisterEnumTemplates ( ID3DXFile *  iface,
ID3DXFileEnumObject *  enum_object 
)
static

Definition at line 699 of file xfile.c.

700{
701 FIXME("iface %p, enum_object %p stub!\n", iface, enum_object);
702
703 return E_NOTIMPL;
704}

◆ d3dx9_file_RegisterTemplates()

static HRESULT WINAPI d3dx9_file_RegisterTemplates ( ID3DXFile *  iface,
const void data,
SIZE_T  size 
)
static

Definition at line 682 of file xfile.c.

683{
684 struct d3dx9_file *file = impl_from_ID3DXFile(iface);
685 HRESULT ret;
686
687 TRACE("iface %p, data %p, size %lu.\n", iface, data, size);
688
689 ret = IDirectXFile_RegisterTemplates(file->dxfile, (void *)data, size);
690 if (ret != DXFILE_OK)
691 {
692 WARN("Error %#x\n", ret);
694 }
695
696 return S_OK;
697}
#define IDirectXFile_RegisterTemplates(p, a, b)
Definition: dxfile.h:86

◆ d3dx9_file_Release()

static ULONG WINAPI d3dx9_file_Release ( ID3DXFile *  iface)
static

Definition at line 537 of file xfile.c.

538{
539 struct d3dx9_file *file = impl_from_ID3DXFile(iface);
540 ULONG refcount = InterlockedDecrement(&file->ref);
541
542 TRACE("%p decreasing refcount to %u.\n", file, refcount);
543
544 if (!refcount)
545 {
546 IDirectXFile_Release(file->dxfile);
548 }
549
550 return refcount;
551}
#define IDirectXFile_Release(p)
Definition: dxfile.h:82

◆ D3DXFileCreate()

HRESULT WINAPI D3DXFileCreate ( ID3DXFile **  d3dxfile)

Definition at line 717 of file xfile.c.

718{
719 struct d3dx9_file *object;
720 HRESULT ret;
721
722 TRACE("d3dxfile %p.\n", d3dxfile);
723
724 if (!d3dxfile)
725 return E_POINTER;
726
727 *d3dxfile = NULL;
728
729 object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
730 if (!object)
731 return E_OUTOFMEMORY;
732
733 ret = DirectXFileCreate(&object->dxfile);
734 if (ret != S_OK)
735 {
736 HeapFree(GetProcessHeap(), 0, object);
737 if (ret == E_OUTOFMEMORY)
738 return ret;
739 return E_FAIL;
740 }
741
742 object->ID3DXFile_iface.lpVtbl = &d3dx9_file_vtbl;
743 object->ref = 1;
744
745 *d3dxfile = &object->ID3DXFile_iface;
746
747 return S_OK;
748}
static const ID3DXFileVtbl d3dx9_file_vtbl
Definition: xfile.c:706
HRESULT WINAPI DirectXFileCreate(LPDIRECTXFILE *lplpDirectXFile)
Definition: main.c:153

Referenced by D3DXLoadMeshFromXInMemory(), D3DXLoadMeshHierarchyFromXInMemory(), get_mesh_data(), test_dump(), test_getname(), test_lock_unlock(), test_templates(), and test_type_index_color().

◆ error_dxfile_to_d3dxfile()

static HRESULT error_dxfile_to_d3dxfile ( HRESULT  error)
static

Definition at line 32 of file xfile.c.

33{
34 switch (error)
35 {
45 return D3DXFERR_BADVALUE;
46 default:
47 FIXME("Cannot map error %#x\n", error);
48 return E_FAIL;
49 }
50}
#define D3DXFERR_BADFILEVERSION
Definition: d3dx9xof.h:172
#define D3DXFERR_BADFILEFLOATSIZE
Definition: d3dx9xof.h:173
#define D3DXFERR_PARSEERROR
Definition: d3dx9xof.h:175
#define D3DXFERR_BADFILETYPE
Definition: d3dx9xof.h:171
#define DXFILEERR_BADFILEVERSION
Definition: dxfile.h:282
#define DXFILEERR_BADFILEFLOATSIZE
Definition: dxfile.h:283
#define DXFILEERR_BADFILETYPE
Definition: dxfile.h:281
#define DXFILEERR_PARSEERROR
Definition: dxfile.h:286
#define DXFILEERR_BADVALUE
Definition: dxfile.h:271
#define error(str)
Definition: mkdosfs.c:1605

Referenced by d3dx9_file_data_GetId(), d3dx9_file_data_GetName(), d3dx9_file_data_GetType(), d3dx9_file_data_Lock(), and d3dx9_file_RegisterTemplates().

◆ impl_from_ID3DXFile()

static struct d3dx9_file * impl_from_ID3DXFile ( ID3DXFile *  iface)
inlinestatic

Definition at line 77 of file xfile.c.

78{
79 return CONTAINING_RECORD(iface, struct d3dx9_file, ID3DXFile_iface);
80}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by d3dx9_file_AddRef(), d3dx9_file_CreateEnumObject(), d3dx9_file_RegisterTemplates(), and d3dx9_file_Release().

◆ impl_from_ID3DXFileData()

static struct d3dx9_file_data * impl_from_ID3DXFileData ( ID3DXFileData *  iface)
inlinestatic

◆ impl_from_ID3DXFileEnumObject()

static struct d3dx9_file_enum_object * impl_from_ID3DXFileEnumObject ( ID3DXFileEnumObject *  iface)
inlinestatic

Definition at line 82 of file xfile.c.

83{
84 return CONTAINING_RECORD(iface, struct d3dx9_file_enum_object, ID3DXFileEnumObject_iface);
85}

Referenced by d3dx9_file_enum_object_AddRef(), d3dx9_file_enum_object_GetChild(), d3dx9_file_enum_object_GetChildren(), and d3dx9_file_enum_object_Release().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dx  )

Variable Documentation

◆ d3dx9_file_data_vtbl

const ID3DXFileDataVtbl d3dx9_file_data_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3dx9_file_data_GetEnum(ID3DXFileData *iface, ID3DXFileEnumObject **enum_object)
Definition: xfile.c:144
static HRESULT WINAPI d3dx9_file_data_GetChild(ID3DXFileData *iface, SIZE_T id, ID3DXFileData **object)
Definition: xfile.c:268
static HRESULT WINAPI d3dx9_file_data_Lock(ID3DXFileData *iface, SIZE_T *size, const void **data)
Definition: xfile.c:199
static HRESULT WINAPI d3dx9_file_data_GetType(ID3DXFileData *iface, GUID *guid)
Definition: xfile.c:228
static HRESULT WINAPI d3dx9_file_data_Unlock(ID3DXFileData *iface)
Definition: xfile.c:219
static ULONG WINAPI d3dx9_file_data_AddRef(ID3DXFileData *iface)
Definition: xfile.c:110
static HRESULT WINAPI d3dx9_file_data_GetId(ID3DXFileData *iface, GUID *guid)
Definition: xfile.c:182
static HRESULT WINAPI d3dx9_file_data_GetChildren(ID3DXFileData *iface, SIZE_T *children)
Definition: xfile.c:254
static HRESULT WINAPI d3dx9_file_data_QueryInterface(ID3DXFileData *iface, REFIID riid, void **out)
Definition: xfile.c:92
static ULONG WINAPI d3dx9_file_data_Release(ID3DXFileData *iface)
Definition: xfile.c:120
static HRESULT WINAPI d3dx9_file_data_GetName(ID3DXFileData *iface, char *name, SIZE_T *size)
Definition: xfile.c:151
static BOOL WINAPI d3dx9_file_data_IsReference(ID3DXFileData *iface)
Definition: xfile.c:245

Definition at line 283 of file xfile.c.

Referenced by d3dx9_file_data_create().

◆ d3dx9_file_enum_object_vtbl

const ID3DXFileEnumObjectVtbl d3dx9_file_enum_object_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectByName(ID3DXFileEnumObject *iface, const char *name, ID3DXFileData **object)
Definition: xfile.c:489
static HRESULT WINAPI d3dx9_file_enum_object_GetChildren(ID3DXFileEnumObject *iface, SIZE_T *children)
Definition: xfile.c:452
static HRESULT WINAPI d3dx9_file_enum_object_GetChild(ID3DXFileEnumObject *iface, SIZE_T id, ID3DXFileData **object)
Definition: xfile.c:466
static HRESULT WINAPI d3dx9_file_enum_object_QueryInterface(ID3DXFileEnumObject *iface, REFIID riid, void **out)
Definition: xfile.c:394
static ULONG WINAPI d3dx9_file_enum_object_Release(ID3DXFileEnumObject *iface)
Definition: xfile.c:422
static ULONG WINAPI d3dx9_file_enum_object_AddRef(ID3DXFileEnumObject *iface)
Definition: xfile.c:412
static HRESULT WINAPI d3dx9_file_enum_object_GetFile(ID3DXFileEnumObject *iface, ID3DXFile **file)
Definition: xfile.c:445
static HRESULT WINAPI d3dx9_file_enum_object_GetDataObjectById(ID3DXFileEnumObject *iface, REFGUID guid, ID3DXFileData **object)
Definition: xfile.c:481

Definition at line 497 of file xfile.c.

Referenced by d3dx9_file_CreateEnumObject().

◆ d3dx9_file_vtbl

const ID3DXFileVtbl d3dx9_file_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3dx9_file_CreateEnumObject(ID3DXFile *iface, const void *source, D3DXF_FILELOADOPTIONS options, ID3DXFileEnumObject **enum_object)
Definition: xfile.c:553
static HRESULT WINAPI d3dx9_file_CreateSaveObject(ID3DXFile *iface, const void *data, D3DXF_FILESAVEOPTIONS options, D3DXF_FILEFORMAT format, ID3DXFileSaveObject **save_object)
Definition: xfile.c:673
static HRESULT WINAPI d3dx9_file_RegisterTemplates(ID3DXFile *iface, const void *data, SIZE_T size)
Definition: xfile.c:682
static HRESULT WINAPI d3dx9_file_QueryInterface(ID3DXFile *iface, REFIID riid, void **out)
Definition: xfile.c:509
static HRESULT WINAPI d3dx9_file_RegisterEnumTemplates(ID3DXFile *iface, ID3DXFileEnumObject *enum_object)
Definition: xfile.c:699
static ULONG WINAPI d3dx9_file_Release(ID3DXFile *iface)
Definition: xfile.c:537
static ULONG WINAPI d3dx9_file_AddRef(ID3DXFile *iface)
Definition: xfile.c:527

Definition at line 706 of file xfile.c.

Referenced by D3DXFileCreate().