Add F3DEX2MM ucode from GLideN64

This commit is contained in:
Francisco Zurita 2017-03-17 03:03:40 -04:00
parent 8e6c64895c
commit 7bee5b2559
7 changed files with 291 additions and 7 deletions

View file

@ -81,7 +81,7 @@ hotkeys = 1
1f120bbb=21
21f91834=2
21f91874=2
22099872=2
22099872=10
24cd885b=1
26a7879a=1
299d5072=6

View file

@ -218,6 +218,7 @@ void microcheck ();
#include "ucode07.h"
#include "ucode08.h"
#include "ucode09.h"
#include "ucode10.h"
#include "ucode.h"
#include "ucode09rdp.h"
#include "turbo3D.h"
@ -1639,7 +1640,7 @@ static void rdp_setothermode()
LRDP("rdp_setothermode\n");
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD))
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD) || (settings.ucode == ucode_F3DEX2MM))
{
int cmd0 = rdp.cmd0;
F3DEX2_SETOTHERMODE(0xE2, 0, 32, rdp.cmd1); // SETOTHERMODE_L

View file

@ -41,7 +41,7 @@ typedef void (*rdp_instr)();
// RDP graphic instructions pointer table
static rdp_instr gfx_instruction[10][256] =
static rdp_instr gfx_instruction[11][256] =
{
{
// uCode 0 - RSP SW 2.0X
@ -789,4 +789,80 @@ static rdp_instr gfx_instruction[10][256] =
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
{
// uCode 10 - F3DEX 2.XX
// games: Zelda Majora's mask
// 00-3f
spnoop, uc2_vertex, uc2_modifyvtx, uc2_culldl,
uc10_branch_w, uc2_tri1, uc2_quad, uc2_quad,
uc2_line3d, uc6_bg_1cyc, uc6_bg_copy, uc6_obj_rendermode/*undef*/,
undef, undef, undef, undef,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
uc0_tri4, uc0_tri4, uc0_tri4, uc0_tri4,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 40-7f: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// 80-bf: unused
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
undef, undef, undef, undef,
// c0-ff: RDP commands mixed with uc2 commands
rdp_noop, undef, undef, undef,
undef, undef, undef, undef,
rdp_trifill, rdp_trifillz, rdp_tritxtr, rdp_tritxtrz,
rdp_trishade, rdp_trishadez, rdp_trishadetxtr, rdp_trishadetxtrz,
undef, undef, undef, uc2_special3,
uc2_special2, uc2_dlist_cnt, uc2_dma_io, uc0_texture,
uc2_pop_matrix, uc2_geom_mode, uc2_matrix, uc2_moveword,
uc2_movemem, uc2_load_ucode, uc0_displaylist, uc0_enddl,
spnoop, uc1_rdphalf_1, uc0_setothermode_l, uc0_setothermode_h,
rdp_texrect, rdp_texrect, rdp_loadsync, rdp_pipesync,
rdp_tilesync, rdp_fullsync, rdp_setkeygb, rdp_setkeyr,
rdp_setconvert, rdp_setscissor, rdp_setprimdepth, rdp_setothermode,
rdp_loadtlut, uc2_rdphalf_2, rdp_settilesize, rdp_loadblock,
rdp_loadtile, rdp_settile, rdp_fillrect, rdp_setfillcolor,
rdp_setfogcolor, rdp_setblendcolor, rdp_setprimcolor, rdp_setenvcolor,
rdp_setcombine, rdp_settextureimage, rdp_setdepthimage, rdp_setcolorimage
},
};

View file

@ -47,6 +47,7 @@
#define ucode_PerfectDark 7
#define ucode_CBFD 8
#define ucode_zSort 9
#define ucode_F3DEX2MM 10
#define ucode_Turbo3d 21
static void rsp_vertex(int v0, int n)
@ -831,7 +832,7 @@ static void uc0_setothermode_h()
LRDP("uc0:setothermode_h: ");
int shift, len;
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD))
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_F3DEX2MM) || (settings.ucode == ucode_CBFD))
{
len = (rdp.cmd0 & 0xFF) + 1;
shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len;
@ -909,7 +910,7 @@ static void uc0_setothermode_l()
LRDP("uc0:setothermode_l ");
int shift, len;
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_CBFD))
if ((settings.ucode == ucode_F3DEX2) || (settings.ucode == ucode_F3DEX2MM) || (settings.ucode == ucode_CBFD))
{
len = (rdp.cmd0 & 0xFF) + 1;
shift = 32 - ((rdp.cmd0 >> 8) & 0xFF) - len;

View file

@ -774,7 +774,7 @@ static void uc6_bg (bool bg_1cyc)
return;
}
if (settings.ucode == ucode_F3DEX2 || (settings.hacks&hack_PPL))
if (settings.ucode == ucode_F3DEX2 || settings.ucode == ucode_F3DEX2MM || (settings.hacks&hack_PPL))
{
if ( (d.imagePtr != rdp.cimg) && (d.imagePtr != rdp.ocimg) && d.imagePtr) //can't draw from framebuffer
DrawImage (d);

55
src/Glide64/ucode10.h Normal file
View file

@ -0,0 +1,55 @@
/*
* Glide64 - Glide video plugin for Nintendo 64 emulators.
* Copyright (c) 2002 Dave2001
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
*
* 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 version 2 of the License, or
* 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
*/
//****************************************************************
//
// Glide64 - Glide Plugin for Nintendo 64 emulators
// Project started on December 29th, 2001
//
// Authors:
// Dave2001, original author, founded the project in 2001, left it in 2002
// Gugaman, joined the project in 2002, left it in 2002
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
//
//****************************************************************
//
// To modify Glide64:
// * 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.
// * 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.
//
//****************************************************************
//
// vertex - loads vertices
//
static void uc10_branch_w()
{
wxUint32 addr = segoffset(branch_dl);
FRDP ("uc10:branch_less_w, addr: %08lx\n", addr);
wxUint32 vtx = (rdp.cmd0 >> 1) & 0x7F;
if(rdp.vtx[vtx].w < (float)rdp.cmd1)
{
rdp.pc[rdp.pc_i] = addr;
}
}

View file

@ -448,7 +448,7 @@ static void fb_setcolorimage()
// RDP graphic instructions pointer table used in DetectFrameBufferUsage
static rdp_instr gfx_instruction_lite[9][256] =
static rdp_instr gfx_instruction_lite[11][256] =
{
{
// uCode 0 - RSP SW 2.0X
@ -1106,5 +1106,156 @@ static rdp_instr gfx_instruction_lite[9][256] =
0, 0, fb_rect, 0,
0, 0, 0, 0,
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
},
{
// 00-3f
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 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0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
// 80-bf: unused
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
// c0-ff: RDP commands mixed with uc2 commands
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, uc2_dlist_cnt, 0, 0,
0, 0, 0, fb_uc2_moveword,
fb_uc2_movemem, uc2_load_ucode, uc0_displaylist, uc0_enddl,
0, fb_rdphalf_1, 0, 0,
fb_rect, fb_rect, 0, 0,
0, 0, 0, 0,
0, fb_setscissor, 0, 0,
0, 0, 0, 0,
0, 0, fb_rect, 0,
0, 0, 0, 0,
0, fb_settextureimage, fb_setdepthimage, fb_setcolorimage
}
};