comparison LOD.h @ 0:8b8875f5b359

Initial commit
author Nomad
date Fri, 05 Oct 2012 16:07:14 +0200
parents
children 2ca04ccb612a
comparison
equal deleted inserted replaced
-1:000000000000 0:8b8875f5b359
1 #pragma once
2 #include <stdio.h>
3 #include "Texture.h"
4
5
6
7 /* 354 */
8 enum TEXTURE_TYPE
9 {
10 TEXTURE_DEFAULT = 0,
11 TEXTURE_24BIT_PALETTE = 0x1,
12 TEXTURE_16BIT_PALETTE = 0x2,
13 };
14
15
16
17
18 namespace LOD
19 {
20 #pragma pack(push, 1)
21 struct FileHeader
22 {
23 void Reset();
24
25 unsigned __int8 pSignature[4];
26 char array_000004[80];
27 char array_000054[80];
28 int dword_0000A4;
29 int dword_0000A8;
30 unsigned int uNumIndices;
31 char array_0000B0[28];
32 char array_0000CC[52];
33 };
34 #pragma pack(pop)
35
36
37 #pragma pack(push, 1)
38 struct Directory
39 {
40 Directory();
41 Directory *Reset();
42
43
44 unsigned __int8 pFilename[16];
45 unsigned int uOfsetFromSubindicesStart;
46 unsigned int uDataSize;
47 int dword_000018;
48 unsigned __int16 uNumSubIndices;
49 __int16 word_00001E;
50 };
51 #pragma pack(pop)
52
53
54 #pragma pack(push, 1)
55 struct File
56 {
57 File();
58 virtual ~File();
59 void *LoadRaw(const char *pContainer, int a3);
60 FILE *FindContainer(const char *pContainerName, bool bLinearSearch);
61 bool DoesContainerExist(const char *pContainer);
62 int CalcIndexFast(int startIndex, int maxIndex, const char *pContainerName);
63 bool LoadHeader(const char *pFilename, bool bWriting);
64 int LoadSubIndices(const char *pContainer);
65 void AllocSubIndicesAndIO(unsigned int uNumSubIndices, unsigned int uBufferSize);
66 void FreeSubIndexAndIO();
67 bool AppendDirectory(LOD::Directory *pDir, const void *pData);
68 void ResetSubIndices();
69 void Close();
70
71 FILE *pFile;
72 char pLODName[256];
73 unsigned int isFileOpened;
74 unsigned __int8 *pIOBuffer;
75 unsigned int uIOBufferSize;
76 struct FileHeader header;
77 struct Directory *pRoot;
78 char pContainerName[16];
79 unsigned int uCurrentIndexDir;
80 unsigned int uLODDataSize;
81 unsigned int uNumSubIndices;
82 struct Directory *pSubIndices;
83 unsigned int uOffsetToSubIndex;
84 FILE *pOutputFileHandle;
85 };
86 #pragma pack(pop)
87 };
88
89
90
91
92
93
94 /* 6 */
95 #pragma pack(push, 1)
96 struct LODWriteableFile: public LOD::File
97 {
98 bool LoadFile(const char *pFilename, bool bWriting);
99 unsigned int Write(const LOD::Directory *pDir, const void *pDirData, int a4);
100 void CloseWriteFile();
101 int CreateTempFile();
102 int Save();
103 bool _4621A7();
104 int _461492(LOD::FileHeader *pHeader, LOD::Directory *pDir, const char *Source);
105
106 FILE *pFile;
107 char pLODName[256];
108 unsigned int isFileOpened;
109 unsigned __int8 *pIOBuffer;
110 unsigned int uIOBufferSize;
111 struct LOD::FileHeader header;
112 struct LOD::Directory *pRoot;
113 unsigned __int8 pContainerName[16];
114 unsigned int uCurrentIndexDir;
115 unsigned int uLODDataSize;
116 unsigned int uNumSubIndices;
117 struct LOD::Directory *pSubIndices;
118 unsigned int uOffsetToSubIndex;
119 FILE *pOutputFileHandle;
120 };
121 #pragma pack(pop)
122
123
124
125
126 #pragma pack(push, 1)
127 struct LODFile_IconsBitmaps: public LOD::File
128 {
129 LODFile_IconsBitmaps();
130 virtual ~LODFile_IconsBitmaps();
131 int _40F9C5();
132 unsigned int FindTextureByName(const char *pName);
133 bool LoadBitmaps(const char *pFilename);
134 bool LoadIconsOrEvents(const char *pLODFilename);
135 void ReleaseAll();
136 unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
137 int LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType);
138 int ReloadTexture(Texture *pDst, const char *pContainer, int mode);
139 void ReleaseHardwareTextures();
140 void ReleaseLostHardwareTextures();
141 void _410423_move_textures_to_device();
142 int _410522(Texture *pDst, const char *pContainer, unsigned int uTextureType);
143 void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits);
144 void ReleaseAll2();
145 void _4114F2();
146 void _4355F7();
147
148
149 FILE *pFile;
150 unsigned __int8 pLODName[256];
151 unsigned int isFileOpened;
152 unsigned __int8 *pIOBuffer;
153 unsigned int uIOBufferSize;
154 struct LOD::FileHeader header;
155 struct LOD::Directory *pRoot;
156 unsigned __int8 pContainerName[16];
157 unsigned int uCurrentIndexDir;
158 unsigned int uLODDataSize;
159 unsigned int uNumSubIndices;
160 struct LOD::Directory *pSubIndices;
161 unsigned int uOffsetToSubIndex;
162 FILE *pOutputFileHandle;
163 struct Texture pTextures[1000];
164 unsigned int uNumLoadedFiles;
165 int dword_11B80;
166 int dword_11B84;
167 int dword_11B88;
168 int uTextureRedBits;
169 int uTextureGreenBits;
170 int uTextureBlueBits;
171 int uNumPrevLoadedFiles;
172 int uTexturePacksCount;
173 int dword_011BA0;
174 int dword_011BA4;
175 int dword_011BA8;
176 struct IDirectDrawSurface **pHardwareSurfaces;
177 struct IDirect3DTexture2 **pHardwareTextures;
178 char *ptr_011BB4;
179 };
180 #pragma pack(pop)
181
182
183
184
185
186
187 #pragma pack(push, 1)
188 struct LODSprite
189 {
190 //----- (0046244C) --------------------------------------------------------
191 inline LODSprite()
192 {
193 uHeight = 0;
194 uPaletteId = 0;
195 word_1A = 0;
196 pSpriteLines = nullptr;
197 pDecompressedBytes = nullptr;
198 }
199 ~LODSprite();
200
201 void Release();
202 int _4ACC38(struct RenderBillboardTransform_local0 *a2, char a3);
203 int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3);
204
205 char pName[12];
206 int uSpriteSize;
207 __int16 uWidth;
208 __int16 uHeight;
209 __int16 uPaletteId;
210 __int16 word_16;
211 __int16 uTexturePitch;
212 __int16 word_1A;
213 int uDecompressedSize;
214 struct LODSprite_stru0 *pSpriteLines;
215 void *pDecompressedBytes;
216 };
217 #pragma pack(pop)
218
219 /* 15 */
220 #pragma pack(push, 1)
221 struct LODFile_Sprites: public LOD::File
222 {
223 LODFile_Sprites();
224 virtual ~LODFile_Sprites();
225
226 void DeleteSomeSprites();
227 void DeleteSpritesRange(int uStartIndex, int uStopIndex);
228 int _461397();
229 void DeleteSomeOtherSprites();
230 int LoadSpriteFromFile(LODSprite *pSpriteHeader, const char *pContainer);
231 bool LoadSprites(const char *pFilename);
232 int LoadSprite(const char *pContainerName, unsigned int uPaletteID);
233 void ReleaseLostHardwareSprites();
234 void ReleaseAll();
235 void MoveSpritesToVideoMemory();
236
237
238 FILE *pFile;
239 unsigned __int8 pLODName[256];
240 unsigned int isFileOpened;
241 unsigned __int8 *pIOBuffer;
242 unsigned int uIOBufferSize;
243 struct LOD::FileHeader header;
244 struct LOD::Directory *pRoot;
245 unsigned __int8 pContainerName[16];
246 unsigned int uCurrentIndexDir;
247 unsigned int uLODDataSize;
248 unsigned int uNumSubIndices;
249 struct LOD::Directory *pSubIndices;
250 unsigned int uOffsetToSubIndex;
251 FILE *pOutputFileHandle;
252 struct LODSprite pSpriteHeaders[1500];
253 unsigned int uNumLoadedSprites;
254 int field_ECA0;
255 int field_ECA4;
256 int field_ECA8;
257 int field_ECAC;
258 struct Sprite *pHardwareSprites;
259 int field_ECB4;
260 };
261 #pragma pack(pop)
262
263 /* 17 */
264 #pragma pack(push, 1)
265 struct LODSprite_stru0
266 {
267 int dword_0;
268 void *ptr_4;
269 };
270 #pragma pack(pop)
271
272
273
274
275 extern LODFile_IconsBitmaps *pEvents_LOD;
276 extern LODFile_IconsBitmaps *pIcons_LOD;
277 extern LODFile_Sprites *pSprites_LOD;
278 extern LODFile_IconsBitmaps *pBitmaps_LOD;
279
280 extern LODWriteableFile *pNew_LOD;
281 extern LODWriteableFile *pGames_LOD;
282
283
284
285
286 extern int _6A0CA4_lod_binary_search; // weak
287 extern int _6A0CA8_lod_unused; // weak