1 /******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *****************************************************************************/
26 #include "UCodeDefs.h"
30 #define F3DWRUS_TRI2 0xB1
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
35 GBI* UCode4::m_gbi = 0;
36 RSP* UCode4::m_rsp = 0; //!< Pointer to Reality Signal Processor
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
52 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
55 void UCode4::initialize(GBI* gbi, RSP* rsp)
61 //-----------------------------------------------------------------------------
63 //-----------------------------------------------------------------------------
64 void UCode4::initializeGBI()
66 UCode0::initializeGBI(m_gbi);
68 //Init special Wave Race functions
69 GBI_SetGBI( GBI::G_VTX, F3D_VTX, m_gbi->m_cmds, WaveRace64_Vertex );
70 GBI_SetGBI( GBI::G_TRI1, F3D_TRI1, m_gbi->m_cmds, WaveRace64_Tri1 );
71 GBI_SetGBI( GBI::G_QUAD, F3D_QUAD, m_gbi->m_cmds, WaveRace64_Quad );
72 GBI_SetGBI( GBI::G_TRI2, F3DWRUS_TRI2, m_gbi->m_cmds, WaveRace64_Tri2 );
75 //-----------------------------------------------------------------------------
77 //! @param ucode instruction from displaylist with input data
78 //-----------------------------------------------------------------------------
79 void UCode4::WaveRace64_Vertex(MicrocodeArgument* ucode)
81 Logger::getSingleton().printMsg("WaveRace64_Vertex", M64MSG_VERBOSE);
82 RSPUCodeAddVerticesWaveRace64* temp = (RSPUCodeAddVerticesWaveRace64*)ucode;
85 m_rsp->RSP_Vertex(temp->segmentAddress, temp->numVertices, temp->firstVertexIndex/5);
88 //-----------------------------------------------------------------------------
90 //! @param ucode instruction from displaylist with input data
91 //-----------------------------------------------------------------------------
92 void UCode4::WaveRace64_Tri1(MicrocodeArgument* ucode)
94 Logger::getSingleton().printMsg("WaveRace64_Tri1", M64MSG_VERBOSE);
95 RSPUCodeAddOneTriangleF3D* temp = (RSPUCodeAddOneTriangleF3D*)ucode;
98 m_rsp->RSP_1Triangle(temp->index0 / 5, temp->index1 / 5, temp->index2 / 5 /*,temp->flag,*/ );
101 //-----------------------------------------------------------------------------
103 //! @param ucode instruction from displaylist with input data
104 //-----------------------------------------------------------------------------
105 void UCode4::WaveRace64_Tri2(MicrocodeArgument* ucode)
107 Logger::getSingleton().printMsg("WaveRace64_Tri2", M64MSG_VERBOSE);
108 RSPUCodeAddTwoTrianglesWaveRace64* temp = (RSPUCodeAddTwoTrianglesWaveRace64*)ucode;
111 m_rsp->RSP_2Triangles( temp->v0 / 5, temp->v1 / 5, temp->v2 / 5, 0,
112 temp->v3 / 5, temp->v4 / 5, temp->v5 / 5, 0);
115 //-----------------------------------------------------------------------------
117 //! @param ucode instruction from displaylist with input data
118 //-----------------------------------------------------------------------------
119 void UCode4::WaveRace64_Quad(MicrocodeArgument* ucode)
121 Logger::getSingleton().printMsg("WaveRace64_Quad", M64MSG_VERBOSE);
122 RSPUCodeAddOneQuadF3D* temp = (RSPUCodeAddOneQuadF3D*)ucode;
125 m_rsp->RSP_1Quadrangle(temp->index0/5, temp->index1/5, temp->index2/5, temp->index3/5);