d3dxof_private.h 4.26 KB
Newer Older
1 2 3
/*
 *      DirectX File private interfaces (D3DXOF.DLL)
 *
4
 * Copyright 2004, 2008 Christian Costa
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 22 23 24 25 26 27 28 29 30 31 32
 */

#ifndef __D3DXOF_PRIVATE_INCLUDED__
#define __D3DXOF_PRIVATE_INCLUDED__

#include <stdarg.h>

#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "wingdi.h"
#include "winuser.h"
#include "dxfile.h"

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 43 44 45 46 47 48 49 50 51 52 53 54

typedef struct {
    DWORD type;
    LONG idx_template;
    char name[MAX_NAME_LEN];
    ULONG nb_dims;
    BOOL  dim_fixed[MAX_ARRAY_DIM]; /* fixed or variable */
    ULONG dim_value[MAX_ARRAY_DIM]; /* fixed value or member index */
} member;

typedef struct {
    char name[MAX_NAME_LEN];
    GUID class_id;
    BOOL open;
55
    BOOL binary;
56 57
    ULONG nb_children;
    char children[MAX_CHILDREN][MAX_NAME_LEN];
58 59 60 61
    ULONG nb_members;
    member members[MAX_MEMBERS];
} xtemplate;

62
typedef struct {
63
    char* name;
64
    ULONG start;
65 66 67 68
    ULONG size;
} xobject_member;

struct _xobject {
69
   BOOL binary;
70
   struct _xobject* ptarget;
71 72 73 74
   char name[MAX_NAME_LEN];
   GUID class_id;
   GUID type;
   LPBYTE pdata;
75
   ULONG pos_data;
76 77 78
   DWORD size;
   ULONG nb_members;
   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 86
};

typedef struct _xobject xobject;

87
typedef struct {
88
    IDirectXFile IDirectXFile_iface;
89
    LONG ref;
90 91
    ULONG nb_xtemplates;
    xtemplate xtemplates[MAX_TEMPLATES];
92 93 94
} IDirectXFileImpl;

typedef struct {
95
    IDirectXFileBinary IDirectXFileBinary_iface;
96
    LONG ref;
97 98 99
} IDirectXFileBinaryImpl;

typedef struct {
100
    IDirectXFileData IDirectXFileData_iface;
101
    LONG ref;
102 103
    xobject* pobj;
    int cur_enum_object;
104 105
    BOOL from_ref;
    ULONG level;
106
    LPBYTE pstrings;
107 108 109
} IDirectXFileDataImpl;

typedef struct {
110
    IDirectXFileDataReference IDirectXFileDataReference_iface;
111
    LONG ref;
112
    xobject* ptarget;
113 114 115
} IDirectXFileDataReferenceImpl;

typedef struct {
116
    IDirectXFileObject IDirectXFileObject_iface;
117
    LONG ref;
118 119
} IDirectXFileObjectImpl;

120 121 122 123 124
typedef struct {
  /* Buffer to parse */
  LPBYTE buffer;
  DWORD rem_bytes;
  /* Misc info */
125 126
  WORD current_token;
  BOOL token_present;
127
  BOOL txt;
128 129
  DWORD list_nb_elements;
  BOOL list_type_float;
130
  BOOL list_separator;
131
  ULONG cur_pos_data;
132
  LPBYTE cur_pstrings;
133
  BYTE value[100];
134
  xobject** pxo_globals;
135
  ULONG nb_pxo_globals;
136
  xobject* pxo_tab;
137 138 139 140
  IDirectXFileImpl* pdxf;
  xobject* pxo;
  xtemplate* pxt[MAX_SUBOBJECTS];
  ULONG level;
141
  LPBYTE pdata;
142
  ULONG capacity;
143
  LPBYTE pstrings;
144 145
} parse_buffer;

146
typedef struct {
147
    IDirectXFileEnumObject IDirectXFileEnumObject_iface;
148
    LONG ref;
149
    LPBYTE mapped_memory;
150
    LPBYTE decomp_buffer;
151 152 153
    parse_buffer buf;
    IDirectXFileImpl* pDirectXFile;
    ULONG nb_xobjects;
154
    xobject* xobjects[MAX_OBJECTS];
155
    IDirectXFileData* pRefObjects[MAX_OBJECTS];
156 157 158
} IDirectXFileEnumObjectImpl;

typedef struct {
159
    IDirectXFileSaveObject IDirectXFileSaveObject_iface;
160
    LONG ref;
161 162
} IDirectXFileSaveObjectImpl;

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__ */