1 /***************************************************************************
4 begin : Sun Oct 28 2001
5 copyright : (C) 2001 by Pete Bernert
6 email : BlackDove@addcom.de
7 ***************************************************************************/
8 /***************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. See also the license.txt file for *
14 * additional informations. *
16 ***************************************************************************/
18 ////////////////////////////////////////////////////////////////////////
20 ////////////////////////////////////////////////////////////////////////
22 BOOL bUsingTWin=FALSE;
24 //unsigned long clutid; // global clut
25 unsigned short usMirror=0; // sprite mirror
32 uint32_t dwActFixes=0;
35 BOOL bDoVSyncUpdate=FALSE;
38 static inline unsigned short BGR24to16 (uint32_t BGR)
40 return (unsigned short)(((BGR>>3)&0x1f)|((BGR&0xf80000)>>9)|((BGR&0xf800)>>6));
43 ////////////////////////////////////////////////////////////////////////
44 // Update global TP infos
45 ////////////////////////////////////////////////////////////////////////
47 static inline void UpdateGlobalTP(unsigned short gdata)
49 GlobalTextAddrX = (gdata << 6) & 0x3c0; // texture addr
51 GlobalTextAddrY = (gdata << 4) & 0x100;
53 GlobalTextTP = (gdata >> 7) & 0x3; // tex mode (4,8,15)
55 if(GlobalTextTP==3) GlobalTextTP=2; // seen in Wild9 :(
57 GlobalTextABR = (gdata >> 5) & 0x3; // blend mode
59 lGPUstatusRet&=~0x000001ff; // Clear the necessary bits
60 lGPUstatusRet|=(gdata & 0x01ff); // set the necessary bits
68 if(lGPUstatusRet&0x0200) iDither=2;
77 ////////////////////////////////////////////////////////////////////////
79 static inline void SetRenderMode(uint32_t DrawAttributes)
81 DrawSemiTrans = (SEMITRANSBIT(DrawAttributes)) ? TRUE : FALSE;
83 if(SHADETEXBIT(DrawAttributes))
87 if((dwActFixes&4) && ((DrawAttributes&0x00ffffff)==0))
88 DrawAttributes|=0x007f7f7f;
90 g_m1=(short)(DrawAttributes&0xff);
91 g_m2=(short)((DrawAttributes>>8)&0xff);
92 g_m3=(short)((DrawAttributes>>16)&0xff);
96 ////////////////////////////////////////////////////////////////////////
98 // oki, here are the psx gpu coord rules: poly coords are
99 // 11 bit signed values (-1024...1023). If the x or y distance
100 // exceeds 1024, the polygon will not be drawn.
101 // Since quads are treated as two triangles by the real gpu,
102 // this 'discard rule' applies to each of the quad's triangle
103 // (so one triangle can be drawn, the other one discarded).
104 // Also, y drawing is wrapped at 512 one time,
105 // then it will get negative (and therefore not drawn). The
106 // 'CheckCoord' funcs are a simple (not comlete!) approach to
107 // do things right, I will add a better detection soon... the
108 // current approach will be easier to do in hw/accel plugins, imho
112 #define CHKMAX_X 1024
115 static inline void AdjustCoord4(void)
117 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
118 lx1=(short)(((int)lx1<<SIGNSHIFT)>>SIGNSHIFT);
119 lx2=(short)(((int)lx2<<SIGNSHIFT)>>SIGNSHIFT);
120 lx3=(short)(((int)lx3<<SIGNSHIFT)>>SIGNSHIFT);
121 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
122 ly1=(short)(((int)ly1<<SIGNSHIFT)>>SIGNSHIFT);
123 ly2=(short)(((int)ly2<<SIGNSHIFT)>>SIGNSHIFT);
124 ly3=(short)(((int)ly3<<SIGNSHIFT)>>SIGNSHIFT);
127 static inline void AdjustCoord3(void)
129 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
130 lx1=(short)(((int)lx1<<SIGNSHIFT)>>SIGNSHIFT);
131 lx2=(short)(((int)lx2<<SIGNSHIFT)>>SIGNSHIFT);
132 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
133 ly1=(short)(((int)ly1<<SIGNSHIFT)>>SIGNSHIFT);
134 ly2=(short)(((int)ly2<<SIGNSHIFT)>>SIGNSHIFT);
137 static inline void AdjustCoord2(void)
139 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
140 lx1=(short)(((int)lx1<<SIGNSHIFT)>>SIGNSHIFT);
141 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
142 ly1=(short)(((int)ly1<<SIGNSHIFT)>>SIGNSHIFT);
145 static inline void AdjustCoord1(void)
147 lx0=(short)(((int)lx0<<SIGNSHIFT)>>SIGNSHIFT);
148 ly0=(short)(((int)ly0<<SIGNSHIFT)>>SIGNSHIFT);
150 if(lx0<-512 && PSXDisplay.DrawOffset.x<=-512)
153 if(ly0<-512 && PSXDisplay.DrawOffset.y<=-512)
157 ////////////////////////////////////////////////////////////////////////
158 // special checks... nascar, syphon filter 2, mgs
159 ////////////////////////////////////////////////////////////////////////
161 // xenogears FT4: not removed correctly right now... the tri 0,1,2
162 // should get removed, the tri 1,2,3 should stay... pfff
164 // x -466 1023 180 1023
165 // y 20 -228 222 -100
171 static inline BOOL CheckCoord4(void)
175 if(((lx1-lx0)>CHKMAX_X) ||
176 ((lx2-lx0)>CHKMAX_X))
180 if((lx1-lx3)>CHKMAX_X) return TRUE;
181 if((lx2-lx3)>CHKMAX_X) return TRUE;
187 if((lx0-lx1)>CHKMAX_X) return TRUE;
188 if((lx2-lx1)>CHKMAX_X) return TRUE;
189 if((lx3-lx1)>CHKMAX_X) return TRUE;
193 if((lx0-lx2)>CHKMAX_X) return TRUE;
194 if((lx1-lx2)>CHKMAX_X) return TRUE;
195 if((lx3-lx2)>CHKMAX_X) return TRUE;
199 if(((lx1-lx3)>CHKMAX_X) ||
200 ((lx2-lx3)>CHKMAX_X))
204 if((lx1-lx0)>CHKMAX_X) return TRUE;
205 if((lx2-lx0)>CHKMAX_X) return TRUE;
213 if((ly1-ly0)>CHKMAX_Y) return TRUE;
214 if((ly2-ly0)>CHKMAX_Y) return TRUE;
218 if((ly0-ly1)>CHKMAX_Y) return TRUE;
219 if((ly2-ly1)>CHKMAX_Y) return TRUE;
220 if((ly3-ly1)>CHKMAX_Y) return TRUE;
224 if((ly0-ly2)>CHKMAX_Y) return TRUE;
225 if((ly1-ly2)>CHKMAX_Y) return TRUE;
226 if((ly3-ly2)>CHKMAX_Y) return TRUE;
230 if((ly1-ly3)>CHKMAX_Y) return TRUE;
231 if((ly2-ly3)>CHKMAX_Y) return TRUE;
237 static inline BOOL CheckCoord3(void)
241 if((lx1-lx0)>CHKMAX_X) return TRUE;
242 if((lx2-lx0)>CHKMAX_X) return TRUE;
246 if((lx0-lx1)>CHKMAX_X) return TRUE;
247 if((lx2-lx1)>CHKMAX_X) return TRUE;
251 if((lx0-lx2)>CHKMAX_X) return TRUE;
252 if((lx1-lx2)>CHKMAX_X) return TRUE;
256 if((ly1-ly0)>CHKMAX_Y) return TRUE;
257 if((ly2-ly0)>CHKMAX_Y) return TRUE;
261 if((ly0-ly1)>CHKMAX_Y) return TRUE;
262 if((ly2-ly1)>CHKMAX_Y) return TRUE;
266 if((ly0-ly2)>CHKMAX_Y) return TRUE;
267 if((ly1-ly2)>CHKMAX_Y) return TRUE;
274 static inline BOOL CheckCoord2(void)
278 if((lx1-lx0)>CHKMAX_X) return TRUE;
282 if((lx0-lx1)>CHKMAX_X) return TRUE;
286 if((ly1-ly0)>CHKMAX_Y) return TRUE;
290 if((ly0-ly1)>CHKMAX_Y) return TRUE;
296 static inline BOOL CheckCoordL(short slx0,short sly0,short slx1,short sly1)
300 if((slx1-slx0)>CHKMAX_X) return TRUE;
304 if((slx0-slx1)>CHKMAX_X) return TRUE;
308 if((sly1-sly0)>CHKMAX_Y) return TRUE;
312 if((sly0-sly1)>CHKMAX_Y) return TRUE;
319 ////////////////////////////////////////////////////////////////////////
320 // mask stuff... used in silent hill
321 ////////////////////////////////////////////////////////////////////////
323 static inline void cmdSTP(unsigned char * baseAddr)
325 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
327 lGPUstatusRet&=~0x1800; // Clear the necessary bits
328 lGPUstatusRet|=((gdata & 0x03) << 11); // Set the necessary bits
330 if(gdata&1) {sSetMask=0x8000;lSetMask=0x80008000;}
331 else {sSetMask=0; lSetMask=0; }
333 if(gdata&2) bCheckMask=TRUE;
334 else bCheckMask=FALSE;
337 ////////////////////////////////////////////////////////////////////////
338 // cmd: Set texture page infos
339 ////////////////////////////////////////////////////////////////////////
341 static void cmdTexturePage(unsigned char * baseAddr)
343 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
345 lGPUstatusRet&=~0x000007ff;
346 lGPUstatusRet|=(gdata & 0x07ff);
348 usMirror=gdata&0x3000;
350 UpdateGlobalTP((unsigned short)gdata);
353 ////////////////////////////////////////////////////////////////////////
354 // cmd: turn on/off texture window
355 ////////////////////////////////////////////////////////////////////////
357 static void cmdTextureWindow(unsigned char *baseAddr)
359 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
361 uint32_t YAlign,XAlign;
363 lGPUInfoVals[INFO_TW]=gdata&0xFFFFF;
366 TWin.Position.y1 = 8; // xxxx1
367 else if (gdata & 0x040)
368 TWin.Position.y1 = 16; // xxx10
369 else if (gdata & 0x080)
370 TWin.Position.y1 = 32; // xx100
371 else if (gdata & 0x100)
372 TWin.Position.y1 = 64; // x1000
373 else if (gdata & 0x200)
374 TWin.Position.y1 = 128; // 10000
376 TWin.Position.y1 = 256; // 00000
377 TWin.ymask = TWin.Position.y1 - 1;
379 // Texture window size is determined by the least bit set of the relevant 5 bits
382 TWin.Position.x1 = 8; // xxxx1
383 else if (gdata & 0x002)
384 TWin.Position.x1 = 16; // xxx10
385 else if (gdata & 0x004)
386 TWin.Position.x1 = 32; // xx100
387 else if (gdata & 0x008)
388 TWin.Position.x1 = 64; // x1000
389 else if (gdata & 0x010)
390 TWin.Position.x1 = 128; // 10000
392 TWin.Position.x1 = 256; // 00000
393 TWin.xmask = TWin.Position.x1 - 1;
395 // Re-calculate the bit field, because we can't trust what is passed in the data
398 YAlign = (uint32_t)(32 - (TWin.Position.y1 >> 3));
399 XAlign = (uint32_t)(32 - (TWin.Position.x1 >> 3));
401 // Absolute position of the start of the texture window
403 TWin.Position.y0 = (short)(((gdata >> 15) & YAlign) << 3);
404 TWin.Position.x0 = (short)(((gdata >> 10) & XAlign) << 3);
406 if((TWin.Position.x0 == 0 && // tw turned off
407 TWin.Position.y0 == 0 &&
408 TWin.Position.x1 == 0 &&
409 TWin.Position.y1 == 0) ||
410 (TWin.Position.x1 == 256 &&
411 TWin.Position.y1 == 256))
413 bUsingTWin = FALSE; // -> just do it
417 bUsingTWin = TRUE; // -> tw turned on
421 ////////////////////////////////////////////////////////////////////////
422 // cmd: start of drawing area... primitives will be clipped inside
423 ////////////////////////////////////////////////////////////////////////
427 static void cmdDrawAreaStart(unsigned char * baseAddr)
429 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
431 drawX = gdata & 0x3ff; // for soft drawing
433 lGPUInfoVals[INFO_DRAWSTART]=gdata&0xFFFFF;
434 drawY = (gdata>>10)&0x3ff;
435 if(drawY>=512) drawY=511; // some security
438 ////////////////////////////////////////////////////////////////////////
439 // cmd: end of drawing area... primitives will be clipped inside
440 ////////////////////////////////////////////////////////////////////////
442 static void cmdDrawAreaEnd(unsigned char * baseAddr)
444 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
446 drawW = gdata & 0x3ff; // for soft drawing
448 lGPUInfoVals[INFO_DRAWEND]=gdata&0xFFFFF;
449 drawH = (gdata>>10)&0x3ff;
450 if(drawH>=512) drawH=511; // some security
453 ////////////////////////////////////////////////////////////////////////
454 // cmd: draw offset... will be added to prim coords
455 ////////////////////////////////////////////////////////////////////////
457 static void cmdDrawOffset(unsigned char * baseAddr)
459 uint32_t gdata = GETLE32(&((uint32_t*)baseAddr)[0]);
461 PSXDisplay.DrawOffset.x = (short)(gdata & 0x7ff);
463 lGPUInfoVals[INFO_DRAWOFF]=gdata&0x3FFFFF;
464 PSXDisplay.DrawOffset.y = (short)((gdata>>11) & 0x7ff);
466 PSXDisplay.DrawOffset.y=(short)(((int)PSXDisplay.DrawOffset.y<<21)>>21);
467 PSXDisplay.DrawOffset.x=(short)(((int)PSXDisplay.DrawOffset.x<<21)>>21);
470 ////////////////////////////////////////////////////////////////////////
471 // cmd: load image to vram
472 ////////////////////////////////////////////////////////////////////////
474 static void primLoadImage(unsigned char * baseAddr)
476 unsigned short *sgpuData = ((unsigned short *) baseAddr);
478 VRAMWrite.x = GETLEs16(&sgpuData[2])&0x3ff;
479 VRAMWrite.y = GETLEs16(&sgpuData[3])&511;
480 VRAMWrite.Width = GETLEs16(&sgpuData[4]);
481 VRAMWrite.Height = GETLEs16(&sgpuData[5]);
483 DataWriteMode = DR_VRAMTRANSFER;
485 VRAMWrite.ImagePtr = psxVuw + (VRAMWrite.y<<10) + VRAMWrite.x;
486 VRAMWrite.RowsRemaining = VRAMWrite.Width;
487 VRAMWrite.ColsRemaining = VRAMWrite.Height;
490 ////////////////////////////////////////////////////////////////////////
491 // cmd: vram -> psx mem
492 ////////////////////////////////////////////////////////////////////////
494 static void primStoreImage(unsigned char * baseAddr)
496 unsigned short *sgpuData = ((unsigned short *) baseAddr);
498 VRAMRead.x = GETLEs16(&sgpuData[2])&0x03ff;
499 VRAMRead.y = GETLEs16(&sgpuData[3])&511;
500 VRAMRead.Width = GETLEs16(&sgpuData[4]);
501 VRAMRead.Height = GETLEs16(&sgpuData[5]);
503 VRAMRead.ImagePtr = psxVuw + (VRAMRead.y<<10) + VRAMRead.x;
504 VRAMRead.RowsRemaining = VRAMRead.Width;
505 VRAMRead.ColsRemaining = VRAMRead.Height;
507 DataReadMode = DR_VRAMTRANSFER;
509 lGPUstatusRet |= GPUSTATUS_READYFORVRAM;
512 ////////////////////////////////////////////////////////////////////////
513 // cmd: blkfill - NO primitive! Doesn't care about draw areas...
514 ////////////////////////////////////////////////////////////////////////
516 static void primBlkFill(unsigned char * baseAddr)
518 uint32_t *gpuData = ((uint32_t *) baseAddr);
519 short *sgpuData = ((short *) baseAddr);
521 short sX = GETLEs16(&sgpuData[2]);
522 short sY = GETLEs16(&sgpuData[3]);
523 short sW = GETLEs16(&sgpuData[4]) & 0x3ff;
524 short sH = GETLEs16(&sgpuData[5]) & 0x3ff;
528 // Increase H & W if they are one short of full values, because they never can be full values
529 if (sH >= 1023) sH=1024;
530 if (sW >= 1023) sW=1024;
532 // x and y of end pos
536 FillSoftwareArea(sX, sY, sW, sH, BGR24to16(GETLE32(&gpuData[0])));
541 ////////////////////////////////////////////////////////////////////////
542 // cmd: move image vram -> vram
543 ////////////////////////////////////////////////////////////////////////
545 static void primMoveImage(unsigned char * baseAddr)
547 short *sgpuData = ((short *) baseAddr);
549 short imageY0,imageX0,imageY1,imageX1,imageSX,imageSY,i,j;
551 imageX0 = GETLEs16(&sgpuData[2])&0x03ff;
552 imageY0 = GETLEs16(&sgpuData[3])&511;
553 imageX1 = GETLEs16(&sgpuData[4])&0x03ff;
554 imageY1 = GETLEs16(&sgpuData[5])&511;
555 imageSX = GETLEs16(&sgpuData[6]);
556 imageSY = GETLEs16(&sgpuData[7]);
558 if((imageX0 == imageX1) && (imageY0 == imageY1)) return;
559 if(imageSX<=0) return;
560 if(imageSY<=0) return;
562 if((imageY0+imageSY)>512 ||
563 (imageX0+imageSX)>1024 ||
564 (imageY1+imageSY)>512 ||
565 (imageX1+imageSX)>1024)
568 for(j=0;j<imageSY;j++)
569 for(i=0;i<imageSX;i++)
570 psxVuw [(1024*((imageY1+j)&511))+((imageX1+i)&0x3ff)]=
571 psxVuw[(1024*((imageY0+j)&511))+((imageX0+i)&0x3ff)];
578 if((imageSX|imageX0|imageX1)&1) // not dword aligned? slower func
580 unsigned short *SRCPtr, *DSTPtr;
581 unsigned short LineOffset;
583 SRCPtr = psxVuw + (1024*imageY0) + imageX0;
584 DSTPtr = psxVuw + (1024*imageY1) + imageX1;
586 LineOffset = 1024 - imageSX;
588 for(j=0;j<imageSY;j++)
590 for(i=0;i<imageSX;i++) *DSTPtr++ = *SRCPtr++;
591 SRCPtr += LineOffset;
592 DSTPtr += LineOffset;
595 else // dword aligned
597 uint32_t *SRCPtr, *DSTPtr;
598 unsigned short LineOffset;
601 SRCPtr = (uint32_t *)(psxVuw + (1024*imageY0) + imageX0);
602 DSTPtr = (uint32_t *)(psxVuw + (1024*imageY1) + imageX1);
604 LineOffset = 512 - dx;
606 for(j=0;j<imageSY;j++)
608 for(i=0;i<dx;i++) *DSTPtr++ = *SRCPtr++;
609 SRCPtr += LineOffset;
610 DSTPtr += LineOffset;
620 ////////////////////////////////////////////////////////////////////////
621 // cmd: draw free-size Tile
622 ////////////////////////////////////////////////////////////////////////
624 static void primTileS(unsigned char * baseAddr)
626 uint32_t *gpuData = ((uint32_t*)baseAddr);
627 short *sgpuData = ((short *) baseAddr);
628 short sW = GETLEs16(&sgpuData[4]) & 0x3ff;
629 short sH = GETLEs16(&sgpuData[5]) & 511; // mmm... limit tiles to 0x1ff or height?
631 lx0 = GETLEs16(&sgpuData[2]);
632 ly0 = GETLEs16(&sgpuData[3]);
634 if(!(dwActFixes&8)) AdjustCoord1();
637 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
638 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
639 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
640 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
642 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
644 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
645 BGR24to16(GETLE32(&gpuData[0])));
650 ////////////////////////////////////////////////////////////////////////
651 // cmd: draw 1 dot Tile (point)
652 ////////////////////////////////////////////////////////////////////////
654 static void primTile1(unsigned char * baseAddr)
656 uint32_t *gpuData = ((uint32_t*)baseAddr);
657 short *sgpuData = ((short *) baseAddr);
661 lx0 = GETLEs16(&sgpuData[2]);
662 ly0 = GETLEs16(&sgpuData[3]);
664 if(!(dwActFixes&8)) AdjustCoord1();
667 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
668 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
669 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
670 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
672 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
674 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
675 BGR24to16(GETLE32(&gpuData[0]))); // Takes Start and Offset
680 ////////////////////////////////////////////////////////////////////////
681 // cmd: draw 8 dot Tile (small rect)
682 ////////////////////////////////////////////////////////////////////////
684 static void primTile8(unsigned char * baseAddr)
686 uint32_t *gpuData = ((uint32_t*)baseAddr);
687 short *sgpuData = ((short *) baseAddr);
691 lx0 = GETLEs16(&sgpuData[2]);
692 ly0 = GETLEs16(&sgpuData[3]);
694 if(!(dwActFixes&8)) AdjustCoord1();
697 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
698 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
699 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
700 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
702 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
704 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
705 BGR24to16(GETLE32(&gpuData[0]))); // Takes Start and Offset
710 ////////////////////////////////////////////////////////////////////////
711 // cmd: draw 16 dot Tile (medium rect)
712 ////////////////////////////////////////////////////////////////////////
714 static void primTile16(unsigned char * baseAddr)
716 uint32_t *gpuData = ((uint32_t*)baseAddr);
717 short *sgpuData = ((short *) baseAddr);
721 lx0 = GETLEs16(&sgpuData[2]);
722 ly0 = GETLEs16(&sgpuData[3]);
724 if(!(dwActFixes&8)) AdjustCoord1();
727 ly2 = ly3 = ly0+sH +PSXDisplay.DrawOffset.y;
728 ly0 = ly1 = ly0 +PSXDisplay.DrawOffset.y;
729 lx1 = lx2 = lx0+sW +PSXDisplay.DrawOffset.x;
730 lx0 = lx3 = lx0 +PSXDisplay.DrawOffset.x;
732 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
734 FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,
735 BGR24to16(GETLE32(&gpuData[0]))); // Takes Start and Offset
740 ////////////////////////////////////////////////////////////////////////
741 // cmd: small sprite (textured rect)
742 ////////////////////////////////////////////////////////////////////////
744 static void primSprt8(unsigned char * baseAddr)
746 uint32_t *gpuData = ((uint32_t *) baseAddr);
747 short *sgpuData = ((short *) baseAddr);
749 lx0 = GETLEs16(&sgpuData[2]);
750 ly0 = GETLEs16(&sgpuData[3]);
752 if(!(dwActFixes&8)) AdjustCoord1();
754 SetRenderMode(GETLE32(&gpuData[0]));
756 if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,8,8);
758 if(usMirror) DrawSoftwareSpriteMirror(baseAddr,8,8);
759 else DrawSoftwareSprite(baseAddr,8,8,
766 ////////////////////////////////////////////////////////////////////////
767 // cmd: medium sprite (textured rect)
768 ////////////////////////////////////////////////////////////////////////
770 static void primSprt16(unsigned char * baseAddr)
772 uint32_t *gpuData = ((uint32_t *) baseAddr);
773 short *sgpuData = ((short *) baseAddr);
775 lx0 = GETLEs16(&sgpuData[2]);
776 ly0 = GETLEs16(&sgpuData[3]);
778 if(!(dwActFixes&8)) AdjustCoord1();
780 SetRenderMode(GETLE32(&gpuData[0]));
782 if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,16,16);
784 if(usMirror) DrawSoftwareSpriteMirror(baseAddr,16,16);
785 else DrawSoftwareSprite(baseAddr,16,16,
792 ////////////////////////////////////////////////////////////////////////
793 // cmd: free-size sprite (textured rect)
794 ////////////////////////////////////////////////////////////////////////
796 // func used on texture coord wrap
797 static void primSprtSRest(unsigned char * baseAddr,unsigned short type)
799 uint32_t *gpuData = ((uint32_t *) baseAddr);
800 short *sgpuData = ((short *) baseAddr);
801 unsigned short sTypeRest=0;
804 short sX = GETLEs16(&sgpuData[2]);
805 short sY = GETLEs16(&sgpuData[3]);
806 short sW = GETLEs16(&sgpuData[6]) & 0x3ff;
807 short sH = GETLEs16(&sgpuData[7]) & 0x1ff;
808 short tX = baseAddr[8];
809 short tY = baseAddr[9];
859 SetRenderMode(GETLE32(&gpuData[0]));
861 if(tX+sW>256) {sW=256-tX;sTypeRest+=1;}
862 if(tY+sH>256) {sH=256-tY;sTypeRest+=2;}
867 if(!(dwActFixes&8)) AdjustCoord1();
869 DrawSoftwareSprite(baseAddr,sW,sH,tX,tY);
871 if(sTypeRest && type<4)
873 if(sTypeRest&1 && type==1) primSprtSRest(baseAddr,4);
874 if(sTypeRest&2 && type==2) primSprtSRest(baseAddr,5);
875 if(sTypeRest==3 && type==3) primSprtSRest(baseAddr,6);
880 ////////////////////////////////////////////////////////////////////////
882 static void primSprtS(unsigned char * baseAddr)
884 uint32_t *gpuData = ((uint32_t *) baseAddr);
885 short *sgpuData = ((short *) baseAddr);
888 lx0 = GETLEs16(&sgpuData[2]);
889 ly0 = GETLEs16(&sgpuData[3]);
891 if(!(dwActFixes&8)) AdjustCoord1();
893 sW = GETLEs16(&sgpuData[6]) & 0x3ff;
894 sH = GETLEs16(&sgpuData[7]) & 0x1ff;
896 SetRenderMode(GETLE32(&gpuData[0]));
898 if(bUsingTWin) DrawSoftwareSpriteTWin(baseAddr,sW,sH);
900 if(usMirror) DrawSoftwareSpriteMirror(baseAddr,sW,sH);
903 unsigned short sTypeRest=0;
904 short tX=baseAddr[8];
905 short tY=baseAddr[9];
907 if(tX+sW>256) {sW=256-tX;sTypeRest+=1;}
908 if(tY+sH>256) {sH=256-tY;sTypeRest+=2;}
910 DrawSoftwareSprite(baseAddr,sW,sH,tX,tY);
914 if(sTypeRest&1) primSprtSRest(baseAddr,1);
915 if(sTypeRest&2) primSprtSRest(baseAddr,2);
916 if(sTypeRest==3) primSprtSRest(baseAddr,3);
924 ////////////////////////////////////////////////////////////////////////
925 // cmd: flat shaded Poly4
926 ////////////////////////////////////////////////////////////////////////
928 static void primPolyF4(unsigned char *baseAddr)
930 uint32_t *gpuData = ((uint32_t *) baseAddr);
931 short *sgpuData = ((short *) baseAddr);
933 lx0 = GETLEs16(&sgpuData[2]);
934 ly0 = GETLEs16(&sgpuData[3]);
935 lx1 = GETLEs16(&sgpuData[4]);
936 ly1 = GETLEs16(&sgpuData[5]);
937 lx2 = GETLEs16(&sgpuData[6]);
938 ly2 = GETLEs16(&sgpuData[7]);
939 lx3 = GETLEs16(&sgpuData[8]);
940 ly3 = GETLEs16(&sgpuData[9]);
945 if(CheckCoord4()) return;
949 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
951 drawPoly4F(GETLE32(&gpuData[0]));
956 ////////////////////////////////////////////////////////////////////////
957 // cmd: smooth shaded Poly4
958 ////////////////////////////////////////////////////////////////////////
960 static void primPolyG4(unsigned char * baseAddr)
962 uint32_t *gpuData = (uint32_t *)baseAddr;
963 short *sgpuData = ((short *) baseAddr);
965 lx0 = GETLEs16(&sgpuData[2]);
966 ly0 = GETLEs16(&sgpuData[3]);
967 lx1 = GETLEs16(&sgpuData[6]);
968 ly1 = GETLEs16(&sgpuData[7]);
969 lx2 = GETLEs16(&sgpuData[10]);
970 ly2 = GETLEs16(&sgpuData[11]);
971 lx3 = GETLEs16(&sgpuData[14]);
972 ly3 = GETLEs16(&sgpuData[15]);
977 if(CheckCoord4()) return;
981 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
983 drawPoly4G(GETLE32(&gpuData[0]), GETLE32(&gpuData[2]),
984 GETLE32(&gpuData[4]), GETLE32(&gpuData[6]));
989 ////////////////////////////////////////////////////////////////////////
990 // cmd: flat shaded Texture3
991 ////////////////////////////////////////////////////////////////////////
993 static void primPolyFT3(unsigned char * baseAddr)
995 uint32_t *gpuData = ((uint32_t *) baseAddr);
996 short *sgpuData = ((short *) baseAddr);
998 lx0 = GETLEs16(&sgpuData[2]);
999 ly0 = GETLEs16(&sgpuData[3]);
1000 lx1 = GETLEs16(&sgpuData[6]);
1001 ly1 = GETLEs16(&sgpuData[7]);
1002 lx2 = GETLEs16(&sgpuData[10]);
1003 ly2 = GETLEs16(&sgpuData[11]);
1005 lLowerpart=GETLE32(&gpuData[4])>>16;
1006 UpdateGlobalTP((unsigned short)lLowerpart);
1011 if(CheckCoord3()) return;
1015 SetRenderMode(GETLE32(&gpuData[0]));
1017 drawPoly3FT(baseAddr);
1019 bDoVSyncUpdate=TRUE;
1022 ////////////////////////////////////////////////////////////////////////
1023 // cmd: flat shaded Texture4
1024 ////////////////////////////////////////////////////////////////////////
1026 static void primPolyFT4(unsigned char * baseAddr)
1028 uint32_t *gpuData = ((uint32_t *) baseAddr);
1029 short *sgpuData = ((short *) baseAddr);
1031 lx0 = GETLEs16(&sgpuData[2]);
1032 ly0 = GETLEs16(&sgpuData[3]);
1033 lx1 = GETLEs16(&sgpuData[6]);
1034 ly1 = GETLEs16(&sgpuData[7]);
1035 lx2 = GETLEs16(&sgpuData[10]);
1036 ly2 = GETLEs16(&sgpuData[11]);
1037 lx3 = GETLEs16(&sgpuData[14]);
1038 ly3 = GETLEs16(&sgpuData[15]);
1040 lLowerpart=GETLE32(&gpuData[4])>>16;
1041 UpdateGlobalTP((unsigned short)lLowerpart);
1046 if(CheckCoord4()) return;
1051 SetRenderMode(GETLE32(&gpuData[0]));
1053 drawPoly4FT(baseAddr);
1055 bDoVSyncUpdate=TRUE;
1058 ////////////////////////////////////////////////////////////////////////
1059 // cmd: smooth shaded Texture3
1060 ////////////////////////////////////////////////////////////////////////
1062 static void primPolyGT3(unsigned char *baseAddr)
1064 uint32_t *gpuData = ((uint32_t *) baseAddr);
1065 short *sgpuData = ((short *) baseAddr);
1067 lx0 = GETLEs16(&sgpuData[2]);
1068 ly0 = GETLEs16(&sgpuData[3]);
1069 lx1 = GETLEs16(&sgpuData[8]);
1070 ly1 = GETLEs16(&sgpuData[9]);
1071 lx2 = GETLEs16(&sgpuData[14]);
1072 ly2 = GETLEs16(&sgpuData[15]);
1074 lLowerpart=GETLE32(&gpuData[5])>>16;
1075 UpdateGlobalTP((unsigned short)lLowerpart);
1080 if(CheckCoord3()) return;
1084 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1086 if(SHADETEXBIT(GETLE32(&gpuData[0])))
1088 gpuData[0] = (gpuData[0]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1089 gpuData[3] = (gpuData[3]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1090 gpuData[6] = (gpuData[6]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1093 drawPoly3GT(baseAddr);
1095 bDoVSyncUpdate=TRUE;
1098 ////////////////////////////////////////////////////////////////////////
1099 // cmd: smooth shaded Poly3
1100 ////////////////////////////////////////////////////////////////////////
1102 static void primPolyG3(unsigned char *baseAddr)
1104 uint32_t *gpuData = ((uint32_t *) baseAddr);
1105 short *sgpuData = ((short *) baseAddr);
1107 lx0 = GETLEs16(&sgpuData[2]);
1108 ly0 = GETLEs16(&sgpuData[3]);
1109 lx1 = GETLEs16(&sgpuData[6]);
1110 ly1 = GETLEs16(&sgpuData[7]);
1111 lx2 = GETLEs16(&sgpuData[10]);
1112 ly2 = GETLEs16(&sgpuData[11]);
1117 if(CheckCoord3()) return;
1121 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1123 drawPoly3G(GETLE32(&gpuData[0]), GETLE32(&gpuData[2]), GETLE32(&gpuData[4]));
1125 bDoVSyncUpdate=TRUE;
1128 ////////////////////////////////////////////////////////////////////////
1129 // cmd: smooth shaded Texture4
1130 ////////////////////////////////////////////////////////////////////////
1132 static void primPolyGT4(unsigned char *baseAddr)
1134 uint32_t *gpuData = ((uint32_t *) baseAddr);
1135 short *sgpuData = ((short *) baseAddr);
1137 lx0 = GETLEs16(&sgpuData[2]);
1138 ly0 = GETLEs16(&sgpuData[3]);
1139 lx1 = GETLEs16(&sgpuData[8]);
1140 ly1 = GETLEs16(&sgpuData[9]);
1141 lx2 = GETLEs16(&sgpuData[14]);
1142 ly2 = GETLEs16(&sgpuData[15]);
1143 lx3 = GETLEs16(&sgpuData[20]);
1144 ly3 = GETLEs16(&sgpuData[21]);
1146 lLowerpart=GETLE32(&gpuData[5])>>16;
1147 UpdateGlobalTP((unsigned short)lLowerpart);
1152 if(CheckCoord4()) return;
1156 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1158 if(SHADETEXBIT(GETLE32(&gpuData[0])))
1160 gpuData[0] = (gpuData[0]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1161 gpuData[3] = (gpuData[3]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1162 gpuData[6] = (gpuData[6]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1163 gpuData[9] = (gpuData[9]&HOST2LE32(0xff000000))|HOST2LE32(0x00808080);
1166 drawPoly4GT(baseAddr);
1168 bDoVSyncUpdate=TRUE;
1171 ////////////////////////////////////////////////////////////////////////
1172 // cmd: smooth shaded Poly3
1173 ////////////////////////////////////////////////////////////////////////
1175 static void primPolyF3(unsigned char *baseAddr)
1177 uint32_t *gpuData = ((uint32_t *) baseAddr);
1178 short *sgpuData = ((short *) baseAddr);
1180 lx0 = GETLEs16(&sgpuData[2]);
1181 ly0 = GETLEs16(&sgpuData[3]);
1182 lx1 = GETLEs16(&sgpuData[4]);
1183 ly1 = GETLEs16(&sgpuData[5]);
1184 lx2 = GETLEs16(&sgpuData[6]);
1185 ly2 = GETLEs16(&sgpuData[7]);
1190 if(CheckCoord3()) return;
1194 SetRenderMode(GETLE32(&gpuData[0]));
1196 drawPoly3F(GETLE32(&gpuData[0]));
1198 bDoVSyncUpdate=TRUE;
1201 ////////////////////////////////////////////////////////////////////////
1202 // cmd: skipping shaded polylines
1203 ////////////////////////////////////////////////////////////////////////
1205 static void primLineGSkip(unsigned char *baseAddr)
1207 uint32_t *gpuData = ((uint32_t *) baseAddr);
1211 ly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1212 lx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1214 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=4))
1217 ly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1218 lx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1219 i++;if(i>iMax) break;
1223 ////////////////////////////////////////////////////////////////////////
1224 // cmd: shaded polylines
1225 ////////////////////////////////////////////////////////////////////////
1227 static void primLineGEx(unsigned char *baseAddr)
1229 uint32_t *gpuData = ((uint32_t *) baseAddr);
1232 short slx0,slx1,sly0,sly1;int i=2;BOOL bDraw=TRUE;
1234 sly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1235 slx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1239 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1240 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1243 lc1 = GETLE32(&gpuData[0]) & 0xffffff;
1245 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1247 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=4))
1249 sly0=sly1; slx0=slx1; lc0=lc1;
1250 lc1=GETLE32(&gpuData[i]) & 0xffffff;
1254 // no check needed on gshaded polyline positions
1255 // if((gpuData[i] & 0xF000F000) == 0x50005000) break;
1257 sly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1258 slx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1262 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1263 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1264 if(CheckCoordL(slx0,sly0,slx1,sly1)) bDraw=FALSE; else bDraw=TRUE;
1267 if ((lx0 != lx1) || (ly0 != ly1))
1275 if(bDraw) DrawSoftwareLineShade(lc0, lc1);
1281 bDoVSyncUpdate=TRUE;
1284 ////////////////////////////////////////////////////////////////////////
1285 // cmd: shaded polyline2
1286 ////////////////////////////////////////////////////////////////////////
1288 static void primLineG2(unsigned char *baseAddr)
1290 uint32_t *gpuData = ((uint32_t *) baseAddr);
1291 short *sgpuData = ((short *) baseAddr);
1293 lx0 = GETLEs16(&sgpuData[2]);
1294 ly0 = GETLEs16(&sgpuData[3]);
1295 lx1 = GETLEs16(&sgpuData[6]);
1296 ly1 = GETLEs16(&sgpuData[7]);
1301 if(CheckCoord2()) return;
1304 if((lx0 == lx1) && (ly0 == ly1)) {lx1++;ly1++;}
1306 DrawSemiTrans = (SEMITRANSBIT(GETLE32(&gpuData[0]))) ? TRUE : FALSE;
1308 DrawSoftwareLineShade(GETLE32(&gpuData[0]),GETLE32(&gpuData[2]));
1310 bDoVSyncUpdate=TRUE;
1313 ////////////////////////////////////////////////////////////////////////
1314 // cmd: skipping flat polylines
1315 ////////////////////////////////////////////////////////////////////////
1317 static void primLineFSkip(unsigned char *baseAddr)
1319 uint32_t *gpuData = ((uint32_t *) baseAddr);
1322 ly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1323 lx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1325 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=3))
1327 ly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1328 lx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1329 i++;if(i>iMax) break;
1333 ////////////////////////////////////////////////////////////////////////
1334 // cmd: drawing flat polylines
1335 ////////////////////////////////////////////////////////////////////////
1337 static void primLineFEx(unsigned char *baseAddr)
1339 uint32_t *gpuData = ((uint32_t *) baseAddr);
1341 short slx0,slx1,sly0,sly1;int i=2;BOOL bDraw=TRUE;
1345 sly1 = (short)((GETLE32(&gpuData[1])>>16) & 0xffff);
1346 slx1 = (short)(GETLE32(&gpuData[1]) & 0xffff);
1349 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1350 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1353 SetRenderMode(GETLE32(&gpuData[0]));
1355 while(!(((GETLE32(&gpuData[i]) & 0xF000F000) == 0x50005000) && i>=3))
1357 sly0 = sly1;slx0=slx1;
1358 sly1 = (short)((GETLE32(&gpuData[i])>>16) & 0xffff);
1359 slx1 = (short)(GETLE32(&gpuData[i]) & 0xffff);
1362 slx1=(short)(((int)slx1<<SIGNSHIFT)>>SIGNSHIFT);
1363 sly1=(short)(((int)sly1<<SIGNSHIFT)>>SIGNSHIFT);
1365 if(CheckCoordL(slx0,sly0,slx1,sly1)) bDraw=FALSE; else bDraw=TRUE;
1374 if(bDraw) DrawSoftwareLineFlat(GETLE32(&gpuData[0]));
1376 i++;if(i>iMax) break;
1379 bDoVSyncUpdate=TRUE;
1382 ////////////////////////////////////////////////////////////////////////
1383 // cmd: drawing flat polyline2
1384 ////////////////////////////////////////////////////////////////////////
1386 static void primLineF2(unsigned char *baseAddr)
1388 uint32_t *gpuData = ((uint32_t *) baseAddr);
1389 short *sgpuData = ((short *) baseAddr);
1391 lx0 = GETLEs16(&sgpuData[2]);
1392 ly0 = GETLEs16(&sgpuData[3]);
1393 lx1 = GETLEs16(&sgpuData[4]);
1394 ly1 = GETLEs16(&sgpuData[5]);
1399 if(CheckCoord2()) return;
1402 if((lx0 == lx1) && (ly0 == ly1)) {lx1++;ly1++;}
1405 SetRenderMode(GETLE32(&gpuData[0]));
1407 DrawSoftwareLineFlat(GETLE32(&gpuData[0]));
1409 bDoVSyncUpdate=TRUE;
1412 ////////////////////////////////////////////////////////////////////////
1413 // cmd: well, easiest command... not implemented
1414 ////////////////////////////////////////////////////////////////////////
1416 static void primNI(unsigned char *bA)
1420 ////////////////////////////////////////////////////////////////////////
1421 // cmd func ptr table
1422 ////////////////////////////////////////////////////////////////////////
1425 void (*primTableJ[256])(unsigned char *) =
1428 primNI,primNI,primBlkFill,primNI,primNI,primNI,primNI,primNI,
1430 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1432 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1434 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1436 primPolyF3,primPolyF3,primPolyF3,primPolyF3,primPolyFT3,primPolyFT3,primPolyFT3,primPolyFT3,
1438 primPolyF4,primPolyF4,primPolyF4,primPolyF4,primPolyFT4,primPolyFT4,primPolyFT4,primPolyFT4,
1440 primPolyG3,primPolyG3,primPolyG3,primPolyG3,primPolyGT3,primPolyGT3,primPolyGT3,primPolyGT3,
1442 primPolyG4,primPolyG4,primPolyG4,primPolyG4,primPolyGT4,primPolyGT4,primPolyGT4,primPolyGT4,
1444 primLineF2,primLineF2,primLineF2,primLineF2,primNI,primNI,primNI,primNI,
1446 primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,primLineFEx,
1448 primLineG2,primLineG2,primLineG2,primLineG2,primNI,primNI,primNI,primNI,
1450 primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,primLineGEx,
1452 primTileS,primTileS,primTileS,primTileS,primSprtS,primSprtS,primSprtS,primSprtS,
1454 primTile1,primTile1,primTile1,primTile1,primNI,primNI,primNI,primNI,
1456 primTile8,primTile8,primTile8,primTile8,primSprt8,primSprt8,primSprt8,primSprt8,
1458 primTile16,primTile16,primTile16,primTile16,primSprt16,primSprt16,primSprt16,primSprt16,
1460 primMoveImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1462 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1464 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1466 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1468 primLoadImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1470 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1472 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1474 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1476 primStoreImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1478 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1480 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1482 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1484 primNI,cmdTexturePage,cmdTextureWindow,cmdDrawAreaStart,cmdDrawAreaEnd,cmdDrawOffset,cmdSTP,primNI,
1486 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1488 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1490 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI
1493 ////////////////////////////////////////////////////////////////////////
1494 // cmd func ptr table for skipping
1495 ////////////////////////////////////////////////////////////////////////
1497 void (*primTableSkip[256])(unsigned char *) =
1500 primNI,primNI,primBlkFill,primNI,primNI,primNI,primNI,primNI,
1502 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1504 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1506 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1508 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1510 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1512 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1514 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1516 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1518 primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,primLineFSkip,
1520 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1522 primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,primLineGSkip,
1524 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1526 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1528 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1530 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1532 primMoveImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1534 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1536 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1538 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1540 primLoadImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1542 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1544 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1546 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1548 primStoreImage,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1550 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1552 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1554 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1556 primNI,cmdTexturePage,cmdTextureWindow,cmdDrawAreaStart,cmdDrawAreaEnd,cmdDrawOffset,cmdSTP,primNI,
1558 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1560 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI,
1562 primNI,primNI,primNI,primNI,primNI,primNI,primNI,primNI