diff --git a/trunk/src/drivers/common/vidblit.cpp b/trunk/src/drivers/common/vidblit.cpp index 037dace2..5ac48938 100644 --- a/trunk/src/drivers/common/vidblit.cpp +++ b/trunk/src/drivers/common/vidblit.cpp @@ -61,19 +61,6 @@ static int silt; static int Bpp; // BYTES per pixel static int highefx; -#define BLUR_RED 20 -#define BLUR_GREEN 20 -#define BLUR_BLUE 10 - -#define FVB_SCANLINES 1 - -/* The blur effect is only available for bpp>=16. It could be easily modified - to look like what happens on the real NES and TV, but lack of decent - synchronization to the vertical retrace period makes it look rather - blah. -*/ -#define FVB_BLUR 2 - static int Round(float value) { return (int) floor(value + 0.5); @@ -208,20 +195,8 @@ int InitBlitToHigh(int b, uint32 rmask, uint32 gmask, uint32 bmask, int efx, int if(Bpp<=1 || Bpp>4) return(0); - if(efx&FVB_BLUR) - { - //if(Bpp==2) - // palettetranslate=(uint32 *)FCEU_dmalloc(65536*4); - //else if(Bpp>=3) - palettetranslate=(uint32 *)FCEU_dmalloc(65536*4); - } - else - { - //if(Bpp==2) - // palettetranslate=(uint32*)FCEU_dmalloc(65536*4); - //else if(Bpp>=3) - palettetranslate=(uint32*)FCEU_dmalloc(256*4 + 512*4); - } + //allocate adequate room for 32bpp palette + palettetranslate=(uint32*)FCEU_dmalloc(256*4 + 512*4); if(!palettetranslate) return(0); @@ -283,102 +258,56 @@ void SetPaletteBlitToHigh(uint8 *src) { int cshiftr[3]; int cshiftl[3]; - int x,y; CalculateShift(CBM, cshiftr, cshiftl); switch(Bpp) { case 2: - if(highefx&FVB_BLUR) + for(int x=0;x<256;x++) { - for(x=0;x<256;x++) - { - uint32 r,g,b; - for(y=0;y<256;y++) - { - r=src[x<<2]*(100-BLUR_RED); - g=src[(x<<2)+1]*(100-BLUR_GREEN); - b=src[(x<<2)+2]*(100-BLUR_BLUE); - - r+=src[y<<2]*BLUR_RED; - g+=src[(y<<2)+1]*BLUR_GREEN; - b+=src[(y<<2)+2]*BLUR_BLUE; - r/=100; - g/=100; - b/=100; - - if(r>255) r=255; - if(g>255) g=255; - if(b>255) b=255; - palettetranslate[x|(y<<8)]= - ((r>>cshiftr[0])<>cshiftr[1])<>cshiftr[2])<>cshiftr[0])<>cshiftr[1])<>cshiftr[2])<>cshiftr[0])<>cshiftr[1])<>cshiftr[2])<>8)<<2)]>>cshiftr[0])<>8)<<2)+1]>>cshiftr[1])<>8)<<2)+2]>>cshiftr[2])<>cshiftr[0])<>cshiftr[1])<>cshiftr[2])<255) r=255; - if(g>255) g=255; - if(b>255) b=255; - - palettetranslate[x|(y<<8)]=(r<>1); - do + for(x=xr;x;x--,src++) { - for(x=xr;x;x--,src++) + int too=xscale; + do { - int too=xscale; - do - { - *(uint8 *)dest=*(uint8 *)src; - dest++; - } while(--too); - } - src-=xr; - dest+=pinc; - } while(--doo); - //src-=xr*(yscale-(yscale>>1)); - dest+=pitch*(yscale>>1); - src+=xr; - } - } - else - { - for(y=yr;y;y--,src+=256-xr) - { - int doo=yscale; - do - { - for(x=xr;x;x--,src++) - { - int too=xscale; - do - { - *(uint8 *)dest=*(uint8 *)src; - dest++; - } while(--too); - } - src-=xr; - dest+=pinc; - } while(--doo); - src+=xr; - } + *(uint8 *)dest=*(uint8 *)src; + dest++; + } while(--too); + } + src-=xr; + dest+=pinc; + } while(--doo); + src+=xr; } } else @@ -802,163 +704,8 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, yscale=1; } - if(highefx&FVB_BLUR) // DONE - {/* - // highefx is hardset to 0 by this function call anyway - if(xscale!=1 || yscale!=1 || (highefx&FVB_SCANLINES)) // DONE - { - switch(Bpp) - { - case 4: - pinc=pitch-((xr*xscale)<<2); - for(y=yr;y;y--,src+=256-xr) - { - int doo=yscale; - - if(highefx&FVB_SCANLINES) - doo-=yscale>>1; - do - { - uint8 last=0x00; - - //if(doo == 1 && google) dest+=4; - for(x=xr;x;x--,src++) - { - int too=xscale; - do - { - *(uint32 *)dest=palettetranslate[*src|(last<<8)]; - dest+=4; - } while(--too); - last=*src; - } - //if(doo == 1 && google) dest-=4; - src-=xr; - dest+=pinc; - } while(--doo); - src+=xr; - if(highefx&FVB_SCANLINES) - dest+=pitch*(yscale>>1); - } - break; - case 3: - pinc=pitch-((xr*xscale)*3); - for(y=yr;y;y--,src+=256-xr) - { - int doo=yscale; - - if(highefx&FVB_SCANLINES) - doo-=yscale>>1; - do - { - uint8 last=0x00; - for(x=xr;x;x--,src++) - { - int too=xscale; - do - { - *(uint32 *)dest=palettetranslate[*src|(last<<8)]; - dest+=3; - } while(--too); - last=*src; - } - src-=xr; - dest+=pinc; - } while(--doo); - src+=xr; - if(highefx&FVB_SCANLINES) - dest+=pitch*(yscale>>1); - } - break; - - case 2: - pinc=pitch-((xr*xscale)<<1); - - for(y=yr;y;y--,src+=256-xr) - { - int doo=yscale; - - if(highefx& FVB_SCANLINES) - doo-=yscale>>1; - do - { - uint8 last=0x00; - for(x=xr;x;x--,src++) - { - int too=xscale; - do - { - *(uint16 *)dest=palettetranslate[*src|(last<<8)]; - dest+=2; - } while(--too); - last=*src; - } - src-=xr; - dest+=pinc; - } while(--doo); - src+=xr; - if(highefx&FVB_SCANLINES) - dest+=pitch*(yscale>>1); - } - break; - } - } - else // No scaling, no scanlines, just blurring. - DONE - switch(Bpp) - { - case 4: - pinc=pitch-(xr<<2); - for(y=yr;y;y--,src+=256-xr) - { - uint8 last=0x00; - for(x=xr;x;x--) - { - *(uint32 *)dest=palettetranslate[*src|(last<<8)]; - last=*src; - dest+=4; - src++; - } - dest+=pinc; - } - break; - case 3: - pinc=pitch-(xr+xr+xr); - for(y=yr;y;y--,src+=256-xr) - { - uint8 last=0x00; - for(x=xr;x;x--) - { - uint32 tmp=palettetranslate[*src|(last<<8)]; - last=*src; - *(uint8 *)dest=tmp; - *((uint8 *)dest+1)=tmp>>8; - *((uint8 *)dest+2)=tmp>>16; - dest+=3; - src++; - } - dest+=pinc; - } - break; - case 2: - pinc=pitch-(xr<<1); - for(y=yr;y;y--,src+=256-xr) - { - uint8 last=0x00; - for(x=xr;x;x--) - { - *(uint16 *)dest=palettetranslate[*src|(last<<8)]; - last=*src; - dest+=2; - src++; - } - dest+=pinc; - } - break; - }*/ - } - else // No blur effects. { - if(xscale!=1 || yscale!=1 || (highefx&FVB_SCANLINES)) + if(xscale!=1 || yscale!=1) { switch(Bpp) { @@ -978,8 +725,6 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, { int doo=yscale; - if(highefx& FVB_SCANLINES) - doo-=yscale>>1; do { for(x=xr;x;x--,src++) @@ -995,8 +740,6 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, dest+=pinc; } while(--doo); src+=xr; - if(highefx&FVB_SCANLINES) - dest+=pitch*(yscale>>1); } } break; @@ -1007,8 +750,6 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, { int doo=yscale; - if(highefx& FVB_SCANLINES) - doo-=yscale>>1; do { for(x=xr;x;x--,src++) @@ -1030,8 +771,6 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, dest+=pinc; } while(--doo); src+=xr; - if(highefx&FVB_SCANLINES) - dest+=pitch*(yscale>>1); } break; @@ -1042,8 +781,6 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, { int doo=yscale; - if(highefx& FVB_SCANLINES) - doo-=yscale>>1; do { for(x=xr;x;x--,src++) @@ -1059,8 +796,6 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, dest+=pinc; } while(--doo); src+=xr; - if(highefx&FVB_SCANLINES) - dest+=pitch*(yscale>>1); } break; } @@ -1088,7 +823,7 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, { for(x=xr;x;x--) { - uint32 tmp=palettetranslate[(uint32)*src]; + uint32 tmp = ModernDeemphColorMap(src); *(uint8 *)dest=tmp; *((uint8 *)dest+1)=tmp>>8; *((uint8 *)dest+2)=tmp>>16; @@ -1100,14 +835,13 @@ void Blit8ToHigh(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, break; case 2: pinc=pitch-(xr<<1); - for(y=yr;y;y--,src+=256-xr) { - for(x=xr>>1;x;x--) + for(x=xr;x;x--) { - *(uint32 *)dest=palettetranslate[*(uint16 *)src]; - dest+=4; - src+=2; + *(uint16 *)dest = ModernDeemphColorMap(src); + dest+=2; + src++; } dest+=pinc; } diff --git a/trunk/src/drivers/common/vidblit.h b/trunk/src/drivers/common/vidblit.h index 94c531cf..577e21fb 100644 --- a/trunk/src/drivers/common/vidblit.h +++ b/trunk/src/drivers/common/vidblit.h @@ -27,3 +27,6 @@ void Blit8To8(uint8 *src, uint8 *dest, int xr, int yr, int pitch, int xscale, in void Blit32to24(uint32 *src, uint8 *dest, int xr, int yr, int dpitch); void Blit32to16(uint32 *src, uint16 *dest, int xr, int yr, int dpitch, int shiftr[3], int shiftl[3]); + + +u32 ModernDeemphColorMap(u8* src); \ No newline at end of file diff --git a/trunk/src/drivers/win/video.cpp b/trunk/src/drivers/win/video.cpp index 9f9a5ce8..f7d670c2 100644 --- a/trunk/src/drivers/win/video.cpp +++ b/trunk/src/drivers/win/video.cpp @@ -375,8 +375,8 @@ int SetVideoMode(int fs) if(!GetBPP()) return 0; - //only 24 and 32bpp are supported now - if(bpp!=24 && bpp!=32) + //only 16,24,32 bpp are supported now + if(bpp!=16 && bpp!=24 && bpp!=32) { //ShowDDErr("Current bit depth not supported!"); FCEU_printf("Current bit depth not supported!\n"); diff --git a/trunk/src/video.cpp b/trunk/src/video.cpp index 8e630196..0a1a7849 100644 --- a/trunk/src/video.cpp +++ b/trunk/src/video.cpp @@ -627,7 +627,6 @@ int SaveSnapshot(void) dest++; for(x=256;x;x--) { - extern u32 ModernDeemphColorMap(u8* src); u32 color = ModernDeemphColorMap(tmp); *dest++=(color>>0x10)&0xFF; *dest++=(color>>0x08)&0xFF;