Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/mupen64plus-video-glide64/src/UcodeFB.h
2 views
1
/*
2
* Glide64 - Glide video plugin for Nintendo 64 emulators.
3
* Copyright (c) 2002 Dave2001
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the Free
17
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA
19
*/
20
21
//****************************************************************
22
//
23
// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
24
// Project started on December 29th, 2001
25
//
26
// To modify Glide64:
27
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
28
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
29
//
30
// Official Glide64 development channel: #Glide64 on EFnet
31
//
32
// Original author: Dave2001 ([email protected])
33
// Other authors: Gonetz, Gugaman
34
//
35
//****************************************************************
36
//
37
// Creation 13 August 2003 Gonetz
38
//
39
//****************************************************************
40
41
#ifndef _WIN32
42
#include <stdlib.h>
43
#endif
44
45
static void fb_uc0_moveword()
46
{
47
if ((rdp.cmd0 & 0xFF) == 0x06) // segment
48
{
49
rdp.segment[(rdp.cmd0 >> 10) & 0x0F] = rdp.cmd1;
50
}
51
}
52
53
static void fb_uc2_moveword()
54
{
55
if (((rdp.cmd0 >> 16) & 0xFF) == 0x06) // segment
56
{
57
rdp.segment[((rdp.cmd0 & 0xFFFF) >> 2)&0xF] = rdp.cmd1;
58
}
59
}
60
61
static void fb_bg_copy ()
62
{
63
if (rdp.main_ci == 0)
64
return;
65
CI_STATUS status = rdp.frame_buffers[rdp.ci_count-1].status;
66
if (status == ci_copy)
67
return;
68
69
DWORD addr = segoffset(rdp.cmd1) >> 1;
70
BYTE imageFmt = ((BYTE *)gfx.RDRAM)[(((addr+11)<<1)+0)^3];
71
BYTE imageSiz = ((BYTE *)gfx.RDRAM)[(((addr+11)<<1)+1)^3];
72
DWORD imagePtr = segoffset(((DWORD*)gfx.RDRAM)[(addr+8)>>1]);
73
FRDP ("fb_bg_copy. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx \n", imageFmt, imageSiz, imagePtr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count-1].addr);
74
75
if (status == ci_main)
76
{
77
WORD frameW = ((WORD *)gfx.RDRAM)[(addr+3)^1] >> 2;
78
WORD frameH = ((WORD *)gfx.RDRAM)[(addr+7)^1] >> 2;
79
if ( (frameW == rdp.frame_buffers[rdp.ci_count-1].width) && (frameH == rdp.frame_buffers[rdp.ci_count-1].height) )
80
rdp.main_ci_bg = imagePtr;
81
}
82
else if (imagePtr >= rdp.main_ci && imagePtr < rdp.main_ci_end) //addr within main frame buffer
83
{
84
rdp.copy_ci_index = rdp.ci_count-1;
85
rdp.frame_buffers[rdp.copy_ci_index].status = ci_copy;
86
FRDP("rdp.frame_buffers[%d].status = ci_copy\n", rdp.copy_ci_index);
87
88
if (rdp.frame_buffers[rdp.copy_ci_index].addr != rdp.main_ci_bg)
89
{
90
rdp.scale_x = 1.0f;
91
rdp.scale_y = 1.0f;
92
}
93
else
94
{
95
RDP("motion blur!\n");
96
rdp.motionblur = TRUE;
97
}
98
99
FRDP ("Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx \n", imagePtr, rdp.main_ci);
100
}
101
else if (imagePtr == rdp.zimg)
102
{
103
printf("toto !\n");
104
if (status == ci_unknown)
105
{
106
rdp.frame_buffers[rdp.ci_count-1].status = ci_zimg;
107
rdp.tmpzimg = rdp.frame_buffers[rdp.ci_count-1].addr;
108
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.copy_ci_index);
109
}
110
}
111
}
112
113
static void fb_setscissor()
114
{
115
rdp.scissor_o.lr_y = (((rdp.cmd1 & 0x00000FFF) >> 2));
116
if (rdp.ci_count)
117
{
118
rdp.scissor_o.ul_x = (((rdp.cmd0 & 0x00FFF000) >> 14));
119
rdp.scissor_o.lr_x = (((rdp.cmd1 & 0x00FFF000) >> 14));
120
COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count-1];
121
if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (cur_fb.width >> 1))
122
{
123
if (cur_fb.height == 0 || (cur_fb.width >= rdp.scissor_o.lr_x-1 && cur_fb.width <= rdp.scissor_o.lr_x+1))
124
cur_fb.height = rdp.scissor_o.lr_y;
125
}
126
FRDP("fb_setscissor. lr_x = %d, lr_y = %d, fb_width = %d, fb_height = %d\n", rdp.scissor_o.lr_x, rdp.scissor_o.lr_y, cur_fb.width, cur_fb.height);
127
}
128
}
129
130
static void fb_rect()
131
{
132
if (rdp.frame_buffers[rdp.ci_count-1].width == 32)
133
return;
134
int ul_x = ((rdp.cmd1 & 0x00FFF000) >> 14);
135
int lr_x = ((rdp.cmd0 & 0x00FFF000) >> 14);
136
int width = lr_x-ul_x;
137
DWORD lr_y = ((rdp.cmd0 & 0x00000FFF) >> 2);
138
int diff = abs((int)rdp.frame_buffers[rdp.ci_count-1].width - width);
139
if (diff < 4)
140
if (rdp.frame_buffers[rdp.ci_count-1].height < lr_y)
141
{
142
FRDP("fb_rect. ul_x: %d, lr_x: %d, fb_height: %d -> %d\n", ul_x, lr_x, rdp.frame_buffers[rdp.ci_count-1].height, lr_y);
143
rdp.frame_buffers[rdp.ci_count-1].height = lr_y;
144
}
145
}
146
147
static void fb_settextureimage()
148
{
149
if (rdp.main_ci == 0)
150
return;
151
COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count-1];
152
if ( cur_fb.status >= ci_copy )
153
return;
154
if (((rdp.cmd0 >> 19) & 0x03) >= 2) //check that texture is 16/32bit
155
{
156
int tex_format = ((rdp.cmd0 >> 21) & 0x07);
157
DWORD addr = segoffset(rdp.cmd1);
158
if ( tex_format == 0 )
159
{
160
FRDP ("fb_settextureimage. fmt: %d, size: %d, imagePtr %08lx, main_ci: %08lx, cur_ci: %08lx \n", ((rdp.cmd0 >> 21) & 0x07), ((rdp.cmd0 >> 19) & 0x03), addr, rdp.main_ci, rdp.frame_buffers[rdp.ci_count-1].addr);
161
if (cur_fb.status == ci_main)
162
{
163
rdp.main_ci_last_tex_addr = addr;
164
if (cur_fb.height == 0)
165
{
166
cur_fb.height = rdp.scissor_o.lr_y;
167
rdp.main_ci_end = cur_fb.addr + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);
168
}
169
}
170
if ((addr >= rdp.main_ci) && (addr < rdp.main_ci_end)) //addr within main frame buffer
171
{
172
if (cur_fb.status == ci_main)
173
{
174
rdp.copy_ci_index = rdp.ci_count-1;
175
cur_fb.status = ci_copy_self;
176
rdp.scale_x = rdp.scale_x_bak;
177
rdp.scale_y = rdp.scale_y_bak;
178
FRDP("rdp.frame_buffers[%d].status = ci_copy_self\n", rdp.ci_count-1);
179
}
180
else
181
{
182
if (cur_fb.width == rdp.frame_buffers[rdp.main_ci_index].width)
183
{
184
rdp.copy_ci_index = rdp.ci_count-1;
185
cur_fb.status = ci_copy;
186
FRDP("rdp.frame_buffers[%d].status = ci_copy\n", rdp.copy_ci_index);
187
if ((rdp.main_ci_last_tex_addr >= cur_fb.addr) &&
188
(rdp.main_ci_last_tex_addr < (cur_fb.addr + cur_fb.width*cur_fb.height*cur_fb.size)))
189
{
190
RDP("motion blur!\n");
191
rdp.motionblur = TRUE;
192
}
193
else
194
{
195
rdp.scale_x = 1.0f;
196
rdp.scale_y = 1.0f;
197
}
198
}
199
else if (!settings.fb_ignore_aux_copy && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)
200
{
201
rdp.copy_ci_index = rdp.ci_count-1;
202
cur_fb.status = ci_aux_copy;
203
FRDP("rdp.frame_buffers[%d].status = ci_aux_copy\n", rdp.copy_ci_index);
204
rdp.scale_x = 1.0f;
205
rdp.scale_y = 1.0f;
206
}
207
else
208
{
209
cur_fb.status = ci_aux;
210
FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.copy_ci_index);
211
}
212
}
213
FRDP ("Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx \n", addr, rdp.main_ci);
214
}
215
///*
216
else if ((cur_fb.status != ci_main) && (addr >= rdp.zimg && addr < rdp.zimg_end))
217
{
218
cur_fb.status = ci_zcopy;
219
FRDP("fb_settextureimage. rdp.frame_buffers[%d].status = ci_zcopy\n", rdp.ci_count-1);
220
}
221
//*/
222
else if ((addr >= rdp.maincimg[0].addr) && (addr < (rdp.maincimg[0].addr + rdp.maincimg[0].width*rdp.maincimg[0].height*2)))
223
{
224
if (cur_fb.status != ci_main)
225
{
226
cur_fb.status = ci_old_copy;
227
FRDP("rdp.frame_buffers[%d].status = ci_old_copy 1, addr:%08lx\n", rdp.ci_count-1, rdp.last_drawn_ci_addr);
228
}
229
rdp.read_previous_ci = TRUE;
230
RDP("read_previous_ci = TRUE\n");
231
}
232
else if ((addr >= rdp.last_drawn_ci_addr) && (addr < (rdp.last_drawn_ci_addr + rdp.maincimg[0].width*rdp.maincimg[0].height*2)))
233
{
234
if (cur_fb.status != ci_main)
235
{
236
cur_fb.status = ci_old_copy;
237
FRDP("rdp.frame_buffers[%d].status = ci_old_copy 2, addr:%08lx\n", rdp.ci_count-1, rdp.last_drawn_ci_addr);
238
}
239
rdp.read_previous_ci = TRUE;
240
RDP("read_previous_ci = TRUE\n");
241
}
242
}
243
else if (settings.fb_hires && (cur_fb.status == ci_main))
244
{
245
if ((addr >= rdp.main_ci) && (addr < rdp.main_ci_end)) //addr within main frame buffer
246
{
247
rdp.copy_ci_index = rdp.ci_count-1;
248
rdp.black_ci_index = rdp.ci_count-1;
249
cur_fb.status = ci_copy_self;
250
FRDP("rdp.frame_buffers[%d].status = ci_copy_self\n", rdp.ci_count-1);
251
}
252
}
253
}
254
if (cur_fb.status == ci_unknown)
255
{
256
cur_fb.status = ci_aux;
257
FRDP("fb_settextureimage. rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count-1);
258
}
259
}
260
261
static void fb_loadtxtr()
262
{
263
if (rdp.frame_buffers[rdp.ci_count-1].status == ci_unknown)
264
{
265
rdp.frame_buffers[rdp.ci_count-1].status = ci_aux;
266
FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count-1);
267
}
268
}
269
270
static void fb_setdepthimage()
271
{
272
rdp.zimg = segoffset(rdp.cmd1) & BMASK;
273
rdp.zimg_end = rdp.zimg + rdp.ci_width*rdp.ci_height*2;
274
FRDP ("fb_setdepthimage. addr %08lx - %08lx\n", rdp.zimg, rdp.zimg_end);
275
if (rdp.zimg == rdp.main_ci) //strange, but can happen
276
{
277
rdp.frame_buffers[rdp.main_ci_index].status = ci_unknown;
278
if (rdp.main_ci_index < rdp.ci_count)
279
{
280
rdp.frame_buffers[rdp.main_ci_index].status = ci_zimg;
281
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.main_ci_index);
282
rdp.main_ci_index++;
283
rdp.frame_buffers[rdp.main_ci_index].status = ci_main;
284
FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.main_ci_index);
285
rdp.main_ci = rdp.frame_buffers[rdp.main_ci_index].addr;
286
rdp.main_ci_end = rdp.main_ci + (rdp.frame_buffers[rdp.main_ci_index].width * rdp.frame_buffers[rdp.main_ci_index].height * rdp.frame_buffers[rdp.main_ci_index].size);
287
}
288
else
289
{
290
rdp.main_ci = 0;
291
}
292
}
293
for (int i = 0; i < rdp.ci_count; i++)
294
{
295
COLOR_IMAGE & fb = rdp.frame_buffers[i];
296
if ((fb.addr == rdp.zimg) && (fb.status == ci_aux || fb.status == ci_useless))
297
{
298
fb.status = ci_zimg;
299
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", i);
300
}
301
}
302
}
303
304
static void fb_setcolorimage()
305
{
306
rdp.ocimg = rdp.cimg;
307
rdp.cimg = segoffset(rdp.cmd1) & BMASK;
308
COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count];
309
cur_fb.width = (rdp.cmd0 & 0xFFF) + 1;
310
if (cur_fb.width == 32 )
311
cur_fb.height = 32;
312
else if (cur_fb.width == 16 )
313
cur_fb.height = 16;
314
else if (rdp.ci_count > 0)
315
cur_fb.height = rdp.scissor_o.lr_y;
316
else
317
cur_fb.height = 0;
318
cur_fb.format = (rdp.cmd0 >> 21) & 0x7;
319
cur_fb.size = (rdp.cmd0 >> 19) & 0x3;
320
cur_fb.addr = rdp.cimg;
321
cur_fb.changed = 1;
322
/*
323
if (rdp.ci_count > 0)
324
if (rdp.frame_buffers[0].addr == rdp.cimg)
325
rdp.frame_buffers[0].height = rdp.scissor_o.lr_y;
326
*/
327
FRDP ("fb_setcolorimage. width: %d, height: %d, fmt: %d, size: %d, addr %08lx\n", cur_fb.width, cur_fb.height, cur_fb.format, cur_fb.size, cur_fb.addr);
328
if ((rdp.cimg == rdp.zimg) || (rdp.cimg == rdp.tmpzimg))
329
{
330
cur_fb.status = ci_zimg;
331
if (rdp.zimg_end == rdp.zimg)
332
rdp.zimg_end = rdp.zimg + cur_fb.width*rdp.scissor_o.lr_y*2;
333
FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.ci_count);
334
}
335
else if (rdp.main_ci != 0)
336
{
337
if (rdp.cimg == rdp.main_ci) //switched to main fb again
338
{
339
cur_fb.height = max(cur_fb.height, rdp.frame_buffers[rdp.main_ci_index].height);
340
rdp.main_ci_index = rdp.ci_count;
341
rdp.main_ci_end = rdp.cimg + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);
342
cur_fb.status = ci_main;
343
FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.ci_count);
344
}
345
else // status is not known yet
346
{
347
cur_fb.status = ci_unknown;
348
}
349
}
350
else
351
{
352
if ((rdp.zimg != rdp.cimg))//&& (rdp.ocimg != rdp.cimg))
353
{
354
rdp.main_ci = rdp.cimg;
355
rdp.main_ci_end = rdp.cimg + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);
356
rdp.main_ci_index = rdp.ci_count;
357
cur_fb.status = ci_main;
358
FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.ci_count);
359
}
360
else
361
{
362
cur_fb.status = ci_unknown;
363
}
364
365
}
366
if (rdp.frame_buffers[rdp.ci_count-1].status == ci_unknown) //status of previous fb was not changed - it is useless
367
{
368
if (settings.fb_hires && !settings.PM)
369
{
370
rdp.frame_buffers[rdp.ci_count-1].status = ci_aux;
371
rdp.frame_buffers[rdp.ci_count-1].changed = 0;
372
FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count-1);
373
}
374
else
375
{
376
rdp.frame_buffers[rdp.ci_count-1].status = ci_useless;
377
/*
378
DWORD addr = rdp.frame_buffers[rdp.ci_count-1].addr;
379
for (int i = 0; i < rdp.ci_count - 1; i++)
380
{
381
if (rdp.frame_buffers[i].addr == addr)
382
{
383
rdp.frame_buffers[rdp.ci_count-1].status = rdp.frame_buffers[i].status;
384
break;
385
}
386
}
387
//*/
388
FRDP("rdp.frame_buffers[%d].status = %s\n", rdp.ci_count-1, CIStatus[rdp.frame_buffers[rdp.ci_count-1].status]);
389
}
390
}
391
if (cur_fb.status == ci_main)
392
{
393
BOOL viSwapOK = ((settings.swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;
394
if ((rdp.maincimg[0].addr != cur_fb.addr) && SwapOK && viSwapOK)
395
{
396
SwapOK = FALSE;
397
rdp.swap_ci_index = rdp.ci_count;
398
}
399
}
400
rdp.ci_count++;
401
if (rdp.ci_count > NUMTEXBUF) //overflow
402
rdp.halt = 1;
403
}
404
405
// RDP graphic instructions pointer table used in DetectFrameBufferUsage
406
407
static rdp_instr gfx_instruction_lite[9][256] =
408
{
409
{
410
// uCode 0 - RSP SW 2.0X
411
// 00-3f
412
// games: Super Mario 64, Tetrisphere, Demos
413
0, 0, 0, 0,
414
0, 0, uc0_displaylist, 0,
415
0, 0, 0, 0,
416
0, 0, 0, 0,
417
0, 0, 0, 0,
418
0, 0, 0, 0,
419
0, 0, 0, 0,
420
0, 0, 0, 0,
421
0, 0, 0, 0,
422
0, 0, 0, 0,
423
0, 0, 0, 0,
424
0, 0, 0, 0,
425
0, 0, 0, 0,
426
0, 0, 0, 0,
427
0, 0, 0, 0,
428
0, 0, 0, 0,
429
// 40-7f: Unused
430
0, 0, 0, 0,
431
0, 0, 0, 0,
432
0, 0, 0, 0,
433
0, 0, 0, 0,
434
0, 0, 0, 0,
435
0, 0, 0, 0,
436
0, 0, 0, 0,
437
0, 0, 0, 0,
438
0, 0, 0, 0,
439
0, 0, 0, 0,
440
0, 0, 0, 0,
441
0, 0, 0, 0,
442
0, 0, 0, 0,
443
0, 0, 0, 0,
444
0, 0, 0, 0,
445
0, 0, 0, 0,
446
// 80-bf: Immediate commands
447
0, 0, 0, 0,
448
0, 0, 0, 0,
449
0, 0, 0, 0,
450
0, 0, 0, 0,
451
0, 0, 0, 0,
452
0, 0, 0, 0,
453
0, 0, 0, 0,
454
0, 0, 0, 0,
455
0, 0, 0, 0,
456
0, 0, 0, 0,
457
0, 0, 0, 0,
458
0, 0, 0, 0,
459
0, 0, 0, 0,
460
0, 0, 0, 0,
461
uc0_enddl, 0, 0, 0,
462
fb_uc0_moveword, 0, uc0_culldl, 0,
463
// c0-ff: RDP commands
464
0, 0, 0, 0,
465
0, 0, 0, 0,
466
0, 0, 0, 0,
467
0, 0, 0, 0,
468
0, 0, 0, 0,
469
0, 0, 0, 0,
470
0, 0, 0, 0,
471
0, 0, 0, 0,
472
0, 0, 0, 0,
473
fb_rect, fb_rect, 0, 0,
474
0, 0, 0, 0,
475
0, fb_setscissor, 0, 0,
476
0, 0, 0, 0,
477
0, 0, fb_rect, 0,
478
0, 0, 0, 0,
479
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
480
},
481
482
// uCode 1 - F3DEX 1.XX
483
// 00-3f
484
// games: Mario Kart, Star Fox
485
{
486
0, 0, 0, 0,
487
0, 0, uc0_displaylist, 0,
488
0, 0, 0, 0,
489
0, 0, 0, 0,
490
0, 0, 0, 0,
491
0, 0, 0, 0,
492
0, 0, 0, 0,
493
0, 0, 0, 0,
494
0, 0, 0, 0,
495
0, 0, 0, 0,
496
0, 0, 0, 0,
497
0, 0, 0, 0,
498
0, 0, 0, 0,
499
0, 0, 0, 0,
500
0, 0, 0, 0,
501
0, 0, 0, 0,
502
// 40-7f: unused
503
0, 0, 0, 0,
504
0, 0, 0, 0,
505
0, 0, 0, 0,
506
0, 0, 0, 0,
507
0, 0, 0, 0,
508
0, 0, 0, 0,
509
0, 0, 0, 0,
510
0, 0, 0, 0,
511
0, 0, 0, 0,
512
0, 0, 0, 0,
513
0, 0, 0, 0,
514
0, 0, 0, 0,
515
0, 0, 0, 0,
516
0, 0, 0, 0,
517
0, 0, 0, 0,
518
0, 0, 0, 0,
519
// 80-bf: Immediate commands
520
0, 0, 0, 0,
521
0, 0, 0, 0,
522
0, 0, 0, 0,
523
0, 0, 0, 0,
524
0, 0, 0, 0,
525
0, 0, 0, 0,
526
0, 0, 0, 0,
527
0, 0, 0, 0,
528
0, 0, 0, 0,
529
0, 0, 0, 0,
530
0, 0, 0, 0,
531
0, 0, 0, uc6_loaducode,
532
uc1_branch_z, 0, 0, 0,
533
uc1_rdphalf_1, 0, 0, 0,
534
uc0_enddl, 0, 0, 0,
535
fb_uc0_moveword, 0, uc2_culldl, 0,
536
// c0-ff: RDP commands
537
0, 0, 0, 0,
538
0, 0, 0, 0,
539
0, 0, 0, 0,
540
0, 0, 0, 0,
541
0, 0, 0, 0,
542
0, 0, 0, 0,
543
0, 0, 0, 0,
544
0, 0, 0, 0,
545
0, 0, 0, 0,
546
fb_rect, fb_rect, 0, 0,
547
0, 0, 0, 0,
548
0, fb_setscissor, 0, 0,
549
0, 0, 0, 0,
550
0, 0, fb_rect, 0,
551
0, 0, 0, 0,
552
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
553
},
554
555
// uCode 2 - F3DEX 2.XX
556
// games: Zelda 64
557
{
558
// 00-3f
559
0, 0, 0, uc2_culldl,
560
uc1_branch_z, 0, 0, 0,
561
0, fb_bg_copy, fb_bg_copy, 0,
562
0, 0, 0, 0,
563
0, 0, 0, 0,
564
0, 0, 0, 0,
565
0, 0, 0, 0,
566
0, 0, 0, 0,
567
0, 0, 0, 0,
568
0, 0, 0, 0,
569
0, 0, 0, 0,
570
0, 0, 0, 0,
571
0, 0, 0, 0,
572
0, 0, 0, 0,
573
0, 0, 0, 0,
574
0, 0, 0, 0,
575
576
// 40-7f: unused
577
0, 0, 0, 0,
578
0, 0, 0, 0,
579
0, 0, 0, 0,
580
0, 0, 0, 0,
581
0, 0, 0, 0,
582
0, 0, 0, 0,
583
0, 0, 0, 0,
584
0, 0, 0, 0,
585
0, 0, 0, 0,
586
0, 0, 0, 0,
587
0, 0, 0, 0,
588
0, 0, 0, 0,
589
0, 0, 0, 0,
590
0, 0, 0, 0,
591
0, 0, 0, 0,
592
0, 0, 0, 0,
593
594
// 80-bf: unused
595
0, 0, 0, 0,
596
0, 0, 0, 0,
597
0, 0, 0, 0,
598
0, 0, 0, 0,
599
0, 0, 0, 0,
600
0, 0, 0, 0,
601
0, 0, 0, 0,
602
0, 0, 0, 0,
603
0, 0, 0, 0,
604
0, 0, 0, 0,
605
0, 0, 0, 0,
606
0, 0, 0, 0,
607
0, 0, 0, 0,
608
0, 0, 0, 0,
609
0, 0, 0, 0,
610
0, 0, 0, 0,
611
612
// c0-ff: RDP commands mixed with uc2 commands
613
0, 0, 0, 0,
614
0, 0, 0, 0,
615
0, 0, 0, 0,
616
0, 0, 0, 0,
617
0, 0, 0, 0,
618
0, uc2_dlist_cnt, 0, 0,
619
0, 0, 0, fb_uc2_moveword,
620
0/*fb_uc2_movemem*/, uc2_load_ucode, uc0_displaylist, uc0_enddl,
621
0, uc1_rdphalf_1, 0, 0,
622
fb_rect, fb_rect, 0, 0,
623
0, 0, 0, 0,
624
0, fb_setscissor, 0, 0,
625
0, 0, 0, 0,
626
0, 0, fb_rect, 0,
627
0, 0, 0, 0,
628
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
629
},
630
631
// uCode 3 - "RSP SW 2.0D", but not really
632
// 00-3f
633
// games: Wave Race
634
// ** Added by Gonetz **
635
{
636
0, 0, 0, 0,
637
0, 0, 0, 0,
638
0, 0, 0, 0,
639
0, 0, 0, 0,
640
0, 0, 0, 0,
641
0, 0, 0, 0,
642
0, 0, 0, 0,
643
0, 0, 0, 0,
644
0, 0, 0, 0,
645
0, 0, 0, 0,
646
0, 0, 0, 0,
647
0, 0, 0, 0,
648
0, 0, 0, 0,
649
0, 0, 0, 0,
650
0, 0, 0, 0,
651
0, 0, 0, 0,
652
// 40-7f: unused
653
0, 0, 0, 0,
654
0, 0, 0, 0,
655
0, 0, 0, 0,
656
0, 0, 0, 0,
657
0, 0, 0, 0,
658
0, 0, 0, 0,
659
0, 0, 0, 0,
660
0, 0, 0, 0,
661
0, 0, 0, 0,
662
0, 0, 0, 0,
663
0, 0, 0, 0,
664
0, 0, 0, 0,
665
0, 0, 0, 0,
666
0, 0, 0, 0,
667
0, 0, 0, 0,
668
0, 0, 0, 0,
669
// 80-bf: Immediate commands
670
0, 0, 0, 0,
671
0, 0, 0, 0,
672
0, 0, 0, 0,
673
0, 0, 0, 0,
674
0, 0, 0, 0,
675
0, 0, 0, 0,
676
0, 0, 0, 0,
677
0, 0, 0, 0,
678
0, 0, 0, 0,
679
0, 0, 0, 0,
680
0, 0, 0, 0,
681
0, 0, 0, 0,
682
0, 0, 0, 0,
683
0, 0, 0, 0,
684
uc0_enddl, 0, 0, 0,
685
fb_uc0_moveword, 0, uc0_culldl, 0,
686
// c0-ff: RDP commands
687
0, 0, 0, 0,
688
0, 0, 0, 0,
689
0, 0, 0, 0,
690
0, 0, 0, 0,
691
0, 0, 0, 0,
692
0, 0, 0, 0,
693
0, 0, 0, 0,
694
0, 0, 0, 0,
695
0, 0, 0, 0,
696
fb_rect, fb_rect, 0, 0,
697
0, 0, 0, 0,
698
0, fb_setscissor, 0, 0,
699
0, 0, 0, 0,
700
0, 0, fb_rect, 0,
701
0, 0, 0, 0,
702
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
703
},
704
705
{
706
// uCode 4 - RSP SW 2.0D EXT
707
// 00-3f
708
// games: Star Wars: Shadows of the Empire
709
0, 0, 0, 0,
710
0, 0, uc0_displaylist, 0,
711
0, 0, 0, 0,
712
0, 0, 0, 0,
713
0, 0, 0, 0,
714
0, 0, 0, 0,
715
0, 0, 0, 0,
716
0, 0, 0, 0,
717
0, 0, 0, 0,
718
0, 0, 0, 0,
719
0, 0, 0, 0,
720
0, 0, 0, 0,
721
0, 0, 0, 0,
722
0, 0, 0, 0,
723
0, 0, 0, 0,
724
0, 0, 0, 0,
725
// 40-7f: Unused
726
0, 0, 0, 0,
727
0, 0, 0, 0,
728
0, 0, 0, 0,
729
0, 0, 0, 0,
730
0, 0, 0, 0,
731
0, 0, 0, 0,
732
0, 0, 0, 0,
733
0, 0, 0, 0,
734
0, 0, 0, 0,
735
0, 0, 0, 0,
736
0, 0, 0, 0,
737
0, 0, 0, 0,
738
0, 0, 0, 0,
739
0, 0, 0, 0,
740
0, 0, 0, 0,
741
0, 0, 0, 0,
742
// 80-bf: Immediate commands
743
0, 0, 0, 0,
744
0, 0, 0, 0,
745
0, 0, 0, 0,
746
0, 0, 0, 0,
747
0, 0, 0, 0,
748
0, 0, 0, 0,
749
0, 0, 0, 0,
750
0, 0, 0, 0,
751
0, 0, 0, 0,
752
0, 0, 0, 0,
753
0, 0, 0, 0,
754
0, 0, 0, 0,
755
0, 0, 0, 0,
756
0, 0, 0, 0,
757
uc0_enddl, 0, 0, 0,
758
fb_uc0_moveword, 0, uc0_culldl, 0,
759
// c0-ff: RDP commands
760
rdp_noop, 0, 0, 0,
761
0, 0, 0, 0,
762
0, 0, 0, 0,
763
0, 0, 0, 0,
764
0, 0, 0, 0,
765
0, 0, 0, 0,
766
0, 0, 0, 0,
767
0, 0, 0, 0,
768
0, 0, 0, 0,
769
fb_rect, fb_rect, 0, 0,
770
0, 0, 0, 0,
771
0, fb_setscissor, 0, 0,
772
0, 0, 0, 0,
773
0, 0, fb_rect, 0,
774
0, 0, 0, 0,
775
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
776
},
777
778
{
779
// uCode 5 - RSP SW 2.0 Diddy
780
// 00-3f
781
// games: Diddy Kong Racing
782
0, 0, 0, 0,
783
0, 0, uc0_displaylist, uc5_dl_in_mem,
784
0, 0, 0, 0,
785
0, 0, 0, 0,
786
0, 0, 0, 0,
787
0, 0, 0, 0,
788
0, 0, 0, 0,
789
0, 0, 0, 0,
790
0, 0, 0, 0,
791
0, 0, 0, 0,
792
0, 0, 0, 0,
793
0, 0, 0, 0,
794
0, 0, 0, 0,
795
0, 0, 0, 0,
796
0, 0, 0, 0,
797
0, 0, 0, 0,
798
// 40-7f: Unused
799
0, 0, 0, 0,
800
0, 0, 0, 0,
801
0, 0, 0, 0,
802
0, 0, 0, 0,
803
0, 0, 0, 0,
804
0, 0, 0, 0,
805
0, 0, 0, 0,
806
0, 0, 0, 0,
807
0, 0, 0, 0,
808
0, 0, 0, 0,
809
0, 0, 0, 0,
810
0, 0, 0, 0,
811
0, 0, 0, 0,
812
0, 0, 0, 0,
813
0, 0, 0, 0,
814
0, 0, 0, 0,
815
// 80-bf: Immediate commands
816
0, 0, 0, 0,
817
0, 0, 0, 0,
818
0, 0, 0, 0,
819
0, 0, 0, 0,
820
0, 0, 0, 0,
821
0, 0, 0, 0,
822
0, 0, 0, 0,
823
0, 0, 0, 0,
824
0, 0, 0, 0,
825
0, 0, 0, 0,
826
0, 0, 0, 0,
827
0, 0, 0, 0,
828
0, 0, 0, 0,
829
0, 0, 0, 0,
830
uc0_enddl, 0, 0, 0,
831
fb_uc0_moveword, 0, uc0_culldl, 0,
832
// c0-ff: RDP commands
833
0, 0, 0, 0,
834
0, 0, 0, 0,
835
0, 0, 0, 0,
836
0, 0, 0, 0,
837
0, 0, 0, 0,
838
0, 0, 0, 0,
839
0, 0, 0, 0,
840
0, 0, 0, 0,
841
0, 0, 0, 0,
842
fb_rect, fb_rect, 0, 0,
843
0, 0, 0, 0,
844
0, fb_setscissor, 0, 0,
845
0, 0, 0, 0,
846
0, 0, fb_rect, 0,
847
0, 0, 0, 0,
848
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
849
},
850
851
// uCode 6 - S2DEX 1.XX
852
// games: Yoshi's Story
853
{
854
0, 0, 0, 0,
855
0, 0, uc0_displaylist, 0,
856
0, 0, 0, 0,
857
0, 0, 0, 0,
858
0, 0, 0, 0,
859
0, 0, 0, 0,
860
0, 0, 0, 0,
861
0, 0, 0, 0,
862
0, 0, 0, 0,
863
0, 0, 0, 0,
864
0, 0, 0, 0,
865
0, 0, 0, 0,
866
0, 0, 0, 0,
867
0, 0, 0, 0,
868
0, 0, 0, 0,
869
0, 0, 0, 0,
870
// 40-7f: unused
871
0, 0, 0, 0,
872
0, 0, 0, 0,
873
0, 0, 0, 0,
874
0, 0, 0, 0,
875
0, 0, 0, 0,
876
0, 0, 0, 0,
877
0, 0, 0, 0,
878
0, 0, 0, 0,
879
0, 0, 0, 0,
880
0, 0, 0, 0,
881
0, 0, 0, 0,
882
0, 0, 0, 0,
883
0, 0, 0, 0,
884
0, 0, 0, 0,
885
0, 0, 0, 0,
886
0, 0, 0, 0,
887
// 80-bf: Immediate commands
888
0, 0, 0, 0,
889
0, 0, 0, 0,
890
0, 0, 0, 0,
891
0, 0, 0, 0,
892
0, 0, 0, 0,
893
0, 0, 0, 0,
894
0, 0, 0, 0,
895
0, 0, 0, 0,
896
0, 0, 0, 0,
897
0, 0, 0, 0,
898
0, 0, 0, 0,
899
0, 0, 0, uc6_loaducode,
900
uc6_select_dl, 0, 0, 0,
901
0, 0, 0, 0,
902
uc0_enddl, 0, 0, 0,
903
fb_uc0_moveword, 0, uc2_culldl, 0,
904
// c0-ff: RDP commands
905
0, fb_loadtxtr, fb_loadtxtr, fb_loadtxtr,
906
fb_loadtxtr, 0, 0, 0,
907
0, 0, 0, 0,
908
0, 0, 0, 0,
909
0, 0, 0, 0,
910
0, 0, 0, 0,
911
0, 0, 0, 0,
912
0, 0, 0, 0,
913
0, 0, 0, 0,
914
fb_rect, fb_rect, 0, 0,
915
0, 0, 0, 0,
916
0, fb_setscissor, 0, 0,
917
0, 0, 0, 0,
918
0, 0, fb_rect, 0,
919
0, 0, 0, 0,
920
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
921
},
922
923
{
924
0, 0, 0, 0,
925
0, 0, uc0_displaylist, 0,
926
0, 0, 0, 0,
927
0, 0, 0, 0,
928
0, 0, 0, 0,
929
0, 0, 0, 0,
930
0, 0, 0, 0,
931
0, 0, 0, 0,
932
0, 0, 0, 0,
933
0, 0, 0, 0,
934
0, 0, 0, 0,
935
0, 0, 0, 0,
936
0, 0, 0, 0,
937
0, 0, 0, 0,
938
0, 0, 0, 0,
939
0, 0, 0, 0,
940
// 40-7f: unused
941
0, 0, 0, 0,
942
0, 0, 0, 0,
943
0, 0, 0, 0,
944
0, 0, 0, 0,
945
0, 0, 0, 0,
946
0, 0, 0, 0,
947
0, 0, 0, 0,
948
0, 0, 0, 0,
949
0, 0, 0, 0,
950
0, 0, 0, 0,
951
0, 0, 0, 0,
952
0, 0, 0, 0,
953
0, 0, 0, 0,
954
0, 0, 0, 0,
955
0, 0, 0, 0,
956
0, 0, 0, 0,
957
// 80-bf: Immediate commands
958
0, 0, 0, 0,
959
0, 0, 0, 0,
960
0, 0, 0, 0,
961
0, 0, 0, 0,
962
0, 0, 0, 0,
963
0, 0, 0, 0,
964
0, 0, 0, 0,
965
0, 0, 0, 0,
966
0, 0, 0, 0,
967
0, 0, 0, 0,
968
0, 0, 0, 0,
969
0, 0, 0, 0,
970
0, 0, 0, 0,
971
0, 0, 0, 0,
972
uc0_enddl, 0, 0, 0,
973
fb_uc0_moveword, 0, uc0_culldl, 0,
974
// c0-ff: RDP commands
975
0, 0, 0, 0,
976
0, 0, 0, 0,
977
0, 0, 0, 0,
978
0, 0, 0, 0,
979
0, 0, 0, 0,
980
0, 0, 0, 0,
981
0, 0, 0, 0,
982
0, 0, 0, 0,
983
0, 0, 0, 0,
984
fb_rect, fb_rect, 0, 0,
985
0, 0, 0, 0,
986
0, fb_setscissor, 0, 0,
987
0, 0, 0, 0,
988
0, 0, fb_rect, 0,
989
0, 0, 0, 0,
990
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
991
},
992
993
{
994
// 00-3f
995
0, 0, 0, uc2_culldl,
996
uc1_branch_z, 0, 0, 0,
997
0, fb_bg_copy, fb_bg_copy, 0,
998
0, 0, 0, 0,
999
0, 0, 0, 0,
1000
0, 0, 0, 0,
1001
0, 0, 0, 0,
1002
0, 0, 0, 0,
1003
0, 0, 0, 0,
1004
0, 0, 0, 0,
1005
0, 0, 0, 0,
1006
0, 0, 0, 0,
1007
0, 0, 0, 0,
1008
0, 0, 0, 0,
1009
0, 0, 0, 0,
1010
0, 0, 0, 0,
1011
1012
// 40-7f: unused
1013
0, 0, 0, 0,
1014
0, 0, 0, 0,
1015
0, 0, 0, 0,
1016
0, 0, 0, 0,
1017
0, 0, 0, 0,
1018
0, 0, 0, 0,
1019
0, 0, 0, 0,
1020
0, 0, 0, 0,
1021
0, 0, 0, 0,
1022
0, 0, 0, 0,
1023
0, 0, 0, 0,
1024
0, 0, 0, 0,
1025
0, 0, 0, 0,
1026
0, 0, 0, 0,
1027
0, 0, 0, 0,
1028
0, 0, 0, 0,
1029
1030
// 80-bf: unused
1031
0, 0, 0, 0,
1032
0, 0, 0, 0,
1033
0, 0, 0, 0,
1034
0, 0, 0, 0,
1035
0, 0, 0, 0,
1036
0, 0, 0, 0,
1037
0, 0, 0, 0,
1038
0, 0, 0, 0,
1039
0, 0, 0, 0,
1040
0, 0, 0, 0,
1041
0, 0, 0, 0,
1042
0, 0, 0, 0,
1043
0, 0, 0, 0,
1044
0, 0, 0, 0,
1045
0, 0, 0, 0,
1046
0, 0, 0, 0,
1047
1048
// c0-ff: RDP commands mixed with uc2 commands
1049
0, 0, 0, 0,
1050
0, 0, 0, 0,
1051
0, 0, 0, 0,
1052
0, 0, 0, 0,
1053
0, 0, 0, 0,
1054
0, uc2_dlist_cnt, 0, 0,
1055
0, 0, 0, fb_uc2_moveword,
1056
0, uc2_load_ucode, uc0_displaylist, uc0_enddl,
1057
0, uc1_rdphalf_1, 0, 0,
1058
fb_rect, fb_rect, 0, 0,
1059
0, 0, 0, 0,
1060
0, fb_setscissor, 0, 0,
1061
0, 0, 0, 0,
1062
0, 0, fb_rect, 0,
1063
0, 0, 0, 0,
1064
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
1065
}
1066
};
1067
1068
1069