d3dxof_private.h 4.17 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
  ULONG cur_pos_data;
129
  LPBYTE cur_pstrings;
130
  BYTE value[100];
131
  xobject** pxo_globals;
132
  ULONG nb_pxo_globals;
133
  xobject* pxo_tab;
134 135 136 137
  IDirectXFileImpl* pdxf;
  xobject* pxo;
  xtemplate* pxt[MAX_SUBOBJECTS];
  ULONG level;
138
  LPBYTE pdata;
139
  ULONG capacity;
140
  LPBYTE pstrings;
141 142
} parse_buffer;

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

typedef struct {
156
    IDirectXFileSaveObject IDirectXFileSaveObject_iface;
157
    LONG ref;
158 159
} IDirectXFileSaveObjectImpl;

160
HRESULT IDirectXFileImpl_Create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
161

162
HRESULT parse_header(parse_buffer *buf, BYTE **decomp_buffer_ptr) DECLSPEC_HIDDEN;
163
BOOL parse_object(parse_buffer * buf) DECLSPEC_HIDDEN;
164
BOOL parse_templates(parse_buffer * buf) DECLSPEC_HIDDEN;
165

166
int mszip_decompress(int inlen, int outlen, char* inbuffer, char* outbuffer) DECLSPEC_HIDDEN;
167

168
#endif /* __D3DXOF_PRIVATE_INCLUDED__ */