34 extern void *OTusrData;
36 #define OTSetUser(usr) OTusrData = (usr) 39 #define ChooseTexture(texture) OTSetUser((texture)) 100 #define WAIT_TIME 0x800000 105 #define limitRange(x, l, h) ((x) = ((x) < (l) ? (l) : (x) > (h) ? (h) : (x))) 110 #define setVector(v, _x, _y, _z) (v)->vx = _x, (v)->vy = _y, (v)->vz = _z 112 #define applyVector(v, _x, _y, _z, op) (v)->vx op _x, (v)->vy op _y, (v)->vz op _z 114 #define copyVector(v0, v1) (v0)->vx = (v1)->vx, (v0)->vy = (v1)->vy, (v0)->vz = (v1)->vz 116 #define addVector(v0, v1) (v0)->vx += (v1)->vx, (v0)->vy += (v1)->vy, (v0)->vz += (v1)->vz 118 #define dumpVector(str, v) GPU_printf("%s=(%d,%d,%d)\n", str, (v)->vx, (v)->vy, (v)->vz) 120 #define dumpMatrix(x) \ 121 GPU_printf("\t%5d,%5d,%5d\n", (x)->m[0][0], (x)->m[0][1], (x)->m[0][2]), GPU_printf("\t%5d,%5d,%5d\n", (x)->m[1][0], (x)->m[1][1], (x)->m[1][2]), \ 122 GPU_printf("\t%5d,%5d,%5d\n", (x)->m[2][0], (x)->m[2][1], (x)->m[2][2]) 124 #define setRECT(r, _x, _y, _w, _h) (r)->x = (_x), (r)->y = (_y), (r)->w = (_w), (r)->h = (_h) 129 #define setTPage(p, tp, abr, x, y) ((p)->tpage = getTPage(tp, abr, x, y)) 131 #define setClut(p, x, y) ((p)->clut = getClut(x, y)) 136 #define setRGB0(p, _r0, _g0, _b0) (p)->r0 = _r0, (p)->g0 = _g0, (p)->b0 = _b0 138 #define setRGB1(p, _r1, _g1, _b1) (p)->r1 = _r1, (p)->g1 = _g1, (p)->b1 = _b1 140 #define setRGB2(p, _r2, _g2, _b2) (p)->r2 = _r2, (p)->g2 = _g2, (p)->b2 = _b2 142 #define setRGB3(p, _r3, _g3, _b3) (p)->r3 = _r3, (p)->g3 = _g3, (p)->b3 = _b3 147 #define setXY0(p, _x0, _y0) (p)->x0 = (_x0), (p)->y0 = (_y0) 149 #define setXY2(p, _x0, _y0, _x1, _y1) (p)->x0 = (_x0), (p)->y0 = (_y0), (p)->x1 = (_x1), (p)->y1 = (_y1) 151 #define setXY3(p, _x0, _y0, _x1, _y1, _x2, _y2) (p)->x0 = (_x0), (p)->y0 = (_y0), (p)->x1 = (_x1), (p)->y1 = (_y1), (p)->x2 = (_x2), (p)->y2 = (_y2) 153 #define setXY4(p, _x0, _y0, _x1, _y1, _x2, _y2, _x3, _y3) \ 154 (p)->x0 = (_x0), (p)->y0 = (_y0), (p)->x1 = (_x1), (p)->y1 = (_y1), (p)->x2 = (_x2), (p)->y2 = (_y2), (p)->x3 = (_x3), (p)->y3 = (_y3) 156 #define setXYWH(p, _x0, _y0, _w, _h) \ 157 (p)->x0 = (_x0), (p)->y0 = (_y0), (p)->x1 = (_x0) + (_w), (p)->y1 = (_y0), (p)->x2 = (_x0), (p)->y2 = (_y0) + (_h), (p)->x3 = (_x0) + (_w), (p)->y3 = (_y0) + (_h) 162 #define setWH(p, _w, _h) (p)->w = _w, (p)->h = _h 167 #define setUV0(p, _u0, _v0) (p)->u0 = (_u0), (p)->v0 = (_v0) 169 #define setUV3(p, _u0, _v0, _u1, _v1, _u2, _v2) (p)->u0 = (_u0), (p)->v0 = (_v0), (p)->u1 = (_u1), (p)->v1 = (_v1), (p)->u2 = (_u2), (p)->v2 = (_v2) 171 #define setUV4(p, _u0, _v0, _u1, _v1, _u2, _v2, _u3, _v3) \ 172 (p)->u0 = (_u0), (p)->v0 = (_v0), (p)->u1 = (_u1), (p)->v1 = (_v1), (p)->u2 = (_u2), (p)->v2 = (_v2), (p)->u3 = (_u3), (p)->v3 = (_v3) 174 #define setUVWH(p, _u0, _v0, _w, _h) \ 175 (p)->u0 = (_u0), (p)->v0 = (_v0), (p)->u1 = (_u0) + (_w), (p)->v1 = (_v0), (p)->u2 = (_u0), (p)->v2 = (_v0) + (_h), (p)->u3 = (_u0) + (_w), (p)->v3 = (_v0) + (_h) 180 #define setusr(p, _usr) (((P_TAG *)(p))->usr = (void *)(_usr)) 181 #define setz(p, _z) (((P_TAG *)(p))->z0 = (uint16)(_z)) 182 #define setlen(p, _len) (((P_TAG *)(p))->len = (uint8)(_len)) 183 #define setaddr(p, _addr) (((P_TAG *)(p))->addr = (void *)(_addr)) 184 #define setcode(p, _code) (((P_TAG *)(p))->code = (uint8)(_code)) 186 #define getlen(p) (uint8)(((P_TAG *)(p))->len) 187 #define getcode(p) (uint8)(((P_TAG *)(p))->code) 188 #define getaddr(p) (void *)(((P_TAG *)(p))->addr) 190 #define nextPrim(p) (void *)(((P_TAG *)(p))->addr) 191 #define isendprim(p) ((((P_TAG *)(p))->addr) == (void *)UINTPTR_MAX) 193 #define addPrim(ot, p) setaddr(p, getaddr(ot)), setaddr(ot, p), setz(p, 0), setusr(p, 0) 194 #define addPrimZ(ot, p, z0) setaddr(p, getaddr(ot)), setaddr(ot, p), setz(p, z0), setusr(p, 0) 195 #define addPrimZUsr(ot, p, z0, usr) setaddr(p, getaddr(ot)), setaddr(ot, p), setz(p, z0), setusr(p, usr) 196 #define addPrims(ot, p0, p1) setaddr(p1, getaddr(ot)), setaddr(ot, p0) 198 #define catPrim(p0, p1) setaddr(p0, p1) 199 #define termPrim(p) setaddr(p, (void *)UINTPTR_MAX) 201 #define setSemiTrans(p, abe) ((abe) ? setcode(p, getcode(p) | 0x02) : setcode(p, getcode(p) & ~0x02)) 203 #define setShadeTex(p, tge) ((tge) ? setcode(p, getcode(p) | 0x01) : setcode(p, getcode(p) & ~0x01)) 205 #define getTPage(tp, abr, x, y) ((((tp)&0x3) << 7) | (((abr)&0x3) << 5) | (((y)&0x100) >> 4) | (((x)&0x3ff) >> 6) | (((y)&0x200) << 2)) 207 #define getClut(x, y) ((y << 6) | ((x >> 4) & 0x3f)) 209 #define dumpTPage(tpage) \ 210 GPU_printf("tpage: (%d,%d,%d,%d)\n", ((tpage) >> 7) & 0x003, ((tpage) >> 5) & 0x003, ((tpage) << 6) & 0x7c0, (((tpage) << 4) & 0x100) + (((tpage) >> 2) & 0x200)) 212 #define dumpClut(clut) GPU_printf("clut: (%d,%d)\n", (clut & 0x3f) << 4, (clut >> 6)) 214 #define _get_mode(dfe, dtd, tpage) ((0xe1000000) | ((dtd) ? 0x0200 : 0) | ((dfe) ? 0x0400 : 0) | ((tpage)&0x9ff)) 216 #define setDrawTPage(p, dfe, dtd, tpage) setlen(p, 1), ((uint32 *)(p))[2] = _get_mode(dfe, dtd, tpage) 218 #define _get_tw(tw) \ 219 (tw ? ((0xe2000000) | ((((tw)->y & 0xff) >> 3) << 15) | ((((tw)->x & 0xff) >> 3) << 10) | (((~((tw)->h - 1) & 0xff) >> 3) << 5) | (((~((tw)->w - 1) & 0xff) >> 3))) : 0) 221 #define setTexWindow(p, tw) setlen(p, 2), ((uint32 *)(p))[1] = _get_tw(tw), ((uint32 *)(p))[2] = 0 223 #define _get_len(rect) (((rect)->w * (rect)->h + 1) / 2 + 4) 225 #define setDrawLoad(pt, rect) \ 226 (_get_len(rect) <= 16) ? ((setlen(pt, _get_len(rect))), ((pt)->code[0] = 0xa0000000), ((pt)->code[1] = *((uint32 *)&(rect)->x)), \ 227 ((pt)->code[2] = *((uint32 *)&(rect)->w)), ((pt)->p[_get_len(rect) - 4] = 0x01000000)) \ 233 #define setPolyF3(p) setlen(p, 4 + 3), setcode(p, 0x20) 234 #define setPolyFT3(p) setlen(p, 7 + 3), setcode(p, 0x24) 235 #define setPolyG3(p) setlen(p, 6 + 3), setcode(p, 0x30) 236 #define setPolyGT3(p) setlen(p, 9 + 3), setcode(p, 0x34) 237 #define setPolyF4(p) setlen(p, 5 + 4), setcode(p, 0x28) 238 #define setPolyFT4(p) setlen(p, 9 + 4), setcode(p, 0x2c) 239 #define setPolyG4(p) setlen(p, 8 + 4), setcode(p, 0x38) 240 #define setPolyGT4(p) setlen(p, 12 + 4), setcode(p, 0x3c) 242 #define setSprt8(p) setlen(p, 3 + 1), setcode(p, 0x74) 243 #define setSprt16(p) setlen(p, 3 + 1), setcode(p, 0x7c) 244 #define setSprt(p) setlen(p, 4 + 1), setcode(p, 0x64) 246 #define setTile1(p) setlen(p, 2 + 1), setcode(p, 0x68) 247 #define setTile8(p) setlen(p, 2 + 1), setcode(p, 0x70) 248 #define setTile16(p) setlen(p, 2 + 1), setcode(p, 0x78) 249 #define setTile(p) setlen(p, 3 + 1), setcode(p, 0x60) 250 #define setLineF2(p) setlen(p, 3 + 2), setcode(p, 0x40) 251 #define setLineG2(p) setlen(p, 4 + 2), setcode(p, 0x50) 252 #define setLineF3(p) setlen(p, 5 + 3), setcode(p, 0x48), (p)->pad = 0x55555555 253 #define setLineG3(p) setlen(p, 7 + 3), setcode(p, 0x58), (p)->pad = 0x55555555, (p)->p2 = 0 254 #define setLineF4(p) setlen(p, 6 + 4), setcode(p, 0x4c), (p)->pad = 0x55555555 255 #define setLineG4(p) setlen(p, 9 + 4), setcode(p, 0x5c), (p)->pad = 0x55555555, (p)->p2 = 0, (p)->p3 = 0 275 uint8 r0, g0, b0, code;
278 typedef struct { uint8 r0, g0, b0, code; }
P_CODE;
285 uint8 r0, g0, b0, code;
290 uint8 r0, g0, b0, code;
327 uint8 r0, g0, b0, code;
335 uint8 r0, g0, b0, code;
344 uint8 r0, g0, b0, code;
355 uint8 r0, g0, b0, code;
368 uint8 r0, g0, b0, code;
370 uint8 r1, g1, b1, pad1;
372 uint8 r2, g2, b2, pad2;
378 uint8 r0, g0, b0, code;
380 uint8 r1, g1, b1, pad1;
382 uint8 r2, g2, b2, pad2;
384 uint8 r3, g3, b3, pad3;
390 uint8 r0, g0, b0, code;
393 uint8 r1, g1, b1, p1;
396 uint8 r2, g2, b2, p2;
403 uint8 r0, g0, b0, code;
406 uint8 r1, g1, b1, p1;
409 uint8 r2, g2, b2, p2;
412 uint8 r3, g3, b3, p3;
422 uint8 r0, g0, b0, code;
429 uint8 r0, g0, b0, code;
431 uint8 r1, g1, b1, p1;
437 uint8 r0, g0, b0, code;
446 uint8 r0, g0, b0, code;
448 uint8 r1, g1, b1, p1;
450 uint8 r2, g2, b2, p2;
457 uint8 r0, g0, b0, code;
467 uint8 r0, g0, b0, code;
469 uint8 r1, g1, b1, p1;
471 uint8 r2, g2, b2, p2;
473 uint8 r3, g3, b3, p3;
483 uint8 r0, g0, b0, code;
491 uint8 r0, g0, b0, code;
498 uint8 r0, g0, b0, code;
508 uint8 r0, g0, b0, code;
515 uint8 r0, g0, b0, code;
521 uint8 r0, g0, b0, code;
527 uint8 r0, g0, b0, code;
579 #define FNT_MAX_SPRT 1024 586 uint8 r0, g0, b0, p0;
587 uint8 r1, g1, b1, p1;
588 uint8 r2, g2, b2, p2;
589 uint8 r3, g3, b3, p3;
591 uint8 u0, v0, u1, v1;
592 uint8 u2, v2, u3, v3;
620 extern int32 LoadImage(
RECT16 *rect, uint32 *p);
623 extern void DrawOTag(
OT_tag *p);
624 extern void DrawPrim(
void *p);
Definition: psx_pcgpu.h:342
Definition: psx_pcgpu.h:455
Definition: psx_pcgpu.h:584
Definition: psx_pcgpu.h:296
Definition: px_capri_maths.h:53
Definition: psx_pcgpu.h:612
Definition: psx_pcgpu.h:265
Definition: psx_pcgpu.h:333
Definition: psx_pcgpu.h:427
Definition: psx_pcgpu.h:435
Definition: psx_pcgpu.h:570
Definition: psx_pcgpu.h:565
Definition: psx_pcgpu.h:519
Definition: psx_pcgpu.h:366
Definition: psx_pcgpu.h:525
Definition: psx_pcgpu.h:278
Definition: psx_pcgpu.h:544
Definition: psx_pcgpu.h:481
Definition: psx_pcgpu.h:401
Definition: psx_pcgpu.h:420
Definition: psx_pcgpu.h:534
Definition: psx_pcgpu.h:376
Definition: psx_pcgpu.h:465
Definition: psx_pcgpu.h:554
Definition: psx_pcgpu.h:549
Definition: psx_pcgpu.h:513
Definition: psx_pcgpu.h:496
Definition: psx_pcgpu.h:388
Definition: psx_pcgpu.h:353
Definition: psx_pcgpu.h:301
Definition: psx_pcgpu.h:270
Definition: psx_pcgpu.h:288
Definition: psx_pcgpu.h:280
Definition: psx_pcgpu.h:539
Definition: psx_pcgpu.h:506
Definition: psx_pcgpu.h:444
Definition: psx_pcgpu.h:260
Definition: psx_pcgpu.h:489
Definition: psx_pcgpu.h:559
Definition: psx_pcgpu.h:313
Definition: psx_pcgpu.h:325