win32: Add RF version of blargg NTSC filter.

Also, add the burst phase to the blit function.
This commit is contained in:
Brandon Wright 2019-09-15 16:03:06 -05:00
parent 1b7cd843e1
commit ca8ca040ad
2 changed files with 27 additions and 3 deletions

View File

@ -52,6 +52,7 @@ void RenderSimple3X (SSurface Src, SSurface Dst, RECT *);
void RenderSimple4X (SSurface Src, SSurface Dst, RECT *);
void RenderTVMode3X (SSurface Src, SSurface Dst, RECT *);
void RenderDotMatrix3X (SSurface Src, SSurface Dst, RECT *);
void RenderBlarggNTSCRF(SSurface Src, SSurface Dst, RECT *);
void RenderBlarggNTSCComposite(SSurface Src, SSurface Dst, RECT *);
void RenderBlarggNTSCSvideo(SSurface Src, SSurface Dst, RECT *);
void RenderBlarggNTSCRgb(SSurface Src, SSurface Dst, RECT *);
@ -80,7 +81,13 @@ START_EXTERN_C
uint8 snes9x_clear_change_log = 0;
END_EXTERN_C
enum BlarggMode { UNINITIALIZED,BLARGGCOMPOSITE,BLARGGSVIDEO,BLARGGRGB };
enum BlarggMode {
UNINITIALIZED,
BLARGGRF,
BLARGGCOMPOSITE,
BLARGGSVIDEO,
BLARGGRGB
};
snes_ntsc_t *ntsc = NULL;
BlarggMode blarggMode = UNINITIALIZED;
@ -138,6 +145,7 @@ TRenderMethod FilterToMethod(RenderFilter filterID)
case FILTER_LQ3XBOLD: return RenderLQ3XB;
case FILTER_EPX3: return RenderEPX3;
case FILTER_3XBRZ: return Render3xBRZ;
case FILTER_BLARGGRF: return RenderBlarggNTSCRF;
case FILTER_BLARGGCOMP: return RenderBlarggNTSCComposite;
case FILTER_BLARGGSVID: return RenderBlarggNTSCSvideo;
case FILTER_BLARGGRGB: return RenderBlarggNTSCRgb;
@ -2696,6 +2704,17 @@ void RenderxBRZ(SSurface Src, SSurface Dst, RECT* rect, int scalingFactor)
}
/*#################### /XBRZ support ####################*/
void RenderBlarggNTSCRF( SSurface Src, SSurface Dst, RECT *rect)
{
if(blarggMode!=BLARGGRF) {
snes_ntsc_setup_t setup = snes_ntsc_composite;
setup.merge_fields = 0;
snes_ntsc_init( ntsc, &setup );
blarggMode=BLARGGRF;
}
RenderBlarggNTSC(Src,Dst,rect);
}
void RenderBlarggNTSCComposite( SSurface Src, SSurface Dst, RECT *rect)
{
if(blarggMode!=BLARGGCOMPOSITE) {
@ -2734,6 +2753,8 @@ extern unsigned short snes_ntsc_scanline_mask;
void RenderBlarggNTSC(SSurface Src, SSurface Dst, RECT *rect)
{
static int burst_phase = 0;
SetRect(rect, 256, 239, 2);
rect->right = SNES_NTSC_OUT_WIDTH(256);
@ -2748,8 +2769,10 @@ void RenderBlarggNTSC(SSurface Src, SSurface Dst, RECT *rect)
snes_ntsc_scanline_mask = 0x18E3;
}
burst_phase = (burst_phase + 1) % 3;
if (Src.Width == 512)
snes_ntsc_blit_hires_scanlines(ntsc, (unsigned short *)Src.Surface, srcRowPixels, 0, Src.Width, Src.Height, Dst.Surface, Dst.Pitch);
snes_ntsc_blit_hires_scanlines(ntsc, (unsigned short *)Src.Surface, srcRowPixels, burst_phase, Src.Width, Src.Height, Dst.Surface, Dst.Pitch);
else
snes_ntsc_blit_scanlines(ntsc, (unsigned short *)Src.Surface, srcRowPixels, 0, Src.Width, Src.Height, Dst.Surface, Dst.Pitch);
snes_ntsc_blit_scanlines(ntsc, (unsigned short *)Src.Surface, srcRowPixels, burst_phase, Src.Width, Src.Height, Dst.Surface, Dst.Pitch);
}

View File

@ -65,6 +65,7 @@ enum RenderFilter{
FILTER_SIMPLE2X,
FILTER_SCANLINES,
FILTER_TVMODE,
FILTER_BLARGGRF,
FILTER_BLARGGCOMP,
FILTER_BLARGGSVID,
FILTER_BLARGGRGB,