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 RDP_UCODE_DEFS_H_ |
23 | #define RDP_UCODE_DEFS_H_ |
24 | |
25 | //! Struct for setting color-, depth- and texture- image |
26 | struct RDPUCodeSetImage |
27 | { |
28 | unsigned int width:12; //!< Width |
29 | unsigned int :7; //!< Padding |
30 | unsigned int size:2; //!< Size (0=4, 1=8, 2=16, or 3=32) |
31 | unsigned int format:3; //!< Image format (0=RGBA, 1=YUV, 2=CI, 3=IA, 4=I, 5=?, 6=?, 7=?) |
32 | unsigned int cmd:8; //!< Command |
33 | unsigned int segmentAddress; //!< Address to register where there is an RDRAM address |
34 | }; |
35 | |
36 | //! Struct used by RDP to load textures |
37 | struct RDPUCodeTileSize |
38 | { |
39 | unsigned int t0:12; //!< t texture coordinat for first vertex |
40 | unsigned int s0:12; //!< s texture coordinat for first vertex |
41 | unsigned int cmd:8; //!< Command, usualy LoadBlock, LoadTLUT, LoadTile, or SetTileSize |
42 | unsigned int t1:12; //!< t texture coordinat for second vertex |
43 | unsigned int s1:12; //!< s texture coordinat for second vertex |
44 | unsigned int tile:3; //!< Tile |
45 | unsigned int padding:5; //!< Unused Padding |
46 | }; |
47 | |
48 | //! Struct used by RDP to set tiles |
49 | struct RDPUCodeSetTile |
50 | { |
51 | unsigned int tmem:9; //!< Address in Texture Memory |
52 | unsigned int line:9; |
53 | unsigned int pad0:1; //!< Padding |
54 | unsigned int size:2; |
55 | unsigned int format:3; //!< Image format of tile |
56 | unsigned int cmd:8; //!< Command, usualy SetTileSize |
57 | unsigned int shiftS:4; |
58 | unsigned int maskS:4; |
59 | unsigned int mirrorS:1; //!< |
60 | unsigned int clampS:1; |
61 | unsigned int shiftT:4; |
62 | unsigned int maskT:4; |
63 | unsigned int mirrorT:1; |
64 | unsigned int clampT:1; |
65 | unsigned int palette:4; |
66 | unsigned int tile:3; |
67 | unsigned int pad1:5; //!< Padding |
68 | }; |
69 | |
70 | //! Struct used by RDP to set fog-, blend-, enviroment-, and prim- color (fillcolor is diffrent) |
71 | struct RDPUCodeSetColor |
72 | { |
73 | unsigned int prim_level:8; //!< Only used by setPrimColor |
74 | unsigned int prim_min_level:8; //!< Only used by setPrimColor |
75 | unsigned int pad0:8; //!< Padding |
76 | unsigned int cmd:8; //!< Command |
77 | unsigned int a:8; //!< Alpha (0-255) |
78 | unsigned int b:8; //!< Blue (0-255) |
79 | unsigned int g:8; //!< Green (0-255) |
80 | unsigned int r:8; //!< Red (0-255) |
81 | }; |
82 | |
83 | //! Struct used by RDP to set fill color |
84 | struct RDPUCodeSetFillColor |
85 | { |
86 | unsigned int pad0:24; //!< Padding |
87 | unsigned int cmd:8; //!< Command |
88 | unsigned int a:1; //!< Alpha (0-1) |
89 | unsigned int b:5; //!< Blue (0-255) |
90 | unsigned int g:5; //!< Green (0-255) |
91 | unsigned int r:5; //!< Red (0-255) |
92 | unsigned int pad1:16; //!< Padding |
93 | }; |
94 | |
95 | //! Struct used by RDP to render rectangles |
96 | struct RDPUCodeRectangle |
97 | { |
98 | unsigned int pad0 : 2; //!< Padding |
99 | unsigned int y1 : 10; //!< Y coordinate of second vertex corner |
100 | unsigned int pad1 : 2; //!< Padding |
101 | unsigned int x1 : 10; //!< X coordinate of second vertex corner |
102 | unsigned int cmd : 8; //!< Command |
103 | unsigned int pad3 : 2; //!< Padding |
104 | unsigned int y0 : 10; //!< Y coordinate of first vertex corner |
105 | unsigned int pad4 : 2; //!< Padding |
106 | unsigned int x0 : 10; //!< X coordinate of first vertex corner |
107 | unsigned int pad5 : 8; //!< Padding |
108 | }; |
109 | |
110 | //! Struct used by RDP to set scissor |
111 | struct RDPUCodeScissor |
112 | { |
113 | unsigned int y0:12; //!< Y coordinate of second vertex |
114 | unsigned int x0:12; //!< X coordinate of second vertex |
115 | unsigned int cmd:8; //!< Command usualy |
116 | unsigned int y1:12; //!< Y coordinate of first vertex |
117 | unsigned int x1:12; //!< X coordinate of first vertex |
118 | unsigned int mode:2; //!< |
119 | unsigned int pad0:6; //!< Padding TexRect or TexRectFlip |
120 | }; |
121 | |
122 | //! Struct used by RDP to render textured rectangles |
123 | struct RDPUCodeTextureRectangle |
124 | { |
125 | unsigned int y1:12; //!< Y coordinate of second vertex |
126 | unsigned int x1:12; //!< X coordinate of second vertex |
127 | unsigned int cmd:8; //!< Command usualy |
128 | unsigned int y0:12; //!< Y coordinate of first vertex |
129 | unsigned int x0:12; //!< X coordinate of first vertex |
130 | unsigned int tile:3; //!< Tile descriptor index |
131 | unsigned int pad0:5; //!< Padding TexRect or TexRectFlip |
132 | unsigned int t:16; //!< T texture coord at first vertex |
133 | unsigned int s:16; //!< S texture coord at first vertex |
134 | unsigned int dtdy:16; //!< Change in T per change in Y |
135 | unsigned int dsdx:16; //!< Change in S per change in X |
136 | }; |
137 | |
138 | //! Struct used by RDP to set prim depth |
139 | struct RDPUCodeSetPrimDepth |
140 | { |
141 | unsigned int pad0:24; //!< Padding |
142 | unsigned int cmd:8; //!< Command |
143 | unsigned int dz:16; |
144 | unsigned int z:16; //!< Depth value |
145 | }; |
146 | |
147 | #endif |