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 | #ifndef GRAPHIC_BINARY_INTERFACE_H_ |
23 | #define GRAPHIC_BINARY_INTERFACE_H_ |
24 | |
25 | |
26 | #include "UCodeDefs.h" |
27 | #include "UCode0.h" //Super Mario 64 |
28 | #include "UCode1.h" //Games like Mario Kart 64, Starfox 64 |
29 | #include "UCode2.h" //Golden Eye |
30 | #include "UCode4.h" //Wave Race 64 |
31 | #include "UCode5.h" //Newer Games |
32 | #include "UCode6.h" //Diddy Kong Racing |
33 | #include "UCode7.h" //Yoshi's Story |
34 | #include "UCode9.h" //Perfect Dark |
35 | #include "UCode10.h" //Conker Bad Fur Day |
36 | #include "RDPInstructions.h" |
37 | |
38 | class RSP; |
39 | class RDP; |
40 | class Memory; |
41 | class UCodeSelector; |
42 | |
43 | // Allows easier setting of GBI commands |
44 | #define GBI_SetGBI( command, value, target, function ) \ |
45 | command = value; \ |
46 | target[command] = function |
47 | |
48 | // Useful macros for decoding GBI command's parameters |
49 | #define _SHIFTL( v, s, w ) (((unsigned int)v & ((0x01 << w) - 1)) << s) |
50 | #define _SHIFTR( v, s, w ) (((unsigned int)v >> s) & ((0x01 << w) - 1)) |
51 | |
52 | |
53 | //----------------------------------------------------------------------------- |
54 | //* GBI Func |
55 | //! Definition for GBI function pointers |
56 | //----------------------------------------------------------------------------- |
57 | typedef void (*GBIFunc)( MicrocodeArgument* ); |
58 | |
59 | //----------------------------------------------------------------------------- |
60 | //* GBI |
61 | //! Defines the Graphical Binary Interface meaning how the graphic |
62 | //! processors should operate. |
63 | //----------------------------------------------------------------------------- |
64 | class GBI |
65 | { |
66 | public: |
67 | //Constructor / Deconstructor |
68 | GBI(); |
69 | ~GBI(); |
70 | |
71 | bool initialize(RSP* rsp, RDP* rdp, Memory* memory, DisplayListParser* dlp); |
72 | void dispose(); |
73 | void selectUCode( unsigned int ucStart, |
74 | unsigned int ucDStart, |
75 | unsigned int ucSize, |
76 | unsigned int ucDSize); |
77 | |
78 | //Dummy instruction |
79 | static void unknownInstruction(MicrocodeArgument* arg); |
80 | |
81 | static unsigned int G_MOVEMEM, G_MOVEWORD; |
82 | static unsigned int G_RDPHALF_1, G_RDPHALF_2, G_RDPHALF_CONT; |
83 | static unsigned int G_SPNOOP; |
84 | static unsigned int G_SETOTHERMODE_H, G_SETOTHERMODE_L; |
85 | static unsigned int G_DL, G_ENDDL, G_CULLDL, G_BRANCH_Z; |
86 | static unsigned int G_LOAD_UCODE; |
87 | |
88 | static unsigned int G_MTX, G_POPMTX; |
89 | static unsigned int G_GEOMETRYMODE, G_SETGEOMETRYMODE, G_CLEARGEOMETRYMODE; |
90 | static unsigned int G_TEXTURE; |
91 | static unsigned int G_DMA_IO, G_DMA_DL, G_DMA_TRI, G_DMA_MTX, G_DMA_VTX, G_DMA_OFFSETS; |
92 | static unsigned int G_SPECIAL_1, G_SPECIAL_2, G_SPECIAL_3; |
93 | static unsigned int G_VTX, G_MODIFYVTX, G_VTXCOLORBASE; |
94 | static unsigned int G_TRI1, G_TRI2, G_TRI4; |
95 | static unsigned int G_QUAD, G_LINE3D; |
96 | static unsigned int G_RESERVED0, G_RESERVED1, G_RESERVED2, G_RESERVED3; |
97 | static unsigned int G_SPRITE2D_BASE; |
98 | static unsigned int G_BG_1CYC, G_BG_COPY; |
99 | static unsigned int G_OBJ_RECTANGLE, G_OBJ_SPRITE, G_OBJ_MOVEMEM; |
100 | static unsigned int G_SELECT_DL, G_OBJ_RENDERMODE, G_OBJ_RECTANGLE_R; |
101 | static unsigned int G_OBJ_LOADTXTR, G_OBJ_LDTX_SPRITE, G_OBJ_LDTX_RECT, G_OBJ_LDTX_RECT_R; |
102 | static unsigned int G_RDPHALF_0; |
103 | |
104 | static unsigned int G_MTX_STACKSIZE; |
105 | static unsigned int G_MTX_MODELVIEW; |
106 | static unsigned int G_MTX_PROJECTION; |
107 | static unsigned int G_MTX_MUL; |
108 | static unsigned int G_MTX_LOAD; |
109 | static unsigned int G_MTX_NOPUSH; |
110 | static unsigned int G_MTX_PUSH; |
111 | |
112 | static unsigned int G_TEXTURE_ENABLE; |
113 | static unsigned int G_SHADING_SMOOTH; |
114 | static unsigned int G_CULL_FRONT; |
115 | static unsigned int G_CULL_BACK; |
116 | static unsigned int G_CULL_BOTH; |
117 | static unsigned int G_CLIPPING; |
118 | |
119 | static unsigned int G_MV_VIEWPORT; |
120 | |
121 | static unsigned int G_MWO_aLIGHT_1, G_MWO_bLIGHT_1; |
122 | static unsigned int G_MWO_aLIGHT_2, G_MWO_bLIGHT_2; |
123 | static unsigned int G_MWO_aLIGHT_3, G_MWO_bLIGHT_3; |
124 | static unsigned int G_MWO_aLIGHT_4, G_MWO_bLIGHT_4; |
125 | static unsigned int G_MWO_aLIGHT_5, G_MWO_bLIGHT_5; |
126 | static unsigned int G_MWO_aLIGHT_6, G_MWO_bLIGHT_6; |
127 | static unsigned int G_MWO_aLIGHT_7, G_MWO_bLIGHT_7; |
128 | static unsigned int G_MWO_aLIGHT_8, G_MWO_bLIGHT_8; |
129 | |
130 | public: |
131 | |
132 | //Function pointer list |
133 | GBIFunc m_cmds[256]; //! Function pointers to diffrent GBI instructions |
134 | |
135 | //Pointers |
136 | RSP* m_rsp; //!< Pointer to Reality Signal Processor |
137 | RDP* m_rdp; //!< Pointer to Reality Drawing Processor |
138 | Memory* m_memory; //!< Pointer to Memory manager (handles RDRAM, Texture Memory...) |
139 | |
140 | //RDP Instruction |
141 | RDPInstructions m_rdpInsructions; |
142 | |
143 | //UCode selector |
144 | UCodeSelector* m_ucodeSelector; //!< Selects apropriete ucode depending on rom. |
145 | |
146 | //UCodes |
147 | UCode0 m_ucode0; //!< UCode for F3D (Super Mario 64) |
148 | UCode1 m_ucode1; //!< UCode for F3DEX (Mario Kart 64, Star Fox 64, Fighter's Destiny...) |
149 | UCode2 m_ucode2; //!< UCode for Golden Eye |
150 | UCode4 m_ucode4; //!< UCode for Wave Racer 64 |
151 | UCode5 m_ucode5; //!< UCode for F3DEX2 |
152 | UCode6 m_ucode6; //!< UCode for Diddy Kong Racing |
153 | UCode7 m_ucode7; //!< UCode for Yoshi's Story |
154 | UCode9 m_ucode9; //!< UCode for Perfect Dark |
155 | UCode10 m_ucode10; //!< UCode for Conker Bad Fur Day |
156 | |
157 | //Previus ucode |
158 | unsigned int m_previusUCodeStart; |
159 | }; |
160 | |
161 | |
162 | #endif |