-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtypedefs.h
368 lines (298 loc) · 6.64 KB
/
typedefs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/*
Copyright (C) 2003-2009 Rice1964
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
2
of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _TYPEDEFS_H_
#define _TYPEDEFS_H_
#include <cstdint>
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
typedef uint8_t uint8;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef uint32_t u32;
typedef uint8_t u8;
//Fix me, these macro should not be used anymore in DirectX 8
#define RGBA_GETALPHA(rgb) ((rgb) >> 24)
#define RGBA_GETRED(rgb) (((rgb) >> 16) & 0xff)
#define RGBA_GETGREEN(rgb) (((rgb) >> 8) & 0xff)
#define RGBA_GETBLUE(rgb) ((rgb) & 0xff)
typedef D3DLOCKED_RECT LockRectType;
#define COLOR_RGBA D3DCOLOR_RGBA
//Move me, just putting it here for now
struct SetImgInfo
{
uint32 dwFormat : 3;
uint32 dwSize : 2;
uint32 dwWidth : 10;
uint32 dwAddr;
uint32 bpl;
};
struct Tile
{
// Set by RDP_SetTile
unsigned int dwFormat : 3; // e.g. RGBA, YUV etc
unsigned int dwSize : 2; // e.g 4/8/16/32bpp
unsigned int dwLine : 9; // Ummm...
unsigned int dwPalette : 4; // 0..15 - a palette index?
uint32 dwTMem; // Texture memory location
unsigned int bClampS : 1;
unsigned int bClampT : 1;
unsigned int bMirrorS : 1;
unsigned int bMirrorT : 1;
unsigned int dwMaskS : 4;
unsigned int dwMaskT : 4;
unsigned int dwShiftS : 4;
unsigned int dwShiftT : 4;
// Set by RDP_SetTileSize
int sl; // Upper left S - 8:3
int tl; // Upper Left T - 8:3
int sh; // Lower Right S
int th; // Lower Right T
int hilite_sl;
int hilite_tl;
int hilite_sh;
int hilite_th;
float fsl; // Upper left S - 8:3
float ftl; // Upper Left T - 8:3
float fsh; // Lower Right S
float fth; // Lower Right T
float fhilite_sl;
float fhilite_tl;
float fhilite_sh;
float fhilite_th;
uint32 dwDXT;
uint32 dwPitch;
uint32 dwWidth;
uint32 dwHeight;
float fShiftScaleS;
float fShiftScaleT;
uint32 lastTileCmd;
bool bSizeIsValid;
bool bForceWrapS;
bool bForceWrapT;
bool bForceClampS;
bool bForceClampT;
};
typedef struct
{
float u;
float v;
} TexCord;
#define RICE_FVF_TLITVERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2 )
typedef struct {
float x, y, z;
float rhw;
union {
D3DCOLOR dcDiffuse;
struct {
uint8 b;
uint8 g;
uint8 r;
uint8 a;
};
};
D3DCOLOR dcSpecular;
TexCord tcord[2];
} TLITVERTEX, *LPTLITVERTEX;
#define RICE_FVF_UTLITVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX2 )
typedef struct {
float x, y, z;
union {
D3DCOLOR dcDiffuse;
struct {
uint8 b;
uint8 g;
uint8 r;
uint8 a;
};
};
D3DCOLOR dcSpecular;
TexCord tcord[2];
} UTLITVERTEX, *LPUTLITVERTEX;
#define RICE_FVF_LITVERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR )
typedef struct {
float x, y, z;
float rhw;
union {
D3DCOLOR dcDiffuse;
struct {
uint8 b;
uint8 g;
uint8 r;
uint8 a;
};
};
D3DCOLOR dcSpecular;
} LITVERTEX, *LPLITVERTEX;
typedef struct {
float x, y, z;
float rhw;
D3DCOLOR dcDiffuse;
} FILLRECTVERTEX, *LPFILLRECTVERTEX;
typedef struct
{
float x, y, z;
float nx, ny, nz;
union {
D3DCOLOR dcDiffuse;
struct {
uint8 b;
uint8 g;
uint8 r;
uint8 a;
};
};
float u, v;
}EXTERNAL_VERTEX, *LPSHADERVERTEX;
struct Light
{
v3 Direction; // w component is ignored. Should be normalised
u32 SkipIfZero; // Used by CBFD & MM
v3 Colour; // Colour, components in range 0..1
float Iscale; // Used by CBFD
v4 Position; // Position -32768 to 32767
float ca; // Used by MM(GBI2 point light)
float la; // Used by MM(GBI2 point light)
float qa; // Used by MM(GBI2 point light)
u32 Pad0; // Padding
};
struct FiddledVtx
{
s16 y;
s16 x;
union
{
s16 flag;
struct
{
s8 normz;
u8 pad;
};
};
s16 z;
s16 tv;
s16 tu;
union
{
struct
{
u8 rgba_a;
u8 rgba_b;
u8 rgba_g;
u8 rgba_r;
};
struct
{
s8 norm_a;
s8 norm_z; //b
s8 norm_y; //g
s8 norm_x; //r
};
};
};
typedef struct
{
short y;
short x;
uint8 a;
uint8 b;
short z;
uint8 g;
uint8 r;
} FiddledVtxDKR;
typedef struct
{
short y;
short x;
uint16 cidx;
short z;
short t;
short s;
} N64VtxPD;
class CTexture;
class CDirectXTexture;
struct TxtrCacheEntry;
typedef struct {
LPDIRECT3DTEXTURE9 m_lpsTexturePtr;
union {
CTexture * m_pCTexture;
};
uint32 m_dwTileWidth;
uint32 m_dwTileHeight;
float m_fTexWidth;
float m_fTexHeight; // Float to avoid converts when processing verts
TxtrCacheEntry *pTextureEntry;
} RenderTexture;
typedef struct
{
unsigned __int32 dwFormat;
unsigned __int32 dwSize;
unsigned __int32 dwWidth;
unsigned __int32 dwAddr;
unsigned __int32 dwLastWidth;
unsigned __int32 dwLastHeight;
unsigned __int32 dwHeight;
unsigned __int32 dwMemSize;
bool bCopied;
unsigned __int32 dwCopiedAtFrame;
unsigned __int32 dwCRC;
unsigned __int32 lastUsedFrame;
unsigned __int32 bUsedByVIAtFrame;
unsigned __int32 lastSetAtUcode;
} RecentCIInfo;
typedef struct
{
uint32 addr;
uint32 FrameCount;
} RecentViOriginInfo;
typedef enum {
SHADE_DISABLED,
SHADE_FLAT,
SHADE_SMOOTH,
} RenderShadeMode;
typedef struct {
char *description;
int number;
uint32 setting;
} BufferSettingInfo;
typedef struct {
char *description;
uint32 setting;
} SettingInfo;
typedef union {
uint8 g_Tmem8bit[0x1000];
__int16 g_Tmem16bit[0x800];
uint32 g_Tmem32bit[0x300];
uint64 g_Tmem64bit[0x200];
} TmemType;
typedef struct {
uint32 dwFormat;
uint32 dwSize;
BOOL bSetBy;
uint32 dwLoadAddress;
uint32 dwTotalWords;
uint32 dxt;
bool bSwapped;
uint32 dwWidth;
uint32 dwLine;
int sl;
int sh;
int tl;
int th;
uint32 dwTmem;
} TMEMLoadMapInfo;
#endif