RSP: Added some missing files
[mupen64plus-pandora.git] / source / gles2n64 / src / S2DEX.h
... / ...
CommitLineData
1#ifndef S2DEX_H
2#define S2DEX_H
3
4#define G_BGLT_LOADBLOCK 0x0033
5#define G_BGLT_LOADTILE 0xfff4
6
7#define G_BG_FLAG_FLIPS 0x01
8#define G_BG_FLAG_FLIPT 0x10
9
10struct uObjScaleBg
11{
12 u16 imageW; /* Texture width (8-byte alignment, u10.2) */
13 u16 imageX; /* x-coordinate of upper-left
14 position of texture (u10.5) */
15 u16 frameW; /* Transfer destination frame width (u10.2) */
16 s16 frameX; /* x-coordinate of upper-left
17 position of transfer destination frame (s10.2) */
18
19 u16 imageH; /* Texture height (u10.2) */
20 u16 imageY; /* y-coordinate of upper-left position of
21 texture (u10.5) */
22 u16 frameH; /* Transfer destination frame height (u10.2) */
23 s16 frameY; /* y-coordinate of upper-left position of transfer
24 destination frame (s10.2) */
25
26 u32 imagePtr; /* Address of texture source in DRAM*/
27 u8 imageSiz; /* Texel size
28 G_IM_SIZ_4b (4 bits/texel)
29 G_IM_SIZ_8b (8 bits/texel)
30 G_IM_SIZ_16b (16 bits/texel)
31 G_IM_SIZ_32b (32 bits/texel) */
32 u8 imageFmt; /*Texel format
33 G_IM_FMT_RGBA (RGBA format)
34 G_IM_FMT_YUV (YUV format)
35 G_IM_FMT_CI (CI format)
36 G_IM_FMT_IA (IA format)
37 G_IM_FMT_I (I format) */
38 u16 imageLoad; /* Method for loading the BG image texture
39 G_BGLT_LOADBLOCK (use LoadBlock)
40 G_BGLT_LOADTILE (use LoadTile) */
41 u16 imageFlip; /* Image inversion on/off (horizontal
42 direction only)
43 0 (normal display (no inversion))
44 G_BG_FLAG_FLIPS (horizontal inversion of texture image) */
45 u16 imagePal; /* Position of palette for 4-bit color
46 index texture (4-bit precision, 0~15) */
47
48 u16 scaleH; /* y-direction scale value (u5.10) */
49 u16 scaleW; /* x-direction scale value (u5.10) */
50 s32 imageYorig; /* image drawing origin (s20.5)*/
51
52 u8 padding[4]; /* Padding */
53}; /* 40 bytes */
54
55struct uObjBg
56{
57 u16 imageW; /* Texture width (8-byte alignment, u10.2) */
58 u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
59 u16 frameW; /* Transfer destination frame width (u10.2) */
60 s16 frameX; /* x-coordinate of upper-left position of
61 transfer destination frame (s10.2) */
62 u16 imageH; /* Texture height (u10.2) */
63 u16 imageY; /* y-coordinate of upper-left position of
64 texture (u10.5) */
65 u16 frameH; /* Transfer destination frame height (u10.2) */
66 s16 frameY; /* y-coordinate of upper-left position of
67 transfer destination frame (s10.2) */
68
69 u32 imagePtr; /* Address of texture source in DRAM*/
70 u8 imageSiz; /* Texel size
71 G_IM_SIZ_4b (4 bits/texel)
72 G_IM_SIZ_8b (8 bits/texel)
73 G_IM_SIZ_16b (16 bits/texel)
74 G_IM_SIZ_32b (32 bits/texel) */
75 u8 imageFmt; /*Texel format
76 G_IM_FMT_RGBA (RGBA format)
77 G_IM_FMT_YUV (YUV format)
78 G_IM_FMT_CI (CI format)
79 G_IM_FMT_IA (IA format)
80 G_IM_FMT_I (I format) */
81 u16 imageLoad; /* Method for loading the BG image texture
82 G_BGLT_LOADBLOCK (use LoadBlock)
83 G_BGLT_LOADTILE (use LoadTile) */
84 u16 imageFlip; /* Image inversion on/off (horizontal direction only)
85 0 (normal display (no inversion))
86 G_BG_FLAG_FLIPS (horizontal inversion of
87 texture image) */
88 u16 imagePal; /* Position of palette for 4-bit color
89 index texture (4-bit precision, 0~15) */
90
91/* The following is set in the initialization routine guS2DInitBg */
92 u16 tmemH; /* TMEM height for a single load (quadruple
93 value, s13.2) */
94 u16 tmemW; /* TMEM width for one frame line (word size) */
95 u16 tmemLoadTH; /* TH value or Stride value */
96 u16 tmemLoadSH; /* SH value */
97 u16 tmemSize; /* imagePtr skip value for a single load */
98 u16 tmemSizeW; /* imagePtr skip value for one image line */
99}; /* 40 bytes */
100
101struct uObjSprite
102{
103 u16 scaleW; /* Width-direction scaling (u5.10) */
104 s16 objX; /* x-coordinate of upper-left corner of OBJ (s10.2) */
105 u16 paddingX; /* Unused (always 0) */
106 u16 imageW; /* Texture width (length in s direction, u10.5) */
107 u16 scaleH; /* Height-direction scaling (u5.10) */
108 s16 objY; /* y-coordinate of upper-left corner of OBJ (s10.2) */
109 u16 paddingY; /* Unused (always 0) */
110 u16 imageH; /* Texture height (length in t direction, u10.5) */
111 u16 imageAdrs; /* Texture starting position in TMEM (In units of 64-bit words) */
112 u16 imageStride; /* Texel wrapping width (In units of 64-bit words) */
113 u8 imageFlags; /* Display flag
114 (*) More than one of the following flags can be specified as the bit sum of the flags:
115 0 (Normal display (no inversion))
116 G_OBJ_FLAG_FLIPS (s-direction (x) inversion)
117 G_OBJ_FLAG_FLIPT (t-direction (y) inversion) */
118 u8 imagePal; /* Position of palette for 4-bit color index texture (4-bit precision, 0~7) */
119 u8 imageSiz; /* Texel size
120 G_IM_SIZ_4b (4 bits/texel)
121 G_IM_SIZ_8b (8 bits/texel)
122 G_IM_SIZ_16b (16 bits/texel)
123 G_IM_SIZ_32b (32 bits/texel) */
124 u8 imageFmt; /* Texel format
125 G_IM_FMT_RGBA (RGBA format)
126 G_IM_FMT_YUV (YUV format)
127 G_IM_FMT_CI (CI format)
128 G_IM_FMT_IA (IA format)
129 G_IM_FMT_I (I format) */
130}; /* 24 bytes */
131
132struct uObjTxtrBlock
133{
134 u32 type; /* Structure identifier (G_OBJLT_TXTRBLOCK) */
135 u32 image; /* Texture source address in DRAM (8-byte alignment) */
136 u16 tsize; /* Texture size (specified by GS_TB_TSIZE) */
137 u16 tmem; /* TMEM word address where texture will be loaded (8-byte word) */
138 u16 sid; /* Status ID (multiple of 4: either 0, 4, 8, or 12) */
139 u16 tline; /* Texture line width (specified by GS_TB_TLINE) */
140 u32 flag; /* Status flag */
141 u32 mask; /* Status mask */
142}; /* 24 bytes */
143
144struct uObjTxtrTile
145{
146 u32 type; /* Structure identifier (G_OBJLT_TXTRTILE) */
147 u32 image; /* Texture source address in DRAM (8-byte alignment) */
148 u16 twidth; /* Texture width (specified by GS_TT_TWIDTH) */
149 u16 tmem; /* TMEM word address where texture will be loaded (8-byte word) */
150 u16 sid; /* Status ID (multiple of 4: either 0, 4, 8, or 12) */
151 u16 theight;/* Texture height (specified by GS_TT_THEIGHT) */
152 u32 flag; /* Status flag */
153 u32 mask; /* Status mask */
154}; /* 24 bytes */
155
156struct uObjTxtrTLUT
157{
158 u32 type; /* Structure identifier (G_OBJLT_TLUT) */
159 u32 image; /* Texture source address in DRAM */
160 u16 pnum; /* Number of palettes to load - 1 */
161 u16 phead; /* Palette position at start of load (256~511) */
162 u16 sid; /* Status ID (multiple of 4: either 0, 4, 8, or 12) */
163 u16 zero; /* Always assign 0 */
164 u32 flag; /* Status flag */
165 u32 mask; /* Status mask */
166}; /* 24 bytes */
167
168typedef union
169{
170 uObjTxtrBlock block;
171 uObjTxtrTile tile;
172 uObjTxtrTLUT tlut;
173} uObjTxtr;
174
175struct uObjTxSprite
176{
177 uObjTxtr txtr;
178 uObjSprite sprite;
179};
180
181struct uObjMtx
182{
183 s32 A, B, C, D; /* s15.16 */
184 s16 Y, X; /* s10.2 */
185 u16 BaseScaleY; /* u5.10 */
186 u16 BaseScaleX; /* u5.10 */
187};
188
189void S2DEX_BG_1Cyc( u32 w0, u32 w1 );
190void S2DEX_BG_Copy( u32 w0, u32 w1 );
191void S2DEX_Obj_Rectangle( u32 w0, u32 w1 );
192void S2DEX_Obj_Sprite( u32 w0, u32 w1 );
193void S2DEX_Obj_MoveMem( u32 w0, u32 w1 );
194void S2DEX_Select_DL( u32 w0, u32 w1 );
195void S2DEX_Obj_RenderMode( u32 w0, u32 w1 );
196void S2DEX_Obj_Rectangle_R( u32 w0, u32 w1 );
197void S2DEX_Obj_LoadTxtr( u32 w0, u32 w1 );
198void S2DEX_Obj_LdTx_Sprite( u32 w0, u32 w1 );
199void S2DEX_Obj_LdTx_Rect( u32 w0, u32 w1 );
200void S2DEX_Obj_LdTx_Rect_R( u32 w0, u32 w1 );
201void S2DEX_Init();
202
203#define S2DEX_BG_1CYC 0x01
204#define S2DEX_BG_COPY 0x02
205#define S2DEX_OBJ_RECTANGLE 0x03
206#define S2DEX_OBJ_SPRITE 0x04
207#define S2DEX_OBJ_MOVEMEM 0x05
208#define S2DEX_LOAD_UCODE 0xAF
209#define S2DEX_SELECT_DL 0xB0
210#define S2DEX_OBJ_RENDERMODE 0xB1
211#define S2DEX_OBJ_RECTANGLE_R 0xB2
212#define S2DEX_OBJ_LOADTXTR 0xC1
213#define S2DEX_OBJ_LDTX_SPRITE 0xC2
214#define S2DEX_OBJ_LDTX_RECT 0xC3
215#define S2DEX_OBJ_LDTX_RECT_R 0xC4
216#define S2DEX_RDPHALF_0 0xE4
217
218#endif
219