u16 c = gbPalette[palette + color]; switch(systemColorDepth) { case 16: gbSgbDraw16Bit(dest + yyy*(256+2) + xxx, c); break; case 24: gbSgbDraw24Bit(dest8 + (yyy*256+xxx)*3, c); break; case 32: gbSgbDraw32Bit(dest32 + yyy*(256+1)+xxx, c); break; }
u16 c = gbPalette[palette + color]; if(!color) c = gbPalette[0]; switch(systemColorDepth) { case 16: gbSgbDraw16Bit(dest + yyy*(256+2) + xxx, c); break; case 24: gbSgbDraw24Bit(dest8 + (yyy*256+xxx)*3, c); break; case 32: gbSgbDraw32Bit(dest32 + yyy*(256+1)+xxx, c); break; }
void gbSgbDrawBorderTile(int x, int y, int tile, int attr){  u16 *dest = (u16*)pix + ((y+1) * (256+2)) + x;  u8 *dest8 = (u8*)pix + ((y*256)+x)*3;  u32 *dest32 = (u32*)pix + ((y+1)*257) + x;    u8 *tileAddress = &gbSgbBorderChar[tile * 32];  u8 *tileAddress2 = &gbSgbBorderChar[tile * 32 + 16];  u8 l = 8;  u8 palette = ((attr >> 2 ) & 7);  if(palette < 4)    palette += 4;  palette *= 16;    u8 xx = 0;  u8 yy = 0;    int flipX = attr & 0x40;  int flipY = attr & 0x80;  while(l > 0) {    u8 mask = 0x80;    u8 a = *tileAddress++;    u8 b = *tileAddress++;    u8 c = *tileAddress2++;    u8 d = *tileAddress2++;        while(mask > 0) {            u8 color = 0;      if(a & mask)        color++;      if(b & mask)        color+=2;      if(c & mask)        color+=4;      if(d & mask)        color+=8;      u8 xxx = xx;      u8 yyy = yy;            if(flipX)        xxx = 7 - xx;      if(flipY)        yyy = 7 - yy;      /*      if(palette == 64 && color == 0) {        switch(colorDepth) {        case 16:          gbSgbDraw16Bit(dest + yyy*(256+1) + xxx, 0x7fff);          break;        case 24:          gbSgbDraw24Bit(dest8 + (yyy*256+xxx)*3, 0x7fff);          break;        case 32:          gbSgbDraw32Bit(dest32 + yyy*256+xxx, 0x7fff);          break;        }        } else {*/        u16 c = gbPalette[palette + color];        switch(systemColorDepth) {        case 16:          gbSgbDraw16Bit(dest + yyy*(256+2) + xxx, c);          break;        case 24:          gbSgbDraw24Bit(dest8 + (yyy*256+xxx)*3, c);          break;        case 32:          gbSgbDraw32Bit(dest32 + yyy*(256+1)+xxx, c);          break;        }        //      }      mask >>= 1;      xx++;    }    yy++;    xx = 0;    l--;    mask = 0x80;  }}