1#undef INTERFACE
2/*
3 * Copyright 2011 Dylan Smith
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#ifndef __WINE_D3DX9XOF_H
21#define __WINE_D3DX9XOF_H
22
23#include "d3dx9.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef DWORD D3DXF_FILEFORMAT;
30#define D3DXF_FILEFORMAT_BINARY     0
31#define D3DXF_FILEFORMAT_TEXT       1
32#define D3DXF_FILEFORMAT_COMPRESSED 2
33
34typedef DWORD D3DXF_FILESAVEOPTIONS;
35#define D3DXF_FILESAVE_TOFILE   0x00
36#define D3DXF_FILESAVE_TOWFILE  0x01
37
38typedef DWORD D3DXF_FILELOADOPTIONS;
39#define D3DXF_FILELOAD_FROMFILE     0x00
40#define D3DXF_FILELOAD_FROMWFILE    0x01
41#define D3DXF_FILELOAD_FROMRESOURCE 0x02
42#define D3DXF_FILELOAD_FROMMEMORY   0x03
43
44typedef struct _D3DXF_FILELOADRESOURCE {
45    HMODULE hModule;
46    LPCSTR lpName;
47    LPCSTR lpType;
48} D3DXF_FILELOADRESOURCE;
49
50typedef struct _D3DXF_FILELOADMEMORY {
51    LPVOID lpMemory;
52    SIZE_T dSize;
53} D3DXF_FILELOADMEMORY;
54
55
56#ifndef _NO_COM
57DEFINE_GUID(IID_ID3DXFile,           0xcef08cf9, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01);
58DEFINE_GUID(IID_ID3DXFileSaveObject, 0xcef08cfa, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01);
59DEFINE_GUID(IID_ID3DXFileSaveData,   0xcef08cfb, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01);
60DEFINE_GUID(IID_ID3DXFileEnumObject, 0xcef08cfc, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01);
61DEFINE_GUID(IID_ID3DXFileData,       0xcef08cfd, 0x7b4f, 0x4429, 0x96, 0x24, 0x2a, 0x69, 0x0a, 0x93, 0x32, 0x01);
62#endif /* _NO_COM */
63
64typedef interface ID3DXFile *LPD3DXFILE, **LPLPD3DXFILE;
65typedef interface ID3DXFileSaveObject *LPD3DXFILESAVEOBJECT, **LPLPD3DXFILESAVEOBJECT;
66typedef interface ID3DXFileSaveData *LPD3DXFILESAVEDATA, **LPLPD3DXFILESAVEDATA;
67typedef interface ID3DXFileEnumObject *LPD3DXFILEENUMOBJECT, **LPLPD3DXFILEENUMOBJECT;
68typedef interface ID3DXFileData *LPD3DXFILEDATA, **LPLPD3DXFILEDATA;
69
70STDAPI D3DXFileCreate(struct ID3DXFile **file);
71
72#define INTERFACE ID3DXFile
73DECLARE_INTERFACE_IID_(ID3DXFile,IUnknown,"cef08cf9-7b4f-4429-9624-2a690a933201")
74{
75    /*** IUnknown methods ***/
76    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE;
77    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
78    STDMETHOD_(ULONG,Release)(THIS) PURE;
79    /*** ID3DXFile methods ***/
80    STDMETHOD(CreateEnumObject)(THIS_ const void *src, D3DXF_FILELOADOPTIONS type,
81            struct ID3DXFileEnumObject **enum_obj) PURE;
82    STDMETHOD(CreateSaveObject)(THIS_ const void *data, D3DXF_FILESAVEOPTIONS flags,
83            D3DXF_FILEFORMAT format, struct ID3DXFileSaveObject **save_obj) PURE;
84    STDMETHOD(RegisterTemplates)(THIS_ LPCVOID, SIZE_T) PURE;
85    STDMETHOD(RegisterEnumTemplates)(THIS_ struct ID3DXFileEnumObject *enum_obj) PURE;
86};
87#undef INTERFACE
88
89#define INTERFACE ID3DXFileSaveObject
90DECLARE_INTERFACE_IID_(ID3DXFileSaveObject,IUnknown,"cef08cfa-7b4f-4429-9624-2a690a933201")
91{
92    /*** IUnknown methods ***/
93    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE;
94    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
95    STDMETHOD_(ULONG,Release)(THIS) PURE;
96    /*** ID3DXFileSaveObject methods ***/
97    STDMETHOD(GetFile)(THIS_ ID3DXFile **file) PURE;
98    STDMETHOD(AddDataObject)(THIS_ REFGUID template_guid, const char *name, const GUID *guid,
99            SIZE_T data_size, const void *data, struct ID3DXFileSaveData **obj) PURE;
100    STDMETHOD(Save)(THIS) PURE;
101};
102#undef INTERFACE
103
104#define INTERFACE ID3DXFileSaveData
105DECLARE_INTERFACE_IID_(ID3DXFileSaveData,IUnknown,"cef08cfb-7b4f-4429-9624-2a690a933201")
106{
107    /*** IUnknown methods ***/
108    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE;
109    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
110    STDMETHOD_(ULONG,Release)(THIS) PURE;
111    /*** ID3DXFileSaveObject methods ***/
112    STDMETHOD(GetSave)(THIS_ ID3DXFileSaveObject **save_obj) PURE;
113    STDMETHOD(GetName)(THIS_ LPSTR, SIZE_T*) PURE;
114    STDMETHOD(GetId)(THIS_ LPGUID) PURE;
115    STDMETHOD(GetType)(THIS_ GUID*) PURE;
116    STDMETHOD(AddDataObject)(THIS_ REFGUID template_guid, const char *name, const GUID *guid,
117            SIZE_T data_size, const void *data, ID3DXFileSaveData **obj) PURE;
118    STDMETHOD(AddDataReference)(THIS_ LPCSTR, CONST GUID*) PURE;
119};
120#undef INTERFACE
121
122
123#define INTERFACE ID3DXFileEnumObject
124DECLARE_INTERFACE_IID_(ID3DXFileEnumObject,IUnknown,"cef08cfc-7b4f-4429-9624-2a690a933201")
125{
126    /*** IUnknown methods ***/
127    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE;
128    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
129    STDMETHOD_(ULONG,Release)(THIS) PURE;
130    /*** ID3DXFileEnumObject methods ***/
131    STDMETHOD(GetFile)(THIS_ ID3DXFile **file) PURE;
132    STDMETHOD(GetChildren)(THIS_ SIZE_T*) PURE;
133    STDMETHOD(GetChild)(THIS_ SIZE_T id, struct ID3DXFileData **child) PURE;
134    STDMETHOD(GetDataObjectById)(THIS_ REFGUID guid, struct ID3DXFileData **obj) PURE;
135    STDMETHOD(GetDataObjectByName)(THIS_ const char *name, struct ID3DXFileData **obj) PURE;
136};
137#undef INTERFACE
138
139#define INTERFACE ID3DXFileData
140DECLARE_INTERFACE_IID_(ID3DXFileData,IUnknown,"cef08cfd-7b4f-4429-9624-2a690a933201")
141{
142    /*** IUnknown methods ***/
143    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID, LPVOID*) PURE;
144    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
145    STDMETHOD_(ULONG,Release)(THIS) PURE;
146    /*** ID3DXFileData methods ***/
147    STDMETHOD(GetEnum)(THIS_ ID3DXFileEnumObject **enum_obj) PURE;
148    STDMETHOD(GetName)(THIS_ LPSTR, SIZE_T*) PURE;
149    STDMETHOD(GetId)(THIS_ LPGUID) PURE;
150    STDMETHOD(Lock)(THIS_ SIZE_T*, LPCVOID*) PURE;
151    STDMETHOD(Unlock)(THIS) PURE;
152    STDMETHOD(GetType)(THIS_ GUID*) PURE;
153    STDMETHOD_(WINBOOL,IsReference)(THIS) PURE;
154    STDMETHOD(GetChildren)(THIS_ SIZE_T*) PURE;
155    STDMETHOD(GetChild)(THIS_ SIZE_T id, ID3DXFileData **child) PURE;
156};
157#undef INTERFACE
158
159/* D3DX File errors */
160#define _FACD3DXF 0x876
161
162#define D3DXFERR_BADOBJECT          MAKE_HRESULT(1,_FACD3DXF,900)
163#define D3DXFERR_BADVALUE           MAKE_HRESULT(1,_FACD3DXF,901)
164#define D3DXFERR_BADTYPE            MAKE_HRESULT(1,_FACD3DXF,902)
165#define D3DXFERR_NOTFOUND           MAKE_HRESULT(1,_FACD3DXF,903)
166#define D3DXFERR_NOTDONEYET         MAKE_HRESULT(1,_FACD3DXF,904)
167#define D3DXFERR_FILENOTFOUND       MAKE_HRESULT(1,_FACD3DXF,905)
168#define D3DXFERR_RESOURCENOTFOUND   MAKE_HRESULT(1,_FACD3DXF,906)
169#define D3DXFERR_BADRESOURCE        MAKE_HRESULT(1,_FACD3DXF,907)
170#define D3DXFERR_BADFILETYPE        MAKE_HRESULT(1,_FACD3DXF,908)
171#define D3DXFERR_BADFILEVERSION     MAKE_HRESULT(1,_FACD3DXF,909)
172#define D3DXFERR_BADFILEFLOATSIZE   MAKE_HRESULT(1,_FACD3DXF,910)
173#define D3DXFERR_BADFILE            MAKE_HRESULT(1,_FACD3DXF,911)
174#define D3DXFERR_PARSEERROR         MAKE_HRESULT(1,_FACD3DXF,912)
175#define D3DXFERR_BADARRAYSIZE       MAKE_HRESULT(1,_FACD3DXF,913)
176#define D3DXFERR_BADDATAREFERENCE   MAKE_HRESULT(1,_FACD3DXF,914)
177#define D3DXFERR_NOMOREOBJECTS      MAKE_HRESULT(1,_FACD3DXF,915)
178#define D3DXFERR_NOMOREDATA         MAKE_HRESULT(1,_FACD3DXF,916)
179#define D3DXFERR_BADCACHEFILE       MAKE_HRESULT(1,_FACD3DXF,917)
180
181#ifdef __cplusplus
182}
183#endif
184
185#endif /* __WINE_D3DX9XOF_H */
186