Arachnoid GLESv1.1 plugin. Compile and run (a bit glitchy and no frameskip) on the...
[mupen64plus-pandora.git] / source / mupen64plus-video-arachnoid / src / ucodes / UCode7.cpp
CommitLineData
22726e4d 1/******************************************************************************
2 * Arachnoid Graphics Plugin for Mupen64Plus
3 * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/
4 *
5 * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson
6 *
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.
11 *
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.
16 *
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 *****************************************************************************/
21
22#include "UCode7.h"
23#include "UCode0.h"
24#include "UCode1.h"
25#include "GBI.h"
26#include "RSP.h"
27#include "RDP.h"
28#include "Memory.h"
29#include "UCodeDefs.h"
30#include "GBIDefs.h"
31#include "Logger.h"
32
33#define S2DEX_BG_1CYC 0x01
34#define S2DEX_BG_COPY 0x02
35#define S2DEX_OBJ_RECTANGLE 0x03
36#define S2DEX_OBJ_SPRITE 0x04
37#define S2DEX_OBJ_MOVEMEM 0x05
38#define S2DEX_LOAD_UCODE 0xAF
39#define S2DEX_SELECT_DL 0xB0
40#define S2DEX_OBJ_RENDERMODE 0xB1
41#define S2DEX_OBJ_RECTANGLE_R 0xB2
42#define S2DEX_OBJ_LOADTXTR 0xC1
43#define S2DEX_OBJ_LDTX_SPRITE 0xC2
44#define S2DEX_OBJ_LDTX_RECT 0xC3
45#define S2DEX_OBJ_LDTX_RECT_R 0xC4
46#define S2DEX_RDPHALF_0 0xE4
47
48//-----------------------------------------------------------------------------
49// Static Variables
50//-----------------------------------------------------------------------------
51RSP* UCode7::m_rsp = 0; //!< Pointer to Reality Signal Processor
52
53//-----------------------------------------------------------------------------
54//! Constructor
55//-----------------------------------------------------------------------------
56UCode7::UCode7()
57{
58}
59
60//-----------------------------------------------------------------------------
61//! Destructor
62//-----------------------------------------------------------------------------
63UCode7::~UCode7()
64{
65}
66
67//-----------------------------------------------------------------------------
68//! Initialize
69//-----------------------------------------------------------------------------
70void UCode7::initialize(RSP* rsp)
71{
72 m_rsp = rsp;
73}
74
75//-----------------------------------------------------------------------------
76//! Initialize GBI
77//-----------------------------------------------------------------------------
78void UCode7::initializeGBI(GBI* gbi)
79{
80 // Set GeometryMode flags
81 GBI_InitFlags( F3DEX );
82
83 // GBI Command Command Value Command Function
84 GBI_SetGBI( GBI::G_SPNOOP, F3D_SPNOOP, gbi->m_cmds, UCode0::F3D_SPNoOp );
85 GBI_SetGBI( GBI::G_BG_1CYC, S2DEX_BG_1CYC, gbi->m_cmds, S2DEX_BG_1Cyc );
86 GBI_SetGBI( GBI::G_BG_COPY, S2DEX_BG_COPY, gbi->m_cmds, S2DEX_BG_Copy );
87 GBI_SetGBI( GBI::G_OBJ_RECTANGLE, S2DEX_OBJ_RECTANGLE, gbi->m_cmds, S2DEX_Obj_Rectangle );
88 GBI_SetGBI( GBI::G_OBJ_SPRITE, S2DEX_OBJ_SPRITE, gbi->m_cmds, S2DEX_Obj_Sprite );
89 GBI_SetGBI( GBI::G_OBJ_MOVEMEM, S2DEX_OBJ_MOVEMEM, gbi->m_cmds, S2DEX_Obj_MoveMem );
90 GBI_SetGBI( GBI::G_DL, F3D_DL, gbi->m_cmds, UCode0::F3D_DList );
91 GBI_SetGBI( GBI::G_SELECT_DL, S2DEX_SELECT_DL, gbi->m_cmds, S2DEX_Select_DL );
92 GBI_SetGBI( GBI::G_OBJ_RENDERMODE, S2DEX_OBJ_RENDERMODE, gbi->m_cmds, S2DEX_Obj_RenderMode );
93 GBI_SetGBI( GBI::G_OBJ_RECTANGLE_R, S2DEX_OBJ_RECTANGLE_R, gbi->m_cmds, S2DEX_Obj_Rectangle_R );
94 GBI_SetGBI( GBI::G_OBJ_LOADTXTR, S2DEX_OBJ_LOADTXTR, gbi->m_cmds, S2DEX_Obj_LoadTxtr );
95 GBI_SetGBI( GBI::G_OBJ_LDTX_SPRITE, S2DEX_OBJ_LDTX_SPRITE, gbi->m_cmds, S2DEX_Obj_LdTx_Sprite );
96 GBI_SetGBI( GBI::G_OBJ_LDTX_RECT, S2DEX_OBJ_LDTX_RECT, gbi->m_cmds, S2DEX_Obj_LdTx_Rect );
97 GBI_SetGBI( GBI::G_OBJ_LDTX_RECT_R, S2DEX_OBJ_LDTX_RECT_R, gbi->m_cmds, S2DEX_Obj_LdTx_Rect_R );
98 GBI_SetGBI( GBI::G_MOVEWORD, F3D_MOVEWORD, gbi->m_cmds, UCode0::F3D_MoveWord );
99 GBI_SetGBI( GBI::G_SETOTHERMODE_H, F3D_SETOTHERMODE_H, gbi->m_cmds, UCode0::F3D_SetOtherMode_H );
100 GBI_SetGBI( GBI::G_SETOTHERMODE_L, F3D_SETOTHERMODE_L, gbi->m_cmds, UCode0::F3D_SetOtherMode_L );
101 GBI_SetGBI( GBI::G_ENDDL, F3D_ENDDL, gbi->m_cmds, UCode0::F3D_EndDL );
102 GBI_SetGBI( GBI::G_RDPHALF_1, F3D_RDPHALF_1, gbi->m_cmds, UCode0::F3D_RDPHalf_1 );
103 GBI_SetGBI( GBI::G_RDPHALF_2, F3D_RDPHALF_2, gbi->m_cmds, UCode0::F3D_RDPHalf_2 );
104 GBI_SetGBI( GBI::G_LOAD_UCODE, S2DEX_LOAD_UCODE, gbi->m_cmds, UCode1::F3DEX_Load_uCode );
105}
106
107//-----------------------------------------------------------------------------
108//!
109//-----------------------------------------------------------------------------
110void UCode7::S2DEX_BG_1Cyc(MicrocodeArgument* ucode)
111{
112 static bool warned = false;
113 if ( !warned ) {
114 Logger::getSingleton().printMsg("S2DEX_BG_1Cyc - Unimplemented", M64MSG_WARNING);
115 warned = true;
116 }
117}
118
119//-----------------------------------------------------------------------------
120//!
121//-----------------------------------------------------------------------------
122void UCode7::S2DEX_BG_Copy(MicrocodeArgument* ucode)
123{
124 static bool warned = false;
125 if ( !warned ) {
126 Logger::getSingleton().printMsg("S2DEX_BG_Copy - Unimplemented", M64MSG_WARNING);
127 warned = true;
128 }
129}
130
131//-----------------------------------------------------------------------------
132//! Obj Ractangle
133//-----------------------------------------------------------------------------
134void UCode7::S2DEX_Obj_Rectangle(MicrocodeArgument* ucode)
135{
136 static bool warned = false;
137 if ( !warned ) {
138 Logger::getSingleton().printMsg("S2DEX_Obj_Rectangle - Unimplemented", M64MSG_WARNING);
139 warned = true;
140 }
141}
142
143//-----------------------------------------------------------------------------
144//!
145//-----------------------------------------------------------------------------
146void UCode7::S2DEX_Obj_Sprite(MicrocodeArgument* ucode)
147{
148 static bool warned = false;
149 if ( !warned ) {
150 Logger::getSingleton().printMsg("S2DEX_Obj_Sprite - Unimplemented", M64MSG_WARNING);
151 warned = true;
152 }
153}
154
155//-----------------------------------------------------------------------------
156//!
157//-----------------------------------------------------------------------------
158void UCode7::S2DEX_Obj_MoveMem(MicrocodeArgument* ucode)
159{
160 static bool warned = false;
161 if ( !warned ) {
162 Logger::getSingleton().printMsg("S2DEX_Obj_MoveMem - Unimplemented", M64MSG_WARNING);
163 warned = true;
164 }
165}
166
167//-----------------------------------------------------------------------------
168//!
169//-----------------------------------------------------------------------------
170void UCode7::S2DEX_Obj_LoadTxtr(MicrocodeArgument* ucode)
171{
172 static bool warned = false;
173 if ( !warned ) {
174 Logger::getSingleton().printMsg("S2DEX_Obj_LoadTxtr - Unimplemented", M64MSG_WARNING);
175 warned = true;
176 }
177}
178
179//-----------------------------------------------------------------------------
180//!
181//-----------------------------------------------------------------------------
182void UCode7::S2DEX_Obj_LdTx_Sprite(MicrocodeArgument* ucode)
183{
184 static bool warned = false;
185 if ( !warned ) {
186 Logger::getSingleton().printMsg("S2DEX_Obj_LdTx_Sprite - Unimplemented", M64MSG_WARNING);
187 warned = true;
188 }
189}
190
191//-----------------------------------------------------------------------------
192//!
193//-----------------------------------------------------------------------------
194void UCode7::S2DEX_Obj_LdTx_Rect_R(MicrocodeArgument* ucode)
195{
196 static bool warned = false;
197 if ( !warned ) {
198 Logger::getSingleton().printMsg("S2DEX_Obj_LdTx_Rect_R - Unimplemented", M64MSG_WARNING);
199 warned = true;
200 }
201}
202
203//-----------------------------------------------------------------------------
204//! Select Display List
205//-----------------------------------------------------------------------------
206void UCode7::S2DEX_Select_DL(MicrocodeArgument* ucode)
207{
208 static bool warned = false;
209 if ( !warned ) {
210 Logger::getSingleton().printMsg("S2DEX_Select_DL - Unimplemented", M64MSG_WARNING);
211 warned = true;
212 }
213}
214
215//-----------------------------------------------------------------------------
216//!
217//-----------------------------------------------------------------------------
218void UCode7::S2DEX_Obj_RenderMode(MicrocodeArgument* ucode)
219{
220 static bool warned = false;
221 if ( !warned ) {
222 Logger::getSingleton().printMsg("S2DEX_Obj_RenderMode - Unimplemented", M64MSG_WARNING);
223 warned = true;
224 }
225}
226
227//-----------------------------------------------------------------------------
228//!
229//-----------------------------------------------------------------------------
230void UCode7::S2DEX_Obj_Rectangle_R(MicrocodeArgument* ucode)
231{
232 static bool warned = false;
233 if ( !warned ) {
234 Logger::getSingleton().printMsg("S2DEX_Obj_Rectangle_R - Unimplemented", M64MSG_WARNING);
235 warned = true;
236 }
237}
238
239//-----------------------------------------------------------------------------
240//!
241//-----------------------------------------------------------------------------
242void UCode7::S2DEX_Obj_LdTx_Rect(MicrocodeArgument* ucode)
243{
244 static bool warned = false;
245 if ( !warned ) {
246 Logger::getSingleton().printMsg("S2DEX_Obj_LdTx_Rect - Unimplemented", M64MSG_WARNING);
247 warned = true;
248 }
249}