void gfxDrawTextScreen(u16, u16, u16, u32 *); void gfxDrawRotScreen(u16, u16, u16, u16, u16, u16, u16, u16, u16, int&, int&, int, u32*); void gfxDrawRotScreen16Bit(u16, u16, u16, u16, u16, u16, u16, u16, u16, int&, int&, int, u32*); void gfxDrawRotScreen256(u16, u16, u16, u16, u16, u16, u16, u16, u16, int&, int&, int, u32*); void gfxDrawRotScreen16Bit160(u16, u16, u16, u16, u16, u16, u16, u16, u16, int&, int&, int, u32*); void gfxDrawSprites(u32 *); void gfxIncreaseBrightness(u32 *line, int coeff); void gfxDecreaseBrightness(u32 *line, int coeff); void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb);  void mode0RenderLine(); void mode0RenderLineNoWindow(); void mode0RenderLineAll();  void mode1RenderLine(); void mode1RenderLineNoWindow(); void mode1RenderLineAll();  void mode2RenderLine(); void mode2RenderLineNoWindow(); void mode2RenderLineAll();  void mode3RenderLine(); void mode3RenderLineNoWindow(); void mode3RenderLineAll();  void mode4RenderLine(); void mode4RenderLineNoWindow(); void mode4RenderLineAll();  void mode5RenderLine(); void mode5RenderLineNoWindow(); void mode5RenderLineAll();  extern int coeff[32]; extern u32 line0[240]; extern u32 line1[240]; extern u32 line2[240]; extern u32 line3[240]; extern u32 lineOBJ[240]; extern u32 lineOBJWin[240]; extern u32 lineMix[240]; extern bool gfxInWin0[240]; extern bool gfxInWin1[240];  extern int gfxBG2Changed; extern int gfxBG3Changed;  extern int gfxBG2X; extern int gfxBG2Y; extern int gfxBG2LastX; extern int gfxBG2LastY; extern int gfxBG3X; extern int gfxBG3Y; extern int gfxBG3LastX; extern int gfxBG3LastY; extern int gfxLastVCOUNT;  inline void gfxClearArray(u32 *array) { for(int i = 0; i < 240; i++) { *array++ = 0x80000000; } }
void gfxDrawTextScreen(u16, u16, u16, u32 *);void gfxDrawRotScreen(u16,                      u16, u16,                      u16, u16,                      u16, u16,                      u16, u16,                      int&, int&,                      int,                      u32*);void gfxDrawRotScreen16Bit(u16,                           u16, u16,                           u16, u16,                           u16, u16,                           u16, u16,                           int&, int&,                           int,                           u32*);void gfxDrawRotScreen256(u16,                         u16, u16,                         u16, u16,                         u16, u16,                         u16, u16,                         int&, int&,                         int,                         u32*);void gfxDrawRotScreen16Bit160(u16,                              u16, u16,                              u16, u16,                              u16, u16,                              u16, u16,                              int&, int&,                              int,                              u32*);void gfxDrawSprites(u32 *);void gfxIncreaseBrightness(u32 *line, int coeff);void gfxDecreaseBrightness(u32 *line, int coeff);void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb);void mode0RenderLine();void mode0RenderLineNoWindow();void mode0RenderLineAll();void mode1RenderLine();void mode1RenderLineNoWindow();void mode1RenderLineAll();void mode2RenderLine();void mode2RenderLineNoWindow();void mode2RenderLineAll();void mode3RenderLine();void mode3RenderLineNoWindow();void mode3RenderLineAll();void mode4RenderLine();void mode4RenderLineNoWindow();void mode4RenderLineAll();void mode5RenderLine();void mode5RenderLineNoWindow();void mode5RenderLineAll();extern int coeff[32];extern u32 line0[240];extern u32 line1[240];extern u32 line2[240];extern u32 line3[240];extern u32 lineOBJ[240];extern u32 lineOBJWin[240];extern u32 lineMix[240];extern bool gfxInWin0[240];extern bool gfxInWin1[240];extern int gfxBG2Changed;extern int gfxBG3Changed;extern int gfxBG2X;extern int gfxBG2Y;extern int gfxBG2LastX;extern int gfxBG2LastY;extern int gfxBG3X;extern int gfxBG3Y;extern int gfxBG3LastX;extern int gfxBG3LastY;extern int gfxLastVCOUNT;inline void gfxClearArray(u32 *array){  for(int i = 0; i < 240; i++) {    *array++ = 0x80000000;  }}inline void gfxDrawTextScreen(u16 control, u16 hofs, u16 vofs,                              u32 *line){  u16 *palette = (u16 *)paletteRAM;  u8 *charBase = &vram[((control >> 2) & 0x03) * 0x4000];  u16 *screenBase = (u16 *)&vram[((control >> 8) & 0x1f) * 0x800];  u32 prio = ((control & 3)<<25) + 0x1000000;  int sizeX = 256;  int sizeY = 256;  switch((control >> 14) & 3) {  case 0:    break;  case 1:    sizeX = 512;    break;  case 2:    sizeY = 512;    break;  case 3:    sizeX = 512;    sizeY = 512;    break;  }  int maskX = sizeX-1;  int maskY = sizeY-1;    bool mosaicOn = (control & 0x40) ? true : false;  int xxx = hofs & maskX;  int yyy = (vofs + VCOUNT) & maskY;  int mosaicX = (MOSAIC & 0x000F)+1;  int mosaicY = ((MOSAIC & 0x00F0)>>4)+1;  if(mosaicOn) {    if((VCOUNT % mosaicY) != 0) {      mosaicY = (VCOUNT / mosaicY) * mosaicY;      yyy = (vofs + mosaicY) & maskY;    }  }  if(yyy > 255 && sizeY > 256) {    yyy &= 255;    screenBase += 0x400;    if(sizeX > 256)      screenBase += 0x400;  }    int yshift = ((yyy>>3)<<5);  if((control) & 0x80) {    u16 *screenSource = screenBase + 0x400 * (xxx>>8) + ((xxx & 255)>>3) + yshift;    for(int x = 0; x < 240; x++) {      u16 data = READ16LE(screenSource);            int tile = data & 0x3FF;      int tileX = (xxx & 7);      int tileY = yyy & 7;            if(data & 0x0400)        tileX = 7 - tileX;      if(data & 0x0800)        tileY = 7 - tileY;            u8 color = charBase[tile * 64 + tileY * 8 + tileX];            line[x] = color ? (READ16LE(&palette[color]) | prio): 0x80000000;            if(data & 0x0400) {        if(tileX == 0)          screenSource++;      } else if(tileX == 7)        screenSource++;      xxx++;      if(xxx == 256) {        if(sizeX > 256)          screenSource = screenBase + 0x400 + yshift;        else {          screenSource = screenBase + yshift;          xxx = 0;        }      } else if(xxx >= sizeX) {        xxx = 0;        screenSource = screenBase + yshift;      }    }  } else {    u16 *screenSource = screenBase + 0x400*(xxx>>8)+((xxx&255)>>3) +      yshift;    for(int x = 0; x < 240; x++) {      u16 data = READ16LE(screenSource);              int tile = data & 0x3FF;      int tileX = (xxx & 7);      int tileY = yyy & 7;      if(data & 0x0400)        tileX = 7 - tileX;      if(data & 0x0800)        tileY = 7 - tileY;      u8 color = charBase[(tile<<5) + (tileY<<2) + (tileX>>1)];      if(tileX & 1) {        color = (color >> 4);      } else {        color &= 0x0F;      }            int pal = (READ16LE(screenSource)>>8) & 0xF0;      line[x] = color ? (READ16LE(&palette[pal + color])|prio): 0x80000000;      if(data & 0x0400) {        if(tileX == 0)          screenSource++;      } else if(tileX == 7)        screenSource++;      xxx++;      if(xxx == 256) {        if(sizeX > 256)          screenSource = screenBase + 0x400 + yshift;        else {          screenSource = screenBase + yshift;          xxx = 0;        }      } else if(xxx >= sizeX) {        xxx = 0;        screenSource = screenBase + yshift;      }    }  }  if(mosaicOn) {    if(mosaicX > 1) {      int m = 1;      for(int i = 0; i < 239; i++) {        line[i+1] = line[i];        m++;        if(m == mosaicX) {          m = 1;          i++;        }      }    }  }}