Sync to trunk revision 61757.
[reactos.git] / dll / directx / wine / d3dxof / d3dxof_private.h
1 /*
2 * DirectX File private interfaces (D3DXOF.DLL)
3 *
4 * Copyright 2004, 2008 Christian Costa
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #ifndef __D3DXOF_PRIVATE_INCLUDED__
22 #define __D3DXOF_PRIVATE_INCLUDED__
23
24 #include <config.h>
25
26 #include <stdio.h>
27
28 #define WIN32_NO_STATUS
29 #define _INC_WINDOWS
30 #define COM_NO_WINDOWS_H
31
32 #define COBJMACROS
33
34 #include <windef.h>
35 #include <winbase.h>
36 #include <dxfile.h>
37
38 #include <wine/debug.h>
39
40 #define MAX_NAME_LEN 40
41 #define MAX_ARRAY_DIM 4
42 #define MAX_MEMBERS 50
43 #define MAX_CHILDREN 200
44 #define MAX_TEMPLATES 200
45 #define MAX_OBJECTS 500
46 #define MAX_SUBOBJECTS 2000
47 #define MAX_STRINGS_BUFFER 10000
48
49 typedef struct {
50 DWORD type;
51 LONG idx_template;
52 char name[MAX_NAME_LEN];
53 ULONG nb_dims;
54 BOOL dim_fixed[MAX_ARRAY_DIM]; /* fixed or variable */
55 ULONG dim_value[MAX_ARRAY_DIM]; /* fixed value or member index */
56 } member;
57
58 typedef struct {
59 char name[MAX_NAME_LEN];
60 GUID class_id;
61 BOOL open;
62 BOOL binary;
63 ULONG nb_children;
64 char children[MAX_CHILDREN][MAX_NAME_LEN];
65 ULONG nb_members;
66 member members[MAX_MEMBERS];
67 } xtemplate;
68
69 typedef struct {
70 char* name;
71 ULONG start;
72 ULONG size;
73 } xobject_member;
74
75 struct _xobject {
76 BOOL binary;
77 struct _xobject* ptarget;
78 char name[MAX_NAME_LEN];
79 GUID class_id;
80 GUID type;
81 LPBYTE pdata;
82 ULONG pos_data;
83 DWORD size;
84 ULONG nb_members;
85 xobject_member members[MAX_MEMBERS];
86 ULONG nb_children;
87 ULONG nb_subobjects;
88 struct _xobject * children[MAX_CHILDREN];
89 struct _xobject * root;
90 };
91
92 typedef struct _xobject xobject;
93
94 typedef struct {
95 IDirectXFile IDirectXFile_iface;
96 LONG ref;
97 ULONG nb_xtemplates;
98 xtemplate xtemplates[MAX_TEMPLATES];
99 } IDirectXFileImpl;
100
101 typedef struct {
102 IDirectXFileBinary IDirectXFileBinary_iface;
103 LONG ref;
104 } IDirectXFileBinaryImpl;
105
106 typedef struct {
107 IDirectXFileData IDirectXFileData_iface;
108 LONG ref;
109 xobject* pobj;
110 int cur_enum_object;
111 BOOL from_ref;
112 ULONG level;
113 LPBYTE pstrings;
114 } IDirectXFileDataImpl;
115
116 typedef struct {
117 IDirectXFileDataReference IDirectXFileDataReference_iface;
118 LONG ref;
119 xobject* ptarget;
120 } IDirectXFileDataReferenceImpl;
121
122 typedef struct {
123 IDirectXFileObject IDirectXFileObject_iface;
124 LONG ref;
125 } IDirectXFileObjectImpl;
126
127 typedef struct {
128 /* Buffer to parse */
129 LPBYTE buffer;
130 DWORD rem_bytes;
131 /* Misc info */
132 WORD current_token;
133 BOOL token_present;
134 BOOL txt;
135 DWORD list_nb_elements;
136 BOOL list_type_float;
137 BOOL list_separator;
138 ULONG cur_pos_data;
139 LPBYTE cur_pstrings;
140 BYTE value[100];
141 xobject** pxo_globals;
142 ULONG nb_pxo_globals;
143 xobject* pxo_tab;
144 IDirectXFileImpl* pdxf;
145 xobject* pxo;
146 xtemplate* pxt[MAX_SUBOBJECTS];
147 ULONG level;
148 LPBYTE pdata;
149 ULONG capacity;
150 LPBYTE pstrings;
151 } parse_buffer;
152
153 typedef struct {
154 IDirectXFileEnumObject IDirectXFileEnumObject_iface;
155 LONG ref;
156 LPBYTE mapped_memory;
157 LPBYTE decomp_buffer;
158 parse_buffer buf;
159 IDirectXFileImpl* pDirectXFile;
160 ULONG nb_xobjects;
161 xobject* xobjects[MAX_OBJECTS];
162 IDirectXFileData* pRefObjects[MAX_OBJECTS];
163 } IDirectXFileEnumObjectImpl;
164
165 typedef struct {
166 IDirectXFileSaveObject IDirectXFileSaveObject_iface;
167 LONG ref;
168 } IDirectXFileSaveObjectImpl;
169
170 HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
171
172 HRESULT parse_header(parse_buffer *buf, BYTE **decomp_buffer_ptr) DECLSPEC_HIDDEN;
173 BOOL parse_object(parse_buffer * buf) DECLSPEC_HIDDEN;
174 BOOL parse_templates(parse_buffer * buf, BOOL templates_only) DECLSPEC_HIDDEN;
175
176 int mszip_decompress(int inlen, int outlen, char* inbuffer, char* outbuffer) DECLSPEC_HIDDEN;
177
178 #endif /* __D3DXOF_PRIVATE_INCLUDED__ */