Nice, i added it to my graphics lib, looks just like 32 bit. but the colors in my images that had black or white got overflowed, so i enaable Color Clamp(reg: COLCLAMP ) and it looks PERFECT!!!!.
you just saved me about 50% of memory in the GS.
Code: Select all
void sGsEnableDithering(unsigned char enable, int mode)
{
sGS_R_DIMX *dithermatrix;
sGS_R_DTHE *dither;
sGS_R_COLCLAMP *cc;
sgs_setPRIMTAG(((sGS_PRIMTAG *)&send_buf[0]), 3,1,0,0,0,0,1,0x0e);
dithermatrix = ((sGS_R_DIMX *)&send_buf[1]);
dither = ((sGS_R_DTHE *)&send_buf[2]);
cc = ((sGS_R_DTHE *)&send_buf[3]);
if(enable)
{
sgs_setR_DTHE(dither, 1);
// thanks to:"Maximus32" on ps2dev.org for matrix code
sgs_setR_DIMX(dithermatrix, 4,2,5,3,0,6,1,7,5,3,4,2,1,7,0,6);
sgs_setR_COLCLAMP(cc, 1);
}
else
{
sgs_setR_DTHE(dither, 0);
sgs_setR_DIMX(dithermatrix, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
}
sFlushCache(0);
gs_dma_send((unsigned int *)&send_buf[0],1+3);
gs_dma_wait();
}