[D3DXOF] Sync with Wine Staging 4.18. CORE-16441
[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 <stdarg.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wtypes.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "dxfile.h"
32
33 #define MAX_NAME_LEN 40
34 #define MAX_ARRAY_DIM 4
35 #define MAX_MEMBERS 50
36 #define MAX_CHILDREN 200
37 #define MAX_TEMPLATES 200
38 #define MAX_OBJECTS 500
39 #define MAX_SUBOBJECTS 2000
40 #define MAX_STRINGS_BUFFER 10000
41
42 typedef struct {
43 DWORD type;
44 LONG idx_template;
45 char name[MAX_NAME_LEN];
46 ULONG nb_dims;
47 BOOL dim_fixed[MAX_ARRAY_DIM]; /* fixed or variable */
48 ULONG dim_value[MAX_ARRAY_DIM]; /* fixed value or member index */
49 } member;
50
51 typedef struct {
52 char name[MAX_NAME_LEN];
53 GUID class_id;
54 BOOL open;
55 BOOL binary;
56 ULONG nb_children;
57 char children[MAX_CHILDREN][MAX_NAME_LEN];
58 ULONG nb_members;
59 member members[MAX_MEMBERS];
60 } xtemplate;
61
62 typedef struct {
63 char* name;
64 ULONG start;
65 ULONG size;
66 } xobject_member;
67
68 struct _xobject {
69 BOOL binary;
70 struct _xobject* ptarget;
71 char name[MAX_NAME_LEN];
72 GUID class_id;
73 GUID type;
74 LPBYTE pdata;
75 ULONG pos_data;
76 DWORD size;
77 ULONG nb_members;
78 xobject_member members[MAX_MEMBERS];
79 ULONG nb_children;
80 ULONG nb_subobjects;
81 struct _xobject * children[MAX_CHILDREN];
82 struct _xobject * root;
83 };
84
85 typedef struct _xobject xobject;
86
87 typedef struct {
88 IDirectXFile IDirectXFile_iface;
89 LONG ref;
90 ULONG nb_xtemplates;
91 xtemplate xtemplates[MAX_TEMPLATES];
92 } IDirectXFileImpl;
93
94 typedef struct {
95 IDirectXFileBinary IDirectXFileBinary_iface;
96 LONG ref;
97 } IDirectXFileBinaryImpl;
98
99 typedef struct {
100 IDirectXFileData IDirectXFileData_iface;
101 LONG ref;
102 xobject* pobj;
103 int cur_enum_object;
104 BOOL from_ref;
105 ULONG level;
106 LPBYTE pstrings;
107 } IDirectXFileDataImpl;
108
109 typedef struct {
110 IDirectXFileDataReference IDirectXFileDataReference_iface;
111 LONG ref;
112 xobject* ptarget;
113 } IDirectXFileDataReferenceImpl;
114
115 typedef struct {
116 IDirectXFileObject IDirectXFileObject_iface;
117 LONG ref;
118 } IDirectXFileObjectImpl;
119
120 typedef struct {
121 /* Buffer to parse */
122 LPBYTE buffer;
123 DWORD rem_bytes;
124 /* Misc info */
125 WORD current_token;
126 BOOL token_present;
127 BOOL txt;
128 DWORD list_nb_elements;
129 BOOL list_type_float;
130 BOOL list_separator;
131 ULONG cur_pos_data;
132 LPBYTE cur_pstrings;
133 BYTE value[512];
134 xobject** pxo_globals;
135 ULONG nb_pxo_globals;
136 xobject* pxo_tab;
137 IDirectXFileImpl* pdxf;
138 xobject* pxo;
139 xtemplate* pxt[MAX_SUBOBJECTS];
140 ULONG level;
141 LPBYTE pdata;
142 ULONG capacity;
143 LPBYTE pstrings;
144 } parse_buffer;
145
146 typedef struct {
147 IDirectXFileEnumObject IDirectXFileEnumObject_iface;
148 LONG ref;
149 LPBYTE mapped_memory;
150 LPBYTE decomp_buffer;
151 parse_buffer buf;
152 IDirectXFileImpl* pDirectXFile;
153 ULONG nb_xobjects;
154 xobject* xobjects[MAX_OBJECTS];
155 IDirectXFileData* pRefObjects[MAX_OBJECTS];
156 } IDirectXFileEnumObjectImpl;
157
158 typedef struct {
159 IDirectXFileSaveObject IDirectXFileSaveObject_iface;
160 LONG ref;
161 } IDirectXFileSaveObjectImpl;
162
163 HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
164
165 HRESULT parse_header(parse_buffer *buf, BYTE **decomp_buffer_ptr) DECLSPEC_HIDDEN;
166 BOOL parse_object(parse_buffer * buf) DECLSPEC_HIDDEN;
167 BOOL parse_templates(parse_buffer * buf, BOOL templates_only) DECLSPEC_HIDDEN;
168
169 int mszip_decompress(int inlen, int outlen, char* inbuffer, char* outbuffer) DECLSPEC_HIDDEN;
170
171 #endif /* __D3DXOF_PRIVATE_INCLUDED__ */