push 212f1dad91f15aefd8e676124180e0b86d7c9ee6
[wine/hacks.git] / dlls / d3dxof / d3dxof_private.h
blob585f9d5ab03c23c8a3f6b29e16323c99a6f33d4b
1 /*
2 * DirectX File private interfaces (D3DXOF.DLL)
4 * Copyright 2004, 2008 Christian Costa
6 * This file contains the (internal) driver registration functions,
7 * driver enumeration APIs and DirectDraw creation functions.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #ifndef __D3DXOF_PRIVATE_INCLUDED__
25 #define __D3DXOF_PRIVATE_INCLUDED__
27 #include <stdarg.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "wtypes.h"
32 #include "wingdi.h"
33 #include "winuser.h"
34 #include "dxfile.h"
36 #define MAX_NAME_LEN 32
37 #define MAX_ARRAY_DIM 4
38 #define MAX_MEMBERS 50
39 #define MAX_CHILDS 100
40 #define MAX_TEMPLATES 200
41 #define MAX_OBJECTS 500
42 #define MAX_SUBOBJECTS 500
43 #define MAX_STRINGS_BUFFER 10000
45 #define MAX_DATA_SIZE 400000
47 typedef struct {
48 DWORD type;
49 LONG idx_template;
50 char name[MAX_NAME_LEN];
51 ULONG nb_dims;
52 BOOL dim_fixed[MAX_ARRAY_DIM]; /* fixed or variable */
53 ULONG dim_value[MAX_ARRAY_DIM]; /* fixed value or member index */
54 } member;
56 typedef struct {
57 char name[MAX_NAME_LEN];
58 GUID class_id;
59 BOOL open;
60 BOOL binary;
61 ULONG nb_childs;
62 char childs[MAX_CHILDS][MAX_NAME_LEN];
63 ULONG nb_members;
64 member members[MAX_MEMBERS];
65 } xtemplate;
67 typedef struct {
68 char* name;
69 LPBYTE start;
70 ULONG size;
71 } xobject_member;
73 struct _xobject {
74 BOOL binary;
75 struct _xobject* ptarget;
76 char name[MAX_NAME_LEN];
77 GUID class_id;
78 GUID type;
79 LPBYTE pdata;
80 DWORD size;
81 ULONG nb_members;
82 xobject_member members[MAX_MEMBERS];
83 ULONG nb_childs;
84 ULONG nb_subobjects;
85 struct _xobject * childs[MAX_CHILDS];
88 typedef struct _xobject xobject;
90 typedef struct {
91 IDirectXFile lpVtbl;
92 LONG ref;
93 ULONG nb_xtemplates;
94 xtemplate xtemplates[MAX_TEMPLATES];
95 } IDirectXFileImpl;
97 typedef struct {
98 IDirectXFileBinary lpVtbl;
99 LONG ref;
100 } IDirectXFileBinaryImpl;
102 typedef struct {
103 IDirectXFileData lpVtbl;
104 LONG ref;
105 xobject* pobj;
106 int cur_enum_object;
107 BOOL from_ref;
108 ULONG level;
109 LPBYTE pdata;
110 LPBYTE pstrings;
111 } IDirectXFileDataImpl;
113 typedef struct {
114 IDirectXFileDataReference lpVtbl;
115 LONG ref;
116 xobject* ptarget;
117 } IDirectXFileDataReferenceImpl;
119 typedef struct {
120 IDirectXFileObject lpVtbl;
121 LONG ref;
122 } IDirectXFileObjectImpl;
124 typedef struct {
125 /* Buffer to parse */
126 LPBYTE buffer;
127 DWORD rem_bytes;
128 /* Misc info */
129 WORD current_token;
130 BOOL token_present;
131 BOOL txt;
132 ULONG cur_subobject;
133 LPBYTE cur_pdata;
134 LPBYTE cur_pstrings;
135 BYTE value[100];
136 xobject** pxo_globals;
137 ULONG nb_pxo_globals;
138 xobject* pxo_tab;
139 IDirectXFileImpl* pdxf;
140 xobject* pxo;
141 xtemplate* pxt[MAX_SUBOBJECTS];
142 ULONG level;
143 LPBYTE pdata;
144 LPBYTE pstrings;
145 } parse_buffer;
147 typedef struct {
148 IDirectXFileEnumObject lpVtbl;
149 LONG ref;
150 DXFILELOADOPTIONS source;
151 HANDLE hFile;
152 parse_buffer buf;
153 IDirectXFileImpl* pDirectXFile;
154 ULONG nb_xobjects;
155 xobject* xobjects[MAX_OBJECTS];
156 IDirectXFileData* pRefObjects[MAX_OBJECTS];
157 } IDirectXFileEnumObjectImpl;
159 typedef struct {
160 IDirectXFileSaveObject lpVtbl;
161 LONG ref;
162 } IDirectXFileSaveObjectImpl;
164 HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj);
165 HRESULT IDirectXFileFileObjectImpl_Create(IDirectXFileObjectImpl** ppObj);
166 HRESULT IDirectXFileFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj);
168 BOOL read_bytes(parse_buffer * buf, LPVOID data, DWORD size);
169 BOOL parse_template(parse_buffer * buf);
170 void dump_template(xtemplate* templates_array, xtemplate* ptemplate);
171 BOOL is_template_available(parse_buffer * buf);
172 BOOL parse_object(parse_buffer * buf);
174 #endif /* __D3DXOF_PRIVATE_INCLUDED__ */