1
by Sven Eckelmann
Import upstream version 1.5+dfsg1 |
1 |
/*
|
2 |
Copyright (C) 2003 Rice1964
|
|
3 |
||
4 |
This program is free software; you can redistribute it and/or
|
|
5 |
modify it under the terms of the GNU General Public License
|
|
6 |
as published by the Free Software Foundation; either version 2
|
|
7 |
of the License, or (at your option) any later version.
|
|
8 |
||
9 |
This program is distributed in the hope that it will be useful,
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
GNU General Public License for more details.
|
|
13 |
||
14 |
You should have received a copy of the GNU General Public License
|
|
15 |
along with this program; if not, write to the Free Software
|
|
16 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
17 |
||
18 |
*/
|
|
19 |
||
20 |
||
21 |
#ifndef __RICE_RDP_GFX_H__
|
|
22 |
#define __RICE_RDP_GFX_H__
|
|
23 |
||
24 |
#define RSP_SPNOOP 0 // handle 0 gracefully |
|
25 |
#define RSP_MTX 1
|
|
26 |
#define RSP_RESERVED0 2 // unknown |
|
27 |
#define RSP_MOVEMEM 3 // move a block of memory (up to 4 words) to dmem |
|
28 |
#define RSP_VTX 4
|
|
29 |
#define RSP_RESERVED1 5 // unknown |
|
30 |
#define RSP_DL 6
|
|
31 |
#define RSP_RESERVED2 7 // unknown |
|
32 |
#define RSP_RESERVED3 8 // unknown |
|
33 |
#define RSP_SPRITE2D 9 // sprite command |
|
34 |
#define RSP_SPRITE2D_BASE 9 // sprite command |
|
35 |
||
36 |
||
37 |
#define RSP_1ST 0xBF
|
|
38 |
#define RSP_TRI1 (RSP_1ST-0)
|
|
39 |
#define RSP_CULLDL (RSP_1ST-1)
|
|
40 |
#define RSP_POPMTX (RSP_1ST-2)
|
|
41 |
#define RSP_MOVEWORD (RSP_1ST-3)
|
|
42 |
#define RSP_TEXTURE (RSP_1ST-4)
|
|
43 |
#define RSP_SETOTHERMODE_H (RSP_1ST-5)
|
|
44 |
#define RSP_SETOTHERMODE_L (RSP_1ST-6)
|
|
45 |
#define RSP_ENDDL (RSP_1ST-7)
|
|
46 |
#define RSP_SETGEOMETRYMODE (RSP_1ST-8)
|
|
47 |
#define RSP_CLEARGEOMETRYMODE (RSP_1ST-9)
|
|
48 |
#define RSP_LINE3D (RSP_1ST-10)
|
|
49 |
#define RSP_RDPHALF_1 (RSP_1ST-11)
|
|
50 |
#define RSP_RDPHALF_2 (RSP_1ST-12)
|
|
51 |
#define RSP_RDPHALF_CONT (RSP_1ST-13)
|
|
52 |
||
53 |
#define RSP_MODIFYVTX (RSP_1ST-13)
|
|
54 |
#define RSP_TRI2 (RSP_1ST-14)
|
|
55 |
#define RSP_BRANCH_Z (RSP_1ST-15)
|
|
56 |
#define RSP_LOAD_UCODE (RSP_1ST-16)
|
|
57 |
||
58 |
#define RSP_SPRITE2D_SCALEFLIP (RSP_1ST-1)
|
|
59 |
#define RSP_SPRITE2D_DRAW (RSP_1ST-2)
|
|
60 |
||
61 |
#define RSP_ZELDAVTX 1
|
|
62 |
#define RSP_ZELDAMODIFYVTX 2
|
|
63 |
#define RSP_ZELDACULLDL 3
|
|
64 |
#define RSP_ZELDABRANCHZ 4
|
|
65 |
#define RSP_ZELDATRI1 5
|
|
66 |
#define RSP_ZELDATRI2 6
|
|
67 |
#define RSP_ZELDALINE3D 7
|
|
68 |
#define RSP_ZELDARDPHALF_2 0xf1
|
|
69 |
#define RSP_ZELDASETOTHERMODE_H 0xe3
|
|
70 |
#define RSP_ZELDASETOTHERMODE_L 0xe2
|
|
71 |
#define RSP_ZELDARDPHALF_1 0xe1
|
|
72 |
#define RSP_ZELDASPNOOP 0xe0
|
|
73 |
#define RSP_ZELDAENDDL 0xdf
|
|
74 |
#define RSP_ZELDADL 0xde
|
|
75 |
#define RSP_ZELDALOAD_UCODE 0xdd
|
|
76 |
#define RSP_ZELDAMOVEMEM 0xdc
|
|
77 |
#define RSP_ZELDAMOVEWORD 0xdb
|
|
78 |
#define RSP_ZELDAMTX 0xda
|
|
79 |
#define RSP_ZELDAGEOMETRYMODE 0xd9
|
|
80 |
#define RSP_ZELDAPOPMTX 0xd8
|
|
81 |
#define RSP_ZELDATEXTURE 0xd7
|
|
82 |
#define RSP_ZELDASUBMODULE 0xd6
|
|
83 |
||
84 |
// 4 is something like a conditional DL
|
|
85 |
#define RSP_DMATRI 0x05
|
|
86 |
#define G_DLINMEM 0x07
|
|
87 |
||
88 |
// RDP commands:
|
|
89 |
#define RDP_NOOP 0xc0
|
|
90 |
#define RDP_SETCIMG 0xff
|
|
91 |
#define RDP_SETZIMG 0xfe
|
|
92 |
#define RDP_SETTIMG 0xfd
|
|
93 |
#define RDP_SETCOMBINE 0xfc
|
|
94 |
#define RDP_SETENVCOLOR 0xfb
|
|
95 |
#define RDP_SETPRIMCOLOR 0xfa
|
|
96 |
#define RDP_SETBLENDCOLOR 0xf9
|
|
97 |
#define RDP_SETFOGCOLOR 0xf8
|
|
98 |
#define RDP_SETFILLCOLOR 0xf7
|
|
99 |
#define RDP_FILLRECT 0xf6
|
|
100 |
#define RDP_SETTILE 0xf5
|
|
101 |
#define RDP_LOADTILE 0xf4
|
|
102 |
#define RDP_LOADBLOCK 0xf3
|
|
103 |
#define RDP_SETTILESIZE 0xf2
|
|
104 |
#define RDP_LOADTLUT 0xf0
|
|
105 |
#define RDP_RDPSETOTHERMODE 0xef
|
|
106 |
#define RDP_SETPRIMDEPTH 0xee
|
|
107 |
#define RDP_SETSCISSOR 0xed
|
|
108 |
#define RDP_SETCONVERT 0xec
|
|
109 |
#define RDP_SETKEYR 0xeb
|
|
110 |
#define RDP_SETKEYGB 0xea
|
|
111 |
#define RDP_FULLSYNC 0xe9
|
|
112 |
#define RDP_TILESYNC 0xe8
|
|
113 |
#define RDP_PIPESYNC 0xe7
|
|
114 |
#define RDP_LOADSYNC 0xe6
|
|
115 |
#define RDP_TEXRECT_FLIP 0xe5
|
|
116 |
#define RDP_TEXRECT 0xe4
|
|
117 |
||
118 |
||
119 |
||
120 |
||
121 |
#define RSP_ZELDA_MTX_MODELVIEW 0x00
|
|
122 |
#define RSP_ZELDA_MTX_PROJECTION 0x04
|
|
123 |
#define RSP_ZELDA_MTX_MUL 0x00
|
|
124 |
#define RSP_ZELDA_MTX_LOAD 0x02
|
|
125 |
#define RSP_ZELDA_MTX_PUSH 0x00
|
|
126 |
#define RSP_ZELDA_MTX_NOPUSH 0x01
|
|
127 |
||
128 |
||
129 |
||
130 |
//
|
|
131 |
// RSP_SETOTHERMODE_L sft: shift count
|
|
132 |
||
133 |
#define RSP_SETOTHERMODE_SHIFT_ALPHACOMPARE 0
|
|
134 |
#define RSP_SETOTHERMODE_SHIFT_ZSRCSEL 2
|
|
135 |
#define RSP_SETOTHERMODE_SHIFT_RENDERMODE 3
|
|
136 |
#define RSP_SETOTHERMODE_SHIFT_BLENDER 16
|
|
137 |
||
138 |
//
|
|
139 |
// RSP_SETOTHERMODE_H sft: shift count
|
|
140 |
||
141 |
#define RSP_SETOTHERMODE_SHIFT_BLENDMASK 0 // unsupported |
|
142 |
#define RSP_SETOTHERMODE_SHIFT_ALPHADITHER 4
|
|
143 |
#define RSP_SETOTHERMODE_SHIFT_RGBDITHER 6
|
|
144 |
||
145 |
#define RSP_SETOTHERMODE_SHIFT_COMBKEY 8
|
|
146 |
#define RSP_SETOTHERMODE_SHIFT_TEXTCONV 9
|
|
147 |
#define RSP_SETOTHERMODE_SHIFT_TEXTFILT 12
|
|
148 |
#define RSP_SETOTHERMODE_SHIFT_TEXTLUT 14
|
|
149 |
#define RSP_SETOTHERMODE_SHIFT_TEXTLOD 16
|
|
150 |
#define RSP_SETOTHERMODE_SHIFT_TEXTDETAIL 17
|
|
151 |
#define RSP_SETOTHERMODE_SHIFT_TEXTPERSP 19
|
|
152 |
#define RSP_SETOTHERMODE_SHIFT_CYCLETYPE 20
|
|
153 |
#define RSP_SETOTHERMODE_SHIFT_COLORDITHER 22 // unsupported in HW 2.0 |
|
154 |
#define RSP_SETOTHERMODE_SHIFT_PIPELINE 23
|
|
155 |
||
156 |
// RSP_SETOTHERMODE_H gPipelineMode
|
|
157 |
#define RSP_PIPELINE_MODE_1PRIMITIVE (1 << RSP_SETOTHERMODE_SHIFT_PIPELINE)
|
|
158 |
#define RSP_PIPELINE_MODE_NPRIMITIVE (0 << RSP_SETOTHERMODE_SHIFT_PIPELINE)
|
|
159 |
||
160 |
// RSP_SETOTHERMODE_H gSetCycleType
|
|
161 |
#define CYCLE_TYPE_1 0
|
|
162 |
#define CYCLE_TYPE_2 1
|
|
163 |
#define CYCLE_TYPE_COPY 2
|
|
164 |
#define CYCLE_TYPE_FILL 3
|
|
165 |
||
166 |
// RSP_SETOTHERMODE_H gSetTextureLUT
|
|
167 |
#define TLUT_FMT_NONE (0 << RSP_SETOTHERMODE_SHIFT_TEXTLUT)
|
|
168 |
#define TLUT_FMT_UNKNOWN (1 << RSP_SETOTHERMODE_SHIFT_TEXTLUT)
|
|
169 |
#define TLUT_FMT_RGBA16 (2 << RSP_SETOTHERMODE_SHIFT_TEXTLUT)
|
|
170 |
#define TLUT_FMT_IA16 (3 << RSP_SETOTHERMODE_SHIFT_TEXTLUT)
|
|
171 |
||
172 |
// RSP_SETOTHERMODE_H gSetTextureFilter
|
|
173 |
#define RDP_TFILTER_POINT (0 << RSP_SETOTHERMODE_SHIFT_TEXTFILT)
|
|
174 |
#define RDP_TFILTER_AVERAGE (3 << RSP_SETOTHERMODE_SHIFT_TEXTFILT)
|
|
175 |
#define RDP_TFILTER_BILERP (2 << RSP_SETOTHERMODE_SHIFT_TEXTFILT)
|
|
176 |
||
177 |
// RSP_SETOTHERMODE_L gSetAlphaCompare
|
|
178 |
#define RDP_ALPHA_COMPARE_NONE (0 << RSP_SETOTHERMODE_SHIFT_ALPHACOMPARE)
|
|
179 |
#define RDP_ALPHA_COMPARE_THRESHOLD (1 << RSP_SETOTHERMODE_SHIFT_ALPHACOMPARE)
|
|
180 |
#define RDP_ALPHA_COMPARE_DITHER (3 << RSP_SETOTHERMODE_SHIFT_ALPHACOMPARE)
|
|
181 |
||
182 |
// RSP_SETOTHERMODE_L gSetRenderMode
|
|
183 |
#define Z_COMPARE 0x0010
|
|
184 |
#define Z_UPDATE 0x0020
|
|
185 |
#define ZMODE_DEC 0x0c00
|
|
186 |
||
187 |
||
188 |
//
|
|
189 |
// flags for RSP_SETGEOMETRYMODE
|
|
190 |
//
|
|
191 |
#define G_ZBUFFER 0x00000001
|
|
192 |
#define G_TEXTURE_ENABLE 0x00000002 // Microcode use only |
|
193 |
#define G_SHADE 0x00000004 // enable Gouraud interp |
|
194 |
//
|
|
195 |
#define G_SHADING_SMOOTH 0x00000200 // flat or smooth shaded |
|
196 |
#define G_CULL_FRONT 0x00001000
|
|
197 |
#define G_CULL_BACK 0x00002000
|
|
198 |
#define G_CULL_BOTH 0x00003000 // To make code cleaner |
|
199 |
#define G_FOG 0x00010000
|
|
200 |
#define G_LIGHTING 0x00020000
|
|
201 |
#define G_TEXTURE_GEN 0x00040000
|
|
202 |
#define G_TEXTURE_GEN_LINEAR 0x00080000
|
|
203 |
#define G_LOD 0x00100000 // NOT IMPLEMENTED |
|
204 |
||
205 |
//
|
|
206 |
// G_SETIMG fmt: set image formats
|
|
207 |
//
|
|
208 |
#define TXT_FMT_RGBA 0
|
|
209 |
#define TXT_FMT_YUV 1
|
|
210 |
#define TXT_FMT_CI 2
|
|
211 |
#define TXT_FMT_IA 3
|
|
212 |
#define TXT_FMT_I 4
|
|
213 |
||
214 |
//
|
|
215 |
// G_SETIMG siz: set image pixel size
|
|
216 |
//
|
|
217 |
#define TXT_SIZE_4b 0
|
|
218 |
#define TXT_SIZE_8b 1
|
|
219 |
#define TXT_SIZE_16b 2
|
|
220 |
#define TXT_SIZE_32b 3
|
|
221 |
||
222 |
//
|
|
223 |
// Texturing macros
|
|
224 |
//
|
|
225 |
||
226 |
#define RDP_TXT_LOADTILE 7
|
|
227 |
#define RDP_TXT_RENDERTILE 0
|
|
228 |
||
229 |
#define RDP_TXT_NOMIRROR 0
|
|
230 |
#define RDP_TXT_WRAP 0
|
|
231 |
#define RDP_TXT_MIRROR 0x1
|
|
232 |
#define RDP_TXT_CLAMP 0x2
|
|
233 |
#define RDP_TXT_NOMASK 0
|
|
234 |
#define RDP_TXT_NOLOD 0
|
|
235 |
||
236 |
||
237 |
||
238 |
//
|
|
239 |
// MOVEMEM indices
|
|
240 |
//
|
|
241 |
// Each of these indexes an entry in a dmem table
|
|
242 |
// which points to a 1-4 word block of dmem in
|
|
243 |
// which to store a 1-4 word DMA.
|
|
244 |
//
|
|
245 |
//
|
|
246 |
#define RSP_GBI1_MV_MEM_VIEWPORT 0x80
|
|
247 |
#define RSP_GBI1_MV_MEM_LOOKATY 0x82
|
|
248 |
#define RSP_GBI1_MV_MEM_LOOKATX 0x84
|
|
249 |
#define RSP_GBI1_MV_MEM_L0 0x86
|
|
250 |
#define RSP_GBI1_MV_MEM_L1 0x88
|
|
251 |
#define RSP_GBI1_MV_MEM_L2 0x8a
|
|
252 |
#define RSP_GBI1_MV_MEM_L3 0x8c
|
|
253 |
#define RSP_GBI1_MV_MEM_L4 0x8e
|
|
254 |
#define RSP_GBI1_MV_MEM_L5 0x90
|
|
255 |
#define RSP_GBI1_MV_MEM_L6 0x92
|
|
256 |
#define RSP_GBI1_MV_MEM_L7 0x94
|
|
257 |
#define RSP_GBI1_MV_MEM_TXTATT 0x96
|
|
258 |
#define RSP_GBI1_MV_MEM_MATRIX_1 0x9e // NOTE: this is in moveword table |
|
259 |
#define RSP_GBI1_MV_MEM_MATRIX_2 0x98
|
|
260 |
#define RSP_GBI1_MV_MEM_MATRIX_3 0x9a
|
|
261 |
#define RSP_GBI1_MV_MEM_MATRIX_4 0x9c
|
|
262 |
||
263 |
# define RSP_GBI2_MV_MEM__VIEWPORT 8
|
|
264 |
# define RSP_GBI2_MV_MEM__LIGHT 10
|
|
265 |
# define RSP_GBI2_MV_MEM__POINT 12
|
|
266 |
# define RSP_GBI2_MV_MEM__MATRIX 14 /* NOTE: this is in moveword table */ |
|
267 |
# define RSP_GBI2_MV_MEM_O_LOOKATX (0*24)
|
|
268 |
# define RSP_GBI2_MV_MEM_O_LOOKATY (1*24)
|
|
269 |
# define RSP_GBI2_MV_MEM_O_L0 (2*24)
|
|
270 |
# define RSP_GBI2_MV_MEM_O_L1 (3*24)
|
|
271 |
# define RSP_GBI2_MV_MEM_O_L2 (4*24)
|
|
272 |
# define RSP_GBI2_MV_MEM_O_L3 (5*24)
|
|
273 |
# define RSP_GBI2_MV_MEM_O_L4 (6*24)
|
|
274 |
# define RSP_GBI2_MV_MEM_O_L5 (7*24)
|
|
275 |
# define RSP_GBI2_MV_MEM_O_L6 (8*24)
|
|
276 |
# define RSP_GBI2_MV_MEM_O_L7 (9*24)
|
|
277 |
||
278 |
||
279 |
//
|
|
280 |
// MOVEWORD indices
|
|
281 |
//
|
|
282 |
// Each of these indexes an entry in a dmem table
|
|
283 |
// which points to a word in dmem in dmem where
|
|
284 |
// an immediate word will be stored.
|
|
285 |
//
|
|
286 |
//
|
|
287 |
#define RSP_MOVE_WORD_MATRIX 0x00 // NOTE: also used by movemem |
|
288 |
#define RSP_MOVE_WORD_NUMLIGHT 0x02
|
|
289 |
#define RSP_MOVE_WORD_CLIP 0x04
|
|
290 |
#define RSP_MOVE_WORD_SEGMENT 0x06
|
|
291 |
#define RSP_MOVE_WORD_FOG 0x08
|
|
292 |
#define RSP_MOVE_WORD_LIGHTCOL 0x0a
|
|
293 |
#define RSP_MOVE_WORD_POINTS 0x0c
|
|
294 |
#define RSP_MOVE_WORD_PERSPNORM 0x0e
|
|
295 |
||
296 |
//
|
|
297 |
// These are offsets from the address in the dmem table
|
|
298 |
//
|
|
299 |
#define RSP_MV_WORD_OFFSET_NUMLIGHT 0x00
|
|
300 |
#define RSP_MV_WORD_OFFSET_CLIP_RNX 0x04
|
|
301 |
#define RSP_MV_WORD_OFFSET_CLIP_RNY 0x0c
|
|
302 |
#define RSP_MV_WORD_OFFSET_CLIP_RPX 0x14
|
|
303 |
#define RSP_MV_WORD_OFFSET_CLIP_RPY 0x1c
|
|
304 |
#define RSP_MV_WORD_OFFSET_FOG 0x00
|
|
305 |
#define RSP_MV_WORD_OFFSET_POINT_RGBA 0x10
|
|
306 |
#define RSP_MV_WORD_OFFSET_POINT_ST 0x14
|
|
307 |
#define RSP_MV_WORD_OFFSET_POINT_XYSCREEN 0x18
|
|
308 |
#define RSP_MV_WORD_OFFSET_POINT_ZSCREEN 0x1c
|
|
309 |
||
310 |
||
311 |
||
312 |
// flags to inhibit pushing of the display list (on branch)
|
|
313 |
#define RSP_DLIST_PUSH 0x00
|
|
314 |
#define RSP_DLIST_NOPUSH 0x01
|
|
315 |
||
316 |
||
317 |
//
|
|
318 |
// RSP_MTX: parameter flags
|
|
319 |
//
|
|
320 |
#define RSP_MATRIX_MODELVIEW 0x00
|
|
321 |
#define RSP_MATRIX_PROJECTION 0x01
|
|
322 |
||
323 |
#define RSP_MATRIX_MUL 0x00
|
|
324 |
#define RSP_MATRIX_LOAD 0x02
|
|
325 |
||
326 |
#define RSP_MATRIX_NOPUSH 0x00
|
|
327 |
#define RSP_MATRIX_PUSH 0x04
|
|
328 |
||
329 |
||
330 |
||
331 |
typedef struct |
|
332 |
{
|
|
333 |
uint32 type; |
|
334 |
uint32 flags; |
|
335 |
||
336 |
uint32 ucode_boot; |
|
337 |
uint32 ucode_boot_size; |
|
338 |
||
339 |
uint32 ucode; |
|
340 |
uint32 ucode_size; |
|
341 |
||
342 |
uint32 ucode_data; |
|
343 |
uint32 ucode_data_size; |
|
344 |
||
345 |
uint32 dram_stack; |
|
346 |
uint32 dram_stack_size; |
|
347 |
||
348 |
uint32 output_buff; |
|
349 |
uint32 output_buff_size; |
|
350 |
||
351 |
uint32 data_ptr; |
|
352 |
uint32 data_size; |
|
353 |
||
354 |
uint32 yield_data_ptr; |
|
355 |
uint32 yield_data_size; |
|
356 |
} OSTask_t; |
|
357 |
||
358 |
typedef union { |
|
359 |
OSTask_t t; |
|
360 |
uint64 force_structure_alignment; |
|
361 |
} OSTask; |
|
362 |
||
363 |
#define MAX_DL_STACK_SIZE 32
|
|
364 |
#define MAX_DL_COUNT 1000000
|
|
365 |
||
366 |
typedef struct { |
|
367 |
bool used; |
|
368 |
uint32 crc_size; |
|
369 |
uint32 crc_800; |
|
370 |
uint32 ucode; |
|
371 |
uint32 minor_ver; |
|
372 |
uint32 variant; |
|
373 |
char rspstr[200]; |
|
374 |
||
375 |
uint32 ucStart; |
|
376 |
uint32 ucSize; |
|
377 |
uint32 ucDStart; |
|
378 |
uint32 ucDSize; |
|
379 |
uint32 ucCRC; |
|
380 |
uint32 ucDWORD1; |
|
381 |
uint32 ucDWORD2; |
|
382 |
uint32 ucDWORD3; |
|
383 |
uint32 ucDWORD4; |
|
384 |
} UcodeInfo; |
|
385 |
||
386 |
||
387 |
typedef struct |
|
388 |
{
|
|
389 |
uint32 ucode; |
|
390 |
uint32 crc_size; |
|
391 |
uint32 crc_800; |
|
392 |
const CHAR * ucode_name; |
|
393 |
bool non_nearclip; |
|
394 |
bool reject; |
|
395 |
} UcodeData; |
|
396 |
||
397 |
struct TileDescriptor |
|
398 |
{
|
|
399 |
// Set by SetTile
|
|
400 |
unsigned int dwFormat :3; // e.g. RGBA, YUV etc |
|
401 |
unsigned int dwSize :2; // e.g 4/8/16/32bpp |
|
402 |
unsigned int dwLine :9; // Ummm... |
|
403 |
unsigned int dwPalette :4; // 0..15 - a palette index? |
|
404 |
uint32 dwTMem; // Texture memory location |
|
405 |
||
406 |
unsigned int bClampS :1; |
|
407 |
unsigned int bClampT :1; |
|
408 |
unsigned int bMirrorS :1; |
|
409 |
unsigned int bMirrorT :1; |
|
410 |
||
411 |
unsigned int dwMaskS :4; |
|
412 |
unsigned int dwMaskT :4; |
|
413 |
unsigned int dwShiftS :4; |
|
414 |
unsigned int dwShiftT :4; |
|
415 |
||
416 |
// Set by SetTileSize
|
|
417 |
unsigned int sl :10; // Upper left S - 8:3 |
|
418 |
unsigned int tl :10; // Upper Left T - 8:3 |
|
419 |
unsigned int sh :10; // Lower Right S |
|
420 |
unsigned int th :10; // Lower Right T |
|
421 |
};
|
|
422 |
||
423 |
enum LoadType |
|
424 |
{
|
|
425 |
BY_NEVER_SET, |
|
426 |
BY_LOAD_BLOCK, |
|
427 |
BY_LOAD_TILE, |
|
428 |
BY_LOAD_TLUT, |
|
429 |
};
|
|
430 |
||
431 |
struct LoadCmdInfo |
|
432 |
{
|
|
433 |
LoadType loadtype; |
|
434 |
unsigned int sl :10; // Upper left S - 8:3 |
|
435 |
unsigned int tl :10; // Upper Left T - 8:3 |
|
436 |
unsigned int sh :10; // Lower Right S |
|
437 |
unsigned int th :10; // Lower Right T |
|
438 |
unsigned int dxt :12; |
|
439 |
};
|
|
440 |
||
441 |
typedef struct { // This is in Intel format |
|
442 |
uint32 SourceImagePointer; |
|
443 |
uint32 TlutPointer; |
|
444 |
||
445 |
short SubImageWidth; |
|
446 |
short Stride; |
|
447 |
||
448 |
char SourceImageBitSize; |
|
449 |
char SourceImageType; |
|
450 |
short SubImageHeight; |
|
451 |
||
452 |
short SourceImageOffsetT; |
|
453 |
short SourceImageOffsetS; |
|
454 |
||
455 |
char dummy[4]; |
|
456 |
} SpriteStruct; //Converted Sprint struct in Intel format |
|
457 |
||
458 |
typedef struct{ |
|
459 |
short px; |
|
460 |
short py; |
|
461 |
float scaleX; |
|
462 |
float scaleY; |
|
463 |
uint8 flipX; |
|
464 |
uint8 flipY; |
|
465 |
SpriteStruct *spritePtr; |
|
466 |
} Sprite2DInfo; |
|
467 |
||
468 |
||
469 |
typedef struct |
|
470 |
{
|
|
471 |
unsigned int c2_m2b:2; |
|
472 |
unsigned int c1_m2b:2; |
|
473 |
unsigned int c2_m2a:2; |
|
474 |
unsigned int c1_m2a:2; |
|
475 |
unsigned int c2_m1b:2; |
|
476 |
unsigned int c1_m1b:2; |
|
477 |
unsigned int c2_m1a:2; |
|
478 |
unsigned int c1_m1a:2; |
|
479 |
} RDP_BlenderSetting; |
|
480 |
||
481 |
typedef struct |
|
482 |
{
|
|
483 |
union
|
|
484 |
{
|
|
485 |
struct
|
|
486 |
{
|
|
487 |
// Low bits
|
|
488 |
unsigned int alpha_compare : 2; // 0..1 |
|
489 |
unsigned int depth_source : 1; // 2..2 |
|
490 |
||
491 |
// unsigned int render_mode : 13; // 3..15
|
|
492 |
unsigned int aa_en : 1; // 3 |
|
493 |
unsigned int z_cmp : 1; // 4 |
|
494 |
unsigned int z_upd : 1; // 5 |
|
495 |
unsigned int im_rd : 1; // 6 |
|
496 |
unsigned int clr_on_cvg : 1; // 7 |
|
497 |
||
498 |
unsigned int cvg_dst : 2; // 8..9 |
|
499 |
unsigned int zmode : 2; // 10..11 |
|
500 |
||
501 |
unsigned int cvg_x_alpha : 1; // 12 |
|
502 |
unsigned int alpha_cvg_sel : 1; // 13 |
|
503 |
unsigned int force_bl : 1; // 14 |
|
504 |
unsigned int tex_edge : 1; // 15 - Not used |
|
505 |
||
506 |
unsigned int blender : 16; // 16..31 |
|
507 |
||
508 |
// High bits
|
|
509 |
unsigned int blend_mask : 4; // 0..3 - not supported |
|
510 |
unsigned int alpha_dither : 2; // 4..5 |
|
511 |
unsigned int rgb_dither : 2; // 6..7 |
|
512 |
||
513 |
unsigned int key_en : 1; // 8..8 |
|
514 |
unsigned int text_conv : 3; // 9..11 |
|
515 |
unsigned int text_filt : 2; // 12..13 |
|
516 |
unsigned int text_tlut : 2; // 14..15 |
|
517 |
||
518 |
unsigned int text_lod : 1; // 16..16 |
|
519 |
unsigned int text_sharpen : 1; // 17..18 |
|
520 |
unsigned int text_detail : 1; // 17..18 |
|
521 |
unsigned int text_persp : 1; // 19..19 |
|
522 |
unsigned int cycle_type : 2; // 20..21 |
|
523 |
unsigned int reserved : 1; // 22..22 - not supported |
|
524 |
unsigned int atomic_prim : 1; // 23..23 |
|
525 |
||
526 |
unsigned int pad : 8; // 24..31 - padding |
|
527 |
||
528 |
};
|
|
529 |
uint64 _u64; |
|
530 |
uint32 _u32[2]; |
|
531 |
};
|
|
532 |
} RDP_OtherMode; |
|
533 |
||
534 |
||
535 |
typedef enum |
|
536 |
{
|
|
537 |
CMD_SETTILE, |
|
538 |
CMD_SETTILE_SIZE, |
|
539 |
CMD_LOADBLOCK, |
|
540 |
CMD_LOADTILE, |
|
541 |
CMD_LOADTLUT, |
|
542 |
CMD_SET_TEXTURE, |
|
543 |
CMD_LOAD_OBJ_TXTR, |
|
544 |
} SetTileCmdType; |
|
545 |
||
546 |
||
547 |
// The display list PC stack. Before this was an array of 10
|
|
548 |
// items, but this way we can nest as deeply as necessary.
|
|
549 |
||
550 |
typedef struct |
|
551 |
{
|
|
552 |
uint32 pc; |
|
553 |
int countdown; |
|
554 |
} DListStack; |
|
555 |
||
556 |
typedef struct |
|
557 |
{
|
|
558 |
int x0, y0, x1, y1, mode; |
|
559 |
int left, top, right, bottom; |
|
560 |
} ScissorType; |
|
561 |
||
562 |
// Mask down to 0x003FFFFF?
|
|
563 |
#define RSPSegmentAddr(seg) ( gRSP.segments[((seg)>>24)&0x0F] + ((seg)&0x00FFFFFF) )
|
|
564 |
#define RDRAM_UWORD(addr) (*(uint32 *)((addr)+g_pRDRAMu8))
|
|
565 |
#define RDRAM_SWORD(addr) (*(s32 *)((addr)+g_pRDRAMu8))
|
|
566 |
#define RDRAM_UHALF(addr) (*(uint16 *)(((addr)^2)+g_pRDRAMu8))
|
|
567 |
#define RDRAM_SHALF(addr) (*(short *)(((addr)^2)+g_pRDRAMu8))
|
|
568 |
#define RDRAM_UBYTE(addr) (*(uint8 *)(((addr)^3)+g_pRDRAMu8))
|
|
569 |
#define RDRAM_SBYTE(addr) (*(s8 *)(((addr)^3)+g_pRDRAMu8))
|
|
570 |
#define pRDRAM_UWORD(addr) ((uint32 *)((addr)+g_pRDRAMu8))
|
|
571 |
#define pRDRAM_SWORD(addr) ((s32 *)((addr)+g_pRDRAMu8))
|
|
572 |
#define pRDRAM_UHALF(addr) ((uint16 *)(((addr)^2)+g_pRDRAMu8))
|
|
573 |
#define pRDRAM_SHALF(addr) ((short *)(((addr)^2)+g_pRDRAMu8))
|
|
574 |
#define pRDRAM_UBYTE(addr) ((uint8 *)(((addr)^3)+g_pRDRAMu8))
|
|
575 |
#define pRDRAM_SBYTE(addr) ((s8 *)(((addr)^3)+g_pRDRAMu8))
|
|
576 |
||
577 |
extern uint16 g_wRDPTlut[]; |
|
578 |
extern const char *textluttype[4]; |
|
579 |
||
580 |
extern const char *pszImgFormat[8]; |
|
581 |
extern const char *pszImgSize[4]; |
|
582 |
extern uint8 pnImgSize[4]; |
|
583 |
extern const char *textlutname[4]; |
|
584 |
||
585 |
extern SetImgInfo g_CI; |
|
586 |
extern SetImgInfo g_ZI; |
|
587 |
extern SetImgInfo g_TI; |
|
588 |
extern TmemType g_Tmem; |
|
589 |
||
590 |
extern DListStack gDlistStack[MAX_DL_STACK_SIZE]; |
|
591 |
||
592 |
extern int gDlistStackPointer; |
|
593 |
||
594 |
void DLParser_Init(); |
|
595 |
void RDP_GFX_Reset(); |
|
596 |
void RDP_Cleanup(); |
|
597 |
void DLParser_Process(OSTask * pTask); |
|
598 |
void RDP_DLParser_Process(void); |
|
599 |
||
600 |
void PrepareTextures(); |
|
601 |
void RDP_InitRenderState(); |
|
602 |
void DisplayVertexInfo(uint32 dwAddr, uint32 dwV0, uint32 dwN); |
|
603 |
void RSP_MoveMemLight(uint32 dwLight, uint32 dwAddr); |
|
604 |
void RSP_MoveMemViewport(uint32 dwAddr); |
|
605 |
void RDP_NOIMPL_WARN(const char* op); |
|
606 |
void RSP_GFX_Force_Matrix(uint32 dwAddr); |
|
607 |
void RSP_GFX_InitGeometryMode(); |
|
608 |
void RSP_SetUcode(int ucode, uint32 ucStart=0, uint32 ucDStart=0, uint32 cdSize=0); |
|
609 |
uint32 CalcalateCRC(uint32* srcPtr, uint32 srcSize); |
|
610 |
void RDP_GFX_PopDL(); |
|
611 |
||
612 |
extern Matrix matToLoad; |
|
613 |
void LoadMatrix(uint32 addr); |
|
614 |
||
615 |
ULONG ComputeCRC32(ULONG crc, const uint8 *buf, UINT len); |
|
616 |
||
617 |
void TriggerDPInterrupt(); |
|
618 |
void TriggerSPInterrupt(); |
|
619 |
uint32 DLParser_CheckUcode(uint32 ucStart, uint32 ucDStart, uint32 ucSize, uint32 ucDSize); |
|
620 |
||
621 |
bool IsUsedAsDI(uint32 addr); |
|
622 |
||
623 |
#if defined(_DEBUG)
|
|
10.1.1
by Sven Eckelmann
* Upgraded to policy 3.9.1, no changes required |
624 |
void __cdecl LOG_UCODE(const char* szFormat, ...) __attribute__ ((format (printf, 1, 2))); |
1
by Sven Eckelmann
Import upstream version 1.5+dfsg1 |
625 |
#else
|
626 |
inline void LOG_UCODE(...) {} |
|
627 |
#endif
|
|
628 |
||
629 |
#endif // __RICE_RDP_GFX_H__ |
|
630 |