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 F3DPD_VTXCOLORBASE 0x07
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
35 RSP* UCode9::m_rsp = 0; //!< Pointer to Reality Signal Processor
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 //-----------------------------------------------------------------------------
51 //-----------------------------------------------------------------------------
53 //-----------------------------------------------------------------------------
54 void UCode9::initialize(RSP* rsp)
59 //-----------------------------------------------------------------------------
61 //-----------------------------------------------------------------------------
62 void UCode9::initializeGBI(GBI* gbi)
64 // Set GeometryMode flags
67 // GBI Command Command Value Command Function
68 GBI_SetGBI( GBI::G_SPNOOP, F3D_SPNOOP, gbi->m_cmds, UCode0::F3D_SPNoOp );
69 GBI_SetGBI( GBI::G_MTX, F3D_MTX, gbi->m_cmds, UCode0::F3D_Mtx );
70 GBI_SetGBI( GBI::G_RESERVED0, F3D_RESERVED0, gbi->m_cmds, UCode0::F3D_Reserved0 );
71 GBI_SetGBI( GBI::G_MOVEMEM, F3D_MOVEMEM, gbi->m_cmds, UCode0::F3D_MoveMem );
72 GBI_SetGBI( GBI::G_VTX, F3D_VTX, gbi->m_cmds, PerfectDark_Vertex );
73 GBI_SetGBI( GBI::G_RESERVED1, F3D_RESERVED1, gbi->m_cmds, UCode0::F3D_Reserved1 );
74 GBI_SetGBI( GBI::G_DL, F3D_DL, gbi->m_cmds, UCode0::F3D_DList );
75 GBI_SetGBI( GBI::G_VTXCOLORBASE, F3DPD_VTXCOLORBASE, gbi->m_cmds, PerfectDark_VertexColorBase );
76 GBI_SetGBI( GBI::G_RESERVED3, F3D_RESERVED3, gbi->m_cmds, UCode0::F3D_Reserved3 );
77 GBI_SetGBI( GBI::G_SPRITE2D_BASE, F3D_SPRITE2D_BASE, gbi->m_cmds, UCode0::F3D_Sprite2D_Base );
78 GBI_SetGBI( GBI::G_TRI1, F3D_TRI1, gbi->m_cmds, UCode0::F3D_Tri1 );
79 GBI_SetGBI( GBI::G_CULLDL, F3D_CULLDL, gbi->m_cmds, UCode0::F3D_CullDL );
80 GBI_SetGBI( GBI::G_POPMTX, F3D_POPMTX, gbi->m_cmds, UCode0::F3D_PopMtx );
81 GBI_SetGBI( GBI::G_MOVEWORD, F3D_MOVEWORD, gbi->m_cmds, UCode0::F3D_MoveWord );
82 GBI_SetGBI( GBI::G_TEXTURE, F3D_TEXTURE, gbi->m_cmds, UCode0::F3D_Texture );
83 GBI_SetGBI( GBI::G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, gbi->m_cmds, UCode0::F3D_SetOtherMode_H );
84 GBI_SetGBI( GBI::G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, gbi->m_cmds, UCode0::F3D_SetOtherMode_L );
85 GBI_SetGBI( GBI::G_ENDDL, F3D_ENDDL, gbi->m_cmds, UCode0::F3D_EndDL );
86 GBI_SetGBI( GBI::G_SETGEOMETRYMODE, F3D_SETGEOMETRYMODE, gbi->m_cmds, UCode0::F3D_SetGeometryMode );
87 GBI_SetGBI( GBI::G_CLEARGEOMETRYMODE,F3D_CLEARGEOMETRYMODE, gbi->m_cmds, UCode0::F3D_ClearGeometryMode );
88 GBI_SetGBI( GBI::G_QUAD, F3D_QUAD, gbi->m_cmds, UCode0::F3D_Quad );
89 GBI_SetGBI( GBI::G_RDPHALF_1, F3D_RDPHALF_1, gbi->m_cmds, UCode0::F3D_RDPHalf_1 );
90 GBI_SetGBI( GBI::G_RDPHALF_2, F3D_RDPHALF_2, gbi->m_cmds, UCode0::F3D_RDPHalf_2 );
91 GBI_SetGBI( GBI::G_RDPHALF_CONT, F3D_RDPHALF_CONT, gbi->m_cmds, UCode0::F3D_RDPHalf_Cont );
92 GBI_SetGBI( GBI::G_TRI4, F3D_TRI4, gbi->m_cmds, UCode0::F3D_Tri4 );
95 m_rsp->RSP_SetDMAOffsets(0,0);
98 //-----------------------------------------------------------------------------
99 //! Perfect Dark Vertex
100 //-----------------------------------------------------------------------------
101 void UCode9::PerfectDark_Vertex(MicrocodeArgument* ucode)
103 Logger::getSingleton().printMsg("PerfectDark_Vertex", M64MSG_VERBOSE);
104 RSPUCode9AddColorIndexVertices* temp = (RSPUCode9AddColorIndexVertices*)ucode;
106 //Set Color Index Vertices
107 m_rsp->RSP_CIVertex(temp->segmentAddress, temp->numVertices + 1, temp->firstVertexIndex);
110 //-----------------------------------------------------------------------------
111 //! Perfect Dark Color Base
112 //-----------------------------------------------------------------------------
113 void UCode9::PerfectDark_VertexColorBase(MicrocodeArgument* ucode)
115 Logger::getSingleton().printMsg("PerfectDark_VertexColorBase", M64MSG_VERBOSE);
116 RSPUCodeSetVertexColorBase* temp = (RSPUCodeSetVertexColorBase*)ucode;
118 //Set Vertex Color Base
119 m_rsp->RSP_SetVertexColorBase(temp->rdramAddress);