Path: blob/master/libmupen64plus/mupen64plus-video-glide64/src/UcodeFB.h
2 views
/*1* Glide64 - Glide video plugin for Nintendo 64 emulators.2* Copyright (c) 2002 Dave20013*4* This program is free software; you can redistribute it and/or modify5* it under the terms of the GNU General Public License as published by6* the Free Software Foundation; either version 2 of the License, or7* 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 of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12* GNU General Public License for more details.13*14* You should have received a copy of the GNU General Public15* License along with this program; if not, write to the Free16* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,17* Boston, MA 02110-1301, USA18*/1920//****************************************************************21//22// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)23// Project started on December 29th, 200124//25// To modify Glide64:26// * 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.27// * 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.28//29// Official Glide64 development channel: #Glide64 on EFnet30//31// Original author: Dave2001 ([email protected])32// Other authors: Gonetz, Gugaman33//34//****************************************************************35//36// Creation 13 August 2003 Gonetz37//38//****************************************************************3940#ifndef _WIN3241#include <stdlib.h>42#endif4344static void fb_uc0_moveword()45{46if ((rdp.cmd0 & 0xFF) == 0x06) // segment47{48rdp.segment[(rdp.cmd0 >> 10) & 0x0F] = rdp.cmd1;49}50}5152static void fb_uc2_moveword()53{54if (((rdp.cmd0 >> 16) & 0xFF) == 0x06) // segment55{56rdp.segment[((rdp.cmd0 & 0xFFFF) >> 2)&0xF] = rdp.cmd1;57}58}5960static void fb_bg_copy ()61{62if (rdp.main_ci == 0)63return;64CI_STATUS status = rdp.frame_buffers[rdp.ci_count-1].status;65if (status == ci_copy)66return;6768DWORD addr = segoffset(rdp.cmd1) >> 1;69BYTE imageFmt = ((BYTE *)gfx.RDRAM)[(((addr+11)<<1)+0)^3];70BYTE imageSiz = ((BYTE *)gfx.RDRAM)[(((addr+11)<<1)+1)^3];71DWORD imagePtr = segoffset(((DWORD*)gfx.RDRAM)[(addr+8)>>1]);72FRDP ("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);7374if (status == ci_main)75{76WORD frameW = ((WORD *)gfx.RDRAM)[(addr+3)^1] >> 2;77WORD frameH = ((WORD *)gfx.RDRAM)[(addr+7)^1] >> 2;78if ( (frameW == rdp.frame_buffers[rdp.ci_count-1].width) && (frameH == rdp.frame_buffers[rdp.ci_count-1].height) )79rdp.main_ci_bg = imagePtr;80}81else if (imagePtr >= rdp.main_ci && imagePtr < rdp.main_ci_end) //addr within main frame buffer82{83rdp.copy_ci_index = rdp.ci_count-1;84rdp.frame_buffers[rdp.copy_ci_index].status = ci_copy;85FRDP("rdp.frame_buffers[%d].status = ci_copy\n", rdp.copy_ci_index);8687if (rdp.frame_buffers[rdp.copy_ci_index].addr != rdp.main_ci_bg)88{89rdp.scale_x = 1.0f;90rdp.scale_y = 1.0f;91}92else93{94RDP("motion blur!\n");95rdp.motionblur = TRUE;96}9798FRDP ("Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx \n", imagePtr, rdp.main_ci);99}100else if (imagePtr == rdp.zimg)101{102printf("toto !\n");103if (status == ci_unknown)104{105rdp.frame_buffers[rdp.ci_count-1].status = ci_zimg;106rdp.tmpzimg = rdp.frame_buffers[rdp.ci_count-1].addr;107FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.copy_ci_index);108}109}110}111112static void fb_setscissor()113{114rdp.scissor_o.lr_y = (((rdp.cmd1 & 0x00000FFF) >> 2));115if (rdp.ci_count)116{117rdp.scissor_o.ul_x = (((rdp.cmd0 & 0x00FFF000) >> 14));118rdp.scissor_o.lr_x = (((rdp.cmd1 & 0x00FFF000) >> 14));119COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count-1];120if (rdp.scissor_o.lr_x - rdp.scissor_o.ul_x > (cur_fb.width >> 1))121{122if (cur_fb.height == 0 || (cur_fb.width >= rdp.scissor_o.lr_x-1 && cur_fb.width <= rdp.scissor_o.lr_x+1))123cur_fb.height = rdp.scissor_o.lr_y;124}125FRDP("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);126}127}128129static void fb_rect()130{131if (rdp.frame_buffers[rdp.ci_count-1].width == 32)132return;133int ul_x = ((rdp.cmd1 & 0x00FFF000) >> 14);134int lr_x = ((rdp.cmd0 & 0x00FFF000) >> 14);135int width = lr_x-ul_x;136DWORD lr_y = ((rdp.cmd0 & 0x00000FFF) >> 2);137int diff = abs((int)rdp.frame_buffers[rdp.ci_count-1].width - width);138if (diff < 4)139if (rdp.frame_buffers[rdp.ci_count-1].height < lr_y)140{141FRDP("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);142rdp.frame_buffers[rdp.ci_count-1].height = lr_y;143}144}145146static void fb_settextureimage()147{148if (rdp.main_ci == 0)149return;150COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count-1];151if ( cur_fb.status >= ci_copy )152return;153if (((rdp.cmd0 >> 19) & 0x03) >= 2) //check that texture is 16/32bit154{155int tex_format = ((rdp.cmd0 >> 21) & 0x07);156DWORD addr = segoffset(rdp.cmd1);157if ( tex_format == 0 )158{159FRDP ("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);160if (cur_fb.status == ci_main)161{162rdp.main_ci_last_tex_addr = addr;163if (cur_fb.height == 0)164{165cur_fb.height = rdp.scissor_o.lr_y;166rdp.main_ci_end = cur_fb.addr + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);167}168}169if ((addr >= rdp.main_ci) && (addr < rdp.main_ci_end)) //addr within main frame buffer170{171if (cur_fb.status == ci_main)172{173rdp.copy_ci_index = rdp.ci_count-1;174cur_fb.status = ci_copy_self;175rdp.scale_x = rdp.scale_x_bak;176rdp.scale_y = rdp.scale_y_bak;177FRDP("rdp.frame_buffers[%d].status = ci_copy_self\n", rdp.ci_count-1);178}179else180{181if (cur_fb.width == rdp.frame_buffers[rdp.main_ci_index].width)182{183rdp.copy_ci_index = rdp.ci_count-1;184cur_fb.status = ci_copy;185FRDP("rdp.frame_buffers[%d].status = ci_copy\n", rdp.copy_ci_index);186if ((rdp.main_ci_last_tex_addr >= cur_fb.addr) &&187(rdp.main_ci_last_tex_addr < (cur_fb.addr + cur_fb.width*cur_fb.height*cur_fb.size)))188{189RDP("motion blur!\n");190rdp.motionblur = TRUE;191}192else193{194rdp.scale_x = 1.0f;195rdp.scale_y = 1.0f;196}197}198else if (!settings.fb_ignore_aux_copy && cur_fb.width < rdp.frame_buffers[rdp.main_ci_index].width)199{200rdp.copy_ci_index = rdp.ci_count-1;201cur_fb.status = ci_aux_copy;202FRDP("rdp.frame_buffers[%d].status = ci_aux_copy\n", rdp.copy_ci_index);203rdp.scale_x = 1.0f;204rdp.scale_y = 1.0f;205}206else207{208cur_fb.status = ci_aux;209FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.copy_ci_index);210}211}212FRDP ("Detect FB usage. texture addr is inside framebuffer: %08lx - %08lx \n", addr, rdp.main_ci);213}214///*215else if ((cur_fb.status != ci_main) && (addr >= rdp.zimg && addr < rdp.zimg_end))216{217cur_fb.status = ci_zcopy;218FRDP("fb_settextureimage. rdp.frame_buffers[%d].status = ci_zcopy\n", rdp.ci_count-1);219}220//*/221else if ((addr >= rdp.maincimg[0].addr) && (addr < (rdp.maincimg[0].addr + rdp.maincimg[0].width*rdp.maincimg[0].height*2)))222{223if (cur_fb.status != ci_main)224{225cur_fb.status = ci_old_copy;226FRDP("rdp.frame_buffers[%d].status = ci_old_copy 1, addr:%08lx\n", rdp.ci_count-1, rdp.last_drawn_ci_addr);227}228rdp.read_previous_ci = TRUE;229RDP("read_previous_ci = TRUE\n");230}231else if ((addr >= rdp.last_drawn_ci_addr) && (addr < (rdp.last_drawn_ci_addr + rdp.maincimg[0].width*rdp.maincimg[0].height*2)))232{233if (cur_fb.status != ci_main)234{235cur_fb.status = ci_old_copy;236FRDP("rdp.frame_buffers[%d].status = ci_old_copy 2, addr:%08lx\n", rdp.ci_count-1, rdp.last_drawn_ci_addr);237}238rdp.read_previous_ci = TRUE;239RDP("read_previous_ci = TRUE\n");240}241}242else if (settings.fb_hires && (cur_fb.status == ci_main))243{244if ((addr >= rdp.main_ci) && (addr < rdp.main_ci_end)) //addr within main frame buffer245{246rdp.copy_ci_index = rdp.ci_count-1;247rdp.black_ci_index = rdp.ci_count-1;248cur_fb.status = ci_copy_self;249FRDP("rdp.frame_buffers[%d].status = ci_copy_self\n", rdp.ci_count-1);250}251}252}253if (cur_fb.status == ci_unknown)254{255cur_fb.status = ci_aux;256FRDP("fb_settextureimage. rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count-1);257}258}259260static void fb_loadtxtr()261{262if (rdp.frame_buffers[rdp.ci_count-1].status == ci_unknown)263{264rdp.frame_buffers[rdp.ci_count-1].status = ci_aux;265FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count-1);266}267}268269static void fb_setdepthimage()270{271rdp.zimg = segoffset(rdp.cmd1) & BMASK;272rdp.zimg_end = rdp.zimg + rdp.ci_width*rdp.ci_height*2;273FRDP ("fb_setdepthimage. addr %08lx - %08lx\n", rdp.zimg, rdp.zimg_end);274if (rdp.zimg == rdp.main_ci) //strange, but can happen275{276rdp.frame_buffers[rdp.main_ci_index].status = ci_unknown;277if (rdp.main_ci_index < rdp.ci_count)278{279rdp.frame_buffers[rdp.main_ci_index].status = ci_zimg;280FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.main_ci_index);281rdp.main_ci_index++;282rdp.frame_buffers[rdp.main_ci_index].status = ci_main;283FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.main_ci_index);284rdp.main_ci = rdp.frame_buffers[rdp.main_ci_index].addr;285rdp.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);286}287else288{289rdp.main_ci = 0;290}291}292for (int i = 0; i < rdp.ci_count; i++)293{294COLOR_IMAGE & fb = rdp.frame_buffers[i];295if ((fb.addr == rdp.zimg) && (fb.status == ci_aux || fb.status == ci_useless))296{297fb.status = ci_zimg;298FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", i);299}300}301}302303static void fb_setcolorimage()304{305rdp.ocimg = rdp.cimg;306rdp.cimg = segoffset(rdp.cmd1) & BMASK;307COLOR_IMAGE & cur_fb = rdp.frame_buffers[rdp.ci_count];308cur_fb.width = (rdp.cmd0 & 0xFFF) + 1;309if (cur_fb.width == 32 )310cur_fb.height = 32;311else if (cur_fb.width == 16 )312cur_fb.height = 16;313else if (rdp.ci_count > 0)314cur_fb.height = rdp.scissor_o.lr_y;315else316cur_fb.height = 0;317cur_fb.format = (rdp.cmd0 >> 21) & 0x7;318cur_fb.size = (rdp.cmd0 >> 19) & 0x3;319cur_fb.addr = rdp.cimg;320cur_fb.changed = 1;321/*322if (rdp.ci_count > 0)323if (rdp.frame_buffers[0].addr == rdp.cimg)324rdp.frame_buffers[0].height = rdp.scissor_o.lr_y;325*/326FRDP ("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);327if ((rdp.cimg == rdp.zimg) || (rdp.cimg == rdp.tmpzimg))328{329cur_fb.status = ci_zimg;330if (rdp.zimg_end == rdp.zimg)331rdp.zimg_end = rdp.zimg + cur_fb.width*rdp.scissor_o.lr_y*2;332FRDP("rdp.frame_buffers[%d].status = ci_zimg\n", rdp.ci_count);333}334else if (rdp.main_ci != 0)335{336if (rdp.cimg == rdp.main_ci) //switched to main fb again337{338cur_fb.height = max(cur_fb.height, rdp.frame_buffers[rdp.main_ci_index].height);339rdp.main_ci_index = rdp.ci_count;340rdp.main_ci_end = rdp.cimg + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);341cur_fb.status = ci_main;342FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.ci_count);343}344else // status is not known yet345{346cur_fb.status = ci_unknown;347}348}349else350{351if ((rdp.zimg != rdp.cimg))//&& (rdp.ocimg != rdp.cimg))352{353rdp.main_ci = rdp.cimg;354rdp.main_ci_end = rdp.cimg + ((cur_fb.width * cur_fb.height) << cur_fb.size >> 1);355rdp.main_ci_index = rdp.ci_count;356cur_fb.status = ci_main;357FRDP("rdp.frame_buffers[%d].status = ci_main\n", rdp.ci_count);358}359else360{361cur_fb.status = ci_unknown;362}363364}365if (rdp.frame_buffers[rdp.ci_count-1].status == ci_unknown) //status of previous fb was not changed - it is useless366{367if (settings.fb_hires && !settings.PM)368{369rdp.frame_buffers[rdp.ci_count-1].status = ci_aux;370rdp.frame_buffers[rdp.ci_count-1].changed = 0;371FRDP("rdp.frame_buffers[%d].status = ci_aux\n", rdp.ci_count-1);372}373else374{375rdp.frame_buffers[rdp.ci_count-1].status = ci_useless;376/*377DWORD addr = rdp.frame_buffers[rdp.ci_count-1].addr;378for (int i = 0; i < rdp.ci_count - 1; i++)379{380if (rdp.frame_buffers[i].addr == addr)381{382rdp.frame_buffers[rdp.ci_count-1].status = rdp.frame_buffers[i].status;383break;384}385}386//*/387FRDP("rdp.frame_buffers[%d].status = %s\n", rdp.ci_count-1, CIStatus[rdp.frame_buffers[rdp.ci_count-1].status]);388}389}390if (cur_fb.status == ci_main)391{392BOOL viSwapOK = ((settings.swapmode == 2) && (rdp.vi_org_reg == *gfx.VI_ORIGIN_REG)) ? FALSE : TRUE;393if ((rdp.maincimg[0].addr != cur_fb.addr) && SwapOK && viSwapOK)394{395SwapOK = FALSE;396rdp.swap_ci_index = rdp.ci_count;397}398}399rdp.ci_count++;400if (rdp.ci_count > NUMTEXBUF) //overflow401rdp.halt = 1;402}403404// RDP graphic instructions pointer table used in DetectFrameBufferUsage405406static rdp_instr gfx_instruction_lite[9][256] =407{408{409// uCode 0 - RSP SW 2.0X410// 00-3f411// games: Super Mario 64, Tetrisphere, Demos4120, 0, 0, 0,4130, 0, uc0_displaylist, 0,4140, 0, 0, 0,4150, 0, 0, 0,4160, 0, 0, 0,4170, 0, 0, 0,4180, 0, 0, 0,4190, 0, 0, 0,4200, 0, 0, 0,4210, 0, 0, 0,4220, 0, 0, 0,4230, 0, 0, 0,4240, 0, 0, 0,4250, 0, 0, 0,4260, 0, 0, 0,4270, 0, 0, 0,428// 40-7f: Unused4290, 0, 0, 0,4300, 0, 0, 0,4310, 0, 0, 0,4320, 0, 0, 0,4330, 0, 0, 0,4340, 0, 0, 0,4350, 0, 0, 0,4360, 0, 0, 0,4370, 0, 0, 0,4380, 0, 0, 0,4390, 0, 0, 0,4400, 0, 0, 0,4410, 0, 0, 0,4420, 0, 0, 0,4430, 0, 0, 0,4440, 0, 0, 0,445// 80-bf: Immediate commands4460, 0, 0, 0,4470, 0, 0, 0,4480, 0, 0, 0,4490, 0, 0, 0,4500, 0, 0, 0,4510, 0, 0, 0,4520, 0, 0, 0,4530, 0, 0, 0,4540, 0, 0, 0,4550, 0, 0, 0,4560, 0, 0, 0,4570, 0, 0, 0,4580, 0, 0, 0,4590, 0, 0, 0,460uc0_enddl, 0, 0, 0,461fb_uc0_moveword, 0, uc0_culldl, 0,462// c0-ff: RDP commands4630, 0, 0, 0,4640, 0, 0, 0,4650, 0, 0, 0,4660, 0, 0, 0,4670, 0, 0, 0,4680, 0, 0, 0,4690, 0, 0, 0,4700, 0, 0, 0,4710, 0, 0, 0,472fb_rect, fb_rect, 0, 0,4730, 0, 0, 0,4740, fb_setscissor, 0, 0,4750, 0, 0, 0,4760, 0, fb_rect, 0,4770, 0, 0, 0,4780, fb_settextureimage, fb_setdepthimage, fb_setcolorimage479},480481// uCode 1 - F3DEX 1.XX482// 00-3f483// games: Mario Kart, Star Fox484{4850, 0, 0, 0,4860, 0, uc0_displaylist, 0,4870, 0, 0, 0,4880, 0, 0, 0,4890, 0, 0, 0,4900, 0, 0, 0,4910, 0, 0, 0,4920, 0, 0, 0,4930, 0, 0, 0,4940, 0, 0, 0,4950, 0, 0, 0,4960, 0, 0, 0,4970, 0, 0, 0,4980, 0, 0, 0,4990, 0, 0, 0,5000, 0, 0, 0,501// 40-7f: unused5020, 0, 0, 0,5030, 0, 0, 0,5040, 0, 0, 0,5050, 0, 0, 0,5060, 0, 0, 0,5070, 0, 0, 0,5080, 0, 0, 0,5090, 0, 0, 0,5100, 0, 0, 0,5110, 0, 0, 0,5120, 0, 0, 0,5130, 0, 0, 0,5140, 0, 0, 0,5150, 0, 0, 0,5160, 0, 0, 0,5170, 0, 0, 0,518// 80-bf: Immediate commands5190, 0, 0, 0,5200, 0, 0, 0,5210, 0, 0, 0,5220, 0, 0, 0,5230, 0, 0, 0,5240, 0, 0, 0,5250, 0, 0, 0,5260, 0, 0, 0,5270, 0, 0, 0,5280, 0, 0, 0,5290, 0, 0, 0,5300, 0, 0, uc6_loaducode,531uc1_branch_z, 0, 0, 0,532uc1_rdphalf_1, 0, 0, 0,533uc0_enddl, 0, 0, 0,534fb_uc0_moveword, 0, uc2_culldl, 0,535// c0-ff: RDP commands5360, 0, 0, 0,5370, 0, 0, 0,5380, 0, 0, 0,5390, 0, 0, 0,5400, 0, 0, 0,5410, 0, 0, 0,5420, 0, 0, 0,5430, 0, 0, 0,5440, 0, 0, 0,545fb_rect, fb_rect, 0, 0,5460, 0, 0, 0,5470, fb_setscissor, 0, 0,5480, 0, 0, 0,5490, 0, fb_rect, 0,5500, 0, 0, 0,5510, fb_settextureimage, fb_setdepthimage, fb_setcolorimage552},553554// uCode 2 - F3DEX 2.XX555// games: Zelda 64556{557// 00-3f5580, 0, 0, uc2_culldl,559uc1_branch_z, 0, 0, 0,5600, fb_bg_copy, fb_bg_copy, 0,5610, 0, 0, 0,5620, 0, 0, 0,5630, 0, 0, 0,5640, 0, 0, 0,5650, 0, 0, 0,5660, 0, 0, 0,5670, 0, 0, 0,5680, 0, 0, 0,5690, 0, 0, 0,5700, 0, 0, 0,5710, 0, 0, 0,5720, 0, 0, 0,5730, 0, 0, 0,574575// 40-7f: unused5760, 0, 0, 0,5770, 0, 0, 0,5780, 0, 0, 0,5790, 0, 0, 0,5800, 0, 0, 0,5810, 0, 0, 0,5820, 0, 0, 0,5830, 0, 0, 0,5840, 0, 0, 0,5850, 0, 0, 0,5860, 0, 0, 0,5870, 0, 0, 0,5880, 0, 0, 0,5890, 0, 0, 0,5900, 0, 0, 0,5910, 0, 0, 0,592593// 80-bf: unused5940, 0, 0, 0,5950, 0, 0, 0,5960, 0, 0, 0,5970, 0, 0, 0,5980, 0, 0, 0,5990, 0, 0, 0,6000, 0, 0, 0,6010, 0, 0, 0,6020, 0, 0, 0,6030, 0, 0, 0,6040, 0, 0, 0,6050, 0, 0, 0,6060, 0, 0, 0,6070, 0, 0, 0,6080, 0, 0, 0,6090, 0, 0, 0,610611// c0-ff: RDP commands mixed with uc2 commands6120, 0, 0, 0,6130, 0, 0, 0,6140, 0, 0, 0,6150, 0, 0, 0,6160, 0, 0, 0,6170, uc2_dlist_cnt, 0, 0,6180, 0, 0, fb_uc2_moveword,6190/*fb_uc2_movemem*/, uc2_load_ucode, uc0_displaylist, uc0_enddl,6200, uc1_rdphalf_1, 0, 0,621fb_rect, fb_rect, 0, 0,6220, 0, 0, 0,6230, fb_setscissor, 0, 0,6240, 0, 0, 0,6250, 0, fb_rect, 0,6260, 0, 0, 0,6270, fb_settextureimage, fb_setdepthimage, fb_setcolorimage628},629630// uCode 3 - "RSP SW 2.0D", but not really631// 00-3f632// games: Wave Race633// ** Added by Gonetz **634{6350, 0, 0, 0,6360, 0, 0, 0,6370, 0, 0, 0,6380, 0, 0, 0,6390, 0, 0, 0,6400, 0, 0, 0,6410, 0, 0, 0,6420, 0, 0, 0,6430, 0, 0, 0,6440, 0, 0, 0,6450, 0, 0, 0,6460, 0, 0, 0,6470, 0, 0, 0,6480, 0, 0, 0,6490, 0, 0, 0,6500, 0, 0, 0,651// 40-7f: unused6520, 0, 0, 0,6530, 0, 0, 0,6540, 0, 0, 0,6550, 0, 0, 0,6560, 0, 0, 0,6570, 0, 0, 0,6580, 0, 0, 0,6590, 0, 0, 0,6600, 0, 0, 0,6610, 0, 0, 0,6620, 0, 0, 0,6630, 0, 0, 0,6640, 0, 0, 0,6650, 0, 0, 0,6660, 0, 0, 0,6670, 0, 0, 0,668// 80-bf: Immediate commands6690, 0, 0, 0,6700, 0, 0, 0,6710, 0, 0, 0,6720, 0, 0, 0,6730, 0, 0, 0,6740, 0, 0, 0,6750, 0, 0, 0,6760, 0, 0, 0,6770, 0, 0, 0,6780, 0, 0, 0,6790, 0, 0, 0,6800, 0, 0, 0,6810, 0, 0, 0,6820, 0, 0, 0,683uc0_enddl, 0, 0, 0,684fb_uc0_moveword, 0, uc0_culldl, 0,685// c0-ff: RDP commands6860, 0, 0, 0,6870, 0, 0, 0,6880, 0, 0, 0,6890, 0, 0, 0,6900, 0, 0, 0,6910, 0, 0, 0,6920, 0, 0, 0,6930, 0, 0, 0,6940, 0, 0, 0,695fb_rect, fb_rect, 0, 0,6960, 0, 0, 0,6970, fb_setscissor, 0, 0,6980, 0, 0, 0,6990, 0, fb_rect, 0,7000, 0, 0, 0,7010, fb_settextureimage, fb_setdepthimage, fb_setcolorimage702},703704{705// uCode 4 - RSP SW 2.0D EXT706// 00-3f707// games: Star Wars: Shadows of the Empire7080, 0, 0, 0,7090, 0, uc0_displaylist, 0,7100, 0, 0, 0,7110, 0, 0, 0,7120, 0, 0, 0,7130, 0, 0, 0,7140, 0, 0, 0,7150, 0, 0, 0,7160, 0, 0, 0,7170, 0, 0, 0,7180, 0, 0, 0,7190, 0, 0, 0,7200, 0, 0, 0,7210, 0, 0, 0,7220, 0, 0, 0,7230, 0, 0, 0,724// 40-7f: Unused7250, 0, 0, 0,7260, 0, 0, 0,7270, 0, 0, 0,7280, 0, 0, 0,7290, 0, 0, 0,7300, 0, 0, 0,7310, 0, 0, 0,7320, 0, 0, 0,7330, 0, 0, 0,7340, 0, 0, 0,7350, 0, 0, 0,7360, 0, 0, 0,7370, 0, 0, 0,7380, 0, 0, 0,7390, 0, 0, 0,7400, 0, 0, 0,741// 80-bf: Immediate commands7420, 0, 0, 0,7430, 0, 0, 0,7440, 0, 0, 0,7450, 0, 0, 0,7460, 0, 0, 0,7470, 0, 0, 0,7480, 0, 0, 0,7490, 0, 0, 0,7500, 0, 0, 0,7510, 0, 0, 0,7520, 0, 0, 0,7530, 0, 0, 0,7540, 0, 0, 0,7550, 0, 0, 0,756uc0_enddl, 0, 0, 0,757fb_uc0_moveword, 0, uc0_culldl, 0,758// c0-ff: RDP commands759rdp_noop, 0, 0, 0,7600, 0, 0, 0,7610, 0, 0, 0,7620, 0, 0, 0,7630, 0, 0, 0,7640, 0, 0, 0,7650, 0, 0, 0,7660, 0, 0, 0,7670, 0, 0, 0,768fb_rect, fb_rect, 0, 0,7690, 0, 0, 0,7700, fb_setscissor, 0, 0,7710, 0, 0, 0,7720, 0, fb_rect, 0,7730, 0, 0, 0,7740, fb_settextureimage, fb_setdepthimage, fb_setcolorimage775},776777{778// uCode 5 - RSP SW 2.0 Diddy779// 00-3f780// games: Diddy Kong Racing7810, 0, 0, 0,7820, 0, uc0_displaylist, uc5_dl_in_mem,7830, 0, 0, 0,7840, 0, 0, 0,7850, 0, 0, 0,7860, 0, 0, 0,7870, 0, 0, 0,7880, 0, 0, 0,7890, 0, 0, 0,7900, 0, 0, 0,7910, 0, 0, 0,7920, 0, 0, 0,7930, 0, 0, 0,7940, 0, 0, 0,7950, 0, 0, 0,7960, 0, 0, 0,797// 40-7f: Unused7980, 0, 0, 0,7990, 0, 0, 0,8000, 0, 0, 0,8010, 0, 0, 0,8020, 0, 0, 0,8030, 0, 0, 0,8040, 0, 0, 0,8050, 0, 0, 0,8060, 0, 0, 0,8070, 0, 0, 0,8080, 0, 0, 0,8090, 0, 0, 0,8100, 0, 0, 0,8110, 0, 0, 0,8120, 0, 0, 0,8130, 0, 0, 0,814// 80-bf: Immediate commands8150, 0, 0, 0,8160, 0, 0, 0,8170, 0, 0, 0,8180, 0, 0, 0,8190, 0, 0, 0,8200, 0, 0, 0,8210, 0, 0, 0,8220, 0, 0, 0,8230, 0, 0, 0,8240, 0, 0, 0,8250, 0, 0, 0,8260, 0, 0, 0,8270, 0, 0, 0,8280, 0, 0, 0,829uc0_enddl, 0, 0, 0,830fb_uc0_moveword, 0, uc0_culldl, 0,831// c0-ff: RDP commands8320, 0, 0, 0,8330, 0, 0, 0,8340, 0, 0, 0,8350, 0, 0, 0,8360, 0, 0, 0,8370, 0, 0, 0,8380, 0, 0, 0,8390, 0, 0, 0,8400, 0, 0, 0,841fb_rect, fb_rect, 0, 0,8420, 0, 0, 0,8430, fb_setscissor, 0, 0,8440, 0, 0, 0,8450, 0, fb_rect, 0,8460, 0, 0, 0,8470, fb_settextureimage, fb_setdepthimage, fb_setcolorimage848},849850// uCode 6 - S2DEX 1.XX851// games: Yoshi's Story852{8530, 0, 0, 0,8540, 0, uc0_displaylist, 0,8550, 0, 0, 0,8560, 0, 0, 0,8570, 0, 0, 0,8580, 0, 0, 0,8590, 0, 0, 0,8600, 0, 0, 0,8610, 0, 0, 0,8620, 0, 0, 0,8630, 0, 0, 0,8640, 0, 0, 0,8650, 0, 0, 0,8660, 0, 0, 0,8670, 0, 0, 0,8680, 0, 0, 0,869// 40-7f: unused8700, 0, 0, 0,8710, 0, 0, 0,8720, 0, 0, 0,8730, 0, 0, 0,8740, 0, 0, 0,8750, 0, 0, 0,8760, 0, 0, 0,8770, 0, 0, 0,8780, 0, 0, 0,8790, 0, 0, 0,8800, 0, 0, 0,8810, 0, 0, 0,8820, 0, 0, 0,8830, 0, 0, 0,8840, 0, 0, 0,8850, 0, 0, 0,886// 80-bf: Immediate commands8870, 0, 0, 0,8880, 0, 0, 0,8890, 0, 0, 0,8900, 0, 0, 0,8910, 0, 0, 0,8920, 0, 0, 0,8930, 0, 0, 0,8940, 0, 0, 0,8950, 0, 0, 0,8960, 0, 0, 0,8970, 0, 0, 0,8980, 0, 0, uc6_loaducode,899uc6_select_dl, 0, 0, 0,9000, 0, 0, 0,901uc0_enddl, 0, 0, 0,902fb_uc0_moveword, 0, uc2_culldl, 0,903// c0-ff: RDP commands9040, fb_loadtxtr, fb_loadtxtr, fb_loadtxtr,905fb_loadtxtr, 0, 0, 0,9060, 0, 0, 0,9070, 0, 0, 0,9080, 0, 0, 0,9090, 0, 0, 0,9100, 0, 0, 0,9110, 0, 0, 0,9120, 0, 0, 0,913fb_rect, fb_rect, 0, 0,9140, 0, 0, 0,9150, fb_setscissor, 0, 0,9160, 0, 0, 0,9170, 0, fb_rect, 0,9180, 0, 0, 0,9190, fb_settextureimage, fb_setdepthimage, fb_setcolorimage920},921922{9230, 0, 0, 0,9240, 0, uc0_displaylist, 0,9250, 0, 0, 0,9260, 0, 0, 0,9270, 0, 0, 0,9280, 0, 0, 0,9290, 0, 0, 0,9300, 0, 0, 0,9310, 0, 0, 0,9320, 0, 0, 0,9330, 0, 0, 0,9340, 0, 0, 0,9350, 0, 0, 0,9360, 0, 0, 0,9370, 0, 0, 0,9380, 0, 0, 0,939// 40-7f: unused9400, 0, 0, 0,9410, 0, 0, 0,9420, 0, 0, 0,9430, 0, 0, 0,9440, 0, 0, 0,9450, 0, 0, 0,9460, 0, 0, 0,9470, 0, 0, 0,9480, 0, 0, 0,9490, 0, 0, 0,9500, 0, 0, 0,9510, 0, 0, 0,9520, 0, 0, 0,9530, 0, 0, 0,9540, 0, 0, 0,9550, 0, 0, 0,956// 80-bf: Immediate commands9570, 0, 0, 0,9580, 0, 0, 0,9590, 0, 0, 0,9600, 0, 0, 0,9610, 0, 0, 0,9620, 0, 0, 0,9630, 0, 0, 0,9640, 0, 0, 0,9650, 0, 0, 0,9660, 0, 0, 0,9670, 0, 0, 0,9680, 0, 0, 0,9690, 0, 0, 0,9700, 0, 0, 0,971uc0_enddl, 0, 0, 0,972fb_uc0_moveword, 0, uc0_culldl, 0,973// c0-ff: RDP commands9740, 0, 0, 0,9750, 0, 0, 0,9760, 0, 0, 0,9770, 0, 0, 0,9780, 0, 0, 0,9790, 0, 0, 0,9800, 0, 0, 0,9810, 0, 0, 0,9820, 0, 0, 0,983fb_rect, fb_rect, 0, 0,9840, 0, 0, 0,9850, fb_setscissor, 0, 0,9860, 0, 0, 0,9870, 0, fb_rect, 0,9880, 0, 0, 0,9890, fb_settextureimage, fb_setdepthimage, fb_setcolorimage990},991992{993// 00-3f9940, 0, 0, uc2_culldl,995uc1_branch_z, 0, 0, 0,9960, fb_bg_copy, fb_bg_copy, 0,9970, 0, 0, 0,9980, 0, 0, 0,9990, 0, 0, 0,10000, 0, 0, 0,10010, 0, 0, 0,10020, 0, 0, 0,10030, 0, 0, 0,10040, 0, 0, 0,10050, 0, 0, 0,10060, 0, 0, 0,10070, 0, 0, 0,10080, 0, 0, 0,10090, 0, 0, 0,10101011// 40-7f: unused10120, 0, 0, 0,10130, 0, 0, 0,10140, 0, 0, 0,10150, 0, 0, 0,10160, 0, 0, 0,10170, 0, 0, 0,10180, 0, 0, 0,10190, 0, 0, 0,10200, 0, 0, 0,10210, 0, 0, 0,10220, 0, 0, 0,10230, 0, 0, 0,10240, 0, 0, 0,10250, 0, 0, 0,10260, 0, 0, 0,10270, 0, 0, 0,10281029// 80-bf: unused10300, 0, 0, 0,10310, 0, 0, 0,10320, 0, 0, 0,10330, 0, 0, 0,10340, 0, 0, 0,10350, 0, 0, 0,10360, 0, 0, 0,10370, 0, 0, 0,10380, 0, 0, 0,10390, 0, 0, 0,10400, 0, 0, 0,10410, 0, 0, 0,10420, 0, 0, 0,10430, 0, 0, 0,10440, 0, 0, 0,10450, 0, 0, 0,10461047// c0-ff: RDP commands mixed with uc2 commands10480, 0, 0, 0,10490, 0, 0, 0,10500, 0, 0, 0,10510, 0, 0, 0,10520, 0, 0, 0,10530, uc2_dlist_cnt, 0, 0,10540, 0, 0, fb_uc2_moveword,10550, uc2_load_ucode, uc0_displaylist, uc0_enddl,10560, uc1_rdphalf_1, 0, 0,1057fb_rect, fb_rect, 0, 0,10580, 0, 0, 0,10590, fb_setscissor, 0, 0,10600, 0, 0, 0,10610, 0, fb_rect, 0,10620, 0, 0, 0,10630, fb_settextureimage, fb_setdepthimage, fb_setcolorimage1064}1065};1066106710681069