win32: Allow disabling of NTSC Filter Scanlines.

This commit is contained in:
Brandon Wright 2018-06-16 16:35:56 -05:00
parent 5fd4265440
commit c28a86dfd0
6 changed files with 34 additions and 15 deletions

View File

@ -2931,6 +2931,10 @@ void RenderBlarggNTSC( SSurface Src, SSurface Dst, RECT *rect)
//Blargg's filter produces half-height output, so we have to double the height again (unless we have double height hi-res) //Blargg's filter produces half-height output, so we have to double the height again (unless we have double height hi-res)
if(Src.Height <= SNES_HEIGHT_EXTENDED) if(Src.Height <= SNES_HEIGHT_EXTENDED)
{ {
int mask = 0;
if (GUI.NTSCScanlines)
mask = 0x18E3;
int last_blargg_line = rect->bottom / 2; int last_blargg_line = rect->bottom / 2;
memset(Dst.Surface + last_blargg_line * Dst.Pitch, 0, Dst.Pitch); memset(Dst.Surface + last_blargg_line * Dst.Pitch, 0, Dst.Pitch);
for(int y = last_blargg_line; --y >= 0; ) for(int y = last_blargg_line; --y >= 0; )
@ -2945,7 +2949,7 @@ void RenderBlarggNTSC( SSurface Src, SSurface Dst, RECT *rect)
unsigned mixed = prev + next + ((prev ^ next) & 0x0821); unsigned mixed = prev + next + ((prev ^ next) & 0x0821);
/* darken by 12% */ /* darken by 12% */
*(unsigned short*)out = prev; *(unsigned short*)out = prev;
*(unsigned short*)(out + Dst.Pitch) = (mixed >> 1) - (mixed >> 4 & 0x18E3); *(unsigned short*)(out + Dst.Pitch) = (mixed >> 1) - (mixed >> 4 & mask);
in += 2; in += 2;
out += 2; out += 2;
} }

View File

@ -340,6 +340,7 @@
#define IDC_PLAYWARN 1257 #define IDC_PLAYWARN 1257
#define IDC_REDUCEINPUTLAG 1258 #define IDC_REDUCEINPUTLAG 1258
#define IDC_INTEGERSCALING 1259 #define IDC_INTEGERSCALING 1259
#define IDC_NTSCSCANLINES 1260
#define IDC_HOTKEY1 2000 #define IDC_HOTKEY1 2000
#define IDC_HOTKEY2 2001 #define IDC_HOTKEY2 2001
#define IDC_HOTKEY3 2002 #define IDC_HOTKEY3 2002

View File

@ -190,9 +190,10 @@ BEGIN
CONTROL "",IDC_SPIN_MAX_SKIP_DISP_FIXED,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,169,158,11,13 CONTROL "",IDC_SPIN_MAX_SKIP_DISP_FIXED,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,169,158,11,13
COMBOBOX IDC_FILTERBOX,186,17,153,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERBOX,186,17,153,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_FILTERBOX2,217,33,122,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_FILTERBOX2,217,33,122,90,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Resolution",IDC_CURRMODE,187,71,41,8 CONTROL "NTSC Filter Scanlines", IDC_NTSCSCANLINES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 186, 47, 85, 10
COMBOBOX IDC_RESOLUTION,234,69,105,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Resolution",IDC_CURRMODE,187,76,41,8
CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,86,87,10 COMBOBOX IDC_RESOLUTION,234,74,105,95,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable Triple Buffering",IDC_DBLBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,88,87,10
CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,113,153,10 CONTROL "Transparency Effects",IDC_TRANS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,113,153,10
CONTROL "Hi Resolution Support",IDC_HIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,124,85,10 CONTROL "Hi Resolution Support",IDC_HIRES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,124,85,10
CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,111,10 CONTROL "Extend Height of SNES Image",IDC_HEIGHT_EXTEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,187,146,111,10
@ -203,8 +204,8 @@ BEGIN
PUSHBUTTON "...",IDC_SHADER_HLSL_BROWSE,322,206,19,14,WS_DISABLED PUSHBUTTON "...",IDC_SHADER_HLSL_BROWSE,322,206,19,14,WS_DISABLED
GROUPBOX "Frame Skipping:",IDC_STATIC,7,132,167,46,0,WS_EX_TRANSPARENT GROUPBOX "Frame Skipping:",IDC_STATIC,7,132,167,46,0,WS_EX_TRANSPARENT
GROUPBOX "SNES Image",IDC_STATIC,180,103,166,79,0,WS_EX_TRANSPARENT GROUPBOX "SNES Image",IDC_STATIC,180,103,166,79,0,WS_EX_TRANSPARENT
GROUPBOX "Output Image Processing",IDC_STATIC,179,7,166,46,0,WS_EX_TRANSPARENT GROUPBOX "Output Image Processing",IDC_STATIC,179,7,166,53,0,WS_EX_TRANSPARENT
GROUPBOX "Fullscreen Display Settings",IDC_STATIC,179,56,166,44,0,WS_EX_TRANSPARENT GROUPBOX "Fullscreen Display Settings",IDC_STATIC,179,63,166,39,0,WS_EX_TRANSPARENT
LTEXT "Hi Res:",IDC_HIRESLABEL,186,36,31,8 LTEXT "Hi Res:",IDC_HIRESLABEL,186,36,31,8
GROUPBOX "General",IDC_STATIC,7,7,167,123,0,WS_EX_TRANSPARENT GROUPBOX "General",IDC_STATIC,7,7,167,123,0,WS_EX_TRANSPARENT
LTEXT "Max skipped frames:",IDC_STATIC,62,145,67,8 LTEXT "Max skipped frames:",IDC_STATIC,62,145,67,8

View File

@ -901,6 +901,7 @@ void WinRegisterConfigItems()
AddUIntC("FilterType", GUI.Scale, 0, filterString); AddUIntC("FilterType", GUI.Scale, 0, filterString);
AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2); AddUIntC("FilterHiRes", GUI.ScaleHiRes, 0, filterString2);
AddBoolC("BlendHiRes", GUI.BlendHiRes, true, "true to horizontally blend Hi-Res images (better transparency effect on filters that do not account for this)"); AddBoolC("BlendHiRes", GUI.BlendHiRes, true, "true to horizontally blend Hi-Res images (better transparency effect on filters that do not account for this)");
AddBoolC("NTSCScanlines", GUI.NTSCScanlines, true, "true to use scanlines with Blargg's NTSC filters");
AddBoolC("ShaderEnabled", GUI.shaderEnabled, false, "true to use pixel shader (if supported by output method)"); AddBoolC("ShaderEnabled", GUI.shaderEnabled, false, "true to use pixel shader (if supported by output method)");
AddStringC("Direct3D:D3DShader", GUI.D3DshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode (HLSL effect file or CG shader"); AddStringC("Direct3D:D3DShader", GUI.D3DshaderFileName, MAX_PATH, "", "shader filename for Direct3D mode (HLSL effect file or CG shader");
AddStringC("OpenGL:OGLShader", GUI.OGLshaderFileName, MAX_PATH, "", "shader filename for OpenGL mode (bsnes-style XML shader or CG shader)"); AddStringC("OpenGL:OGLShader", GUI.OGLshaderFileName, MAX_PATH, "", "shader filename for OpenGL mode (bsnes-style XML shader or CG shader)");

View File

@ -7401,7 +7401,7 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
// temporary GUI state for restoring after previewing while selecting options // temporary GUI state for restoring after previewing while selecting options
static int prevScale, prevScaleHiRes, prevPPL; static int prevScale, prevScaleHiRes, prevPPL;
static bool prevStretch, prevAspectRatio, prevHeightExtend, prevAutoDisplayMessages, prevBilinearFilter, prevShaderEnabled, prevBlendHires, prevIntegerScaling; static bool prevStretch, prevAspectRatio, prevHeightExtend, prevAutoDisplayMessages, prevBilinearFilter, prevShaderEnabled, prevBlendHires, prevIntegerScaling, prevNTSCScanlines;
static int prevAspectWidth; static int prevAspectWidth;
static OutputMethod prevOutputMethod; static OutputMethod prevOutputMethod;
static TCHAR prevD3DShaderFile[MAX_PATH],prevOGLShaderFile[MAX_PATH]; static TCHAR prevD3DShaderFile[MAX_PATH],prevOGLShaderFile[MAX_PATH];
@ -7436,6 +7436,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0; prevAutoDisplayMessages = Settings.AutoDisplayMessages != 0;
prevShaderEnabled = GUI.shaderEnabled; prevShaderEnabled = GUI.shaderEnabled;
prevBlendHires = GUI.BlendHiRes; prevBlendHires = GUI.BlendHiRes;
prevNTSCScanlines = GUI.NTSCScanlines;
lstrcpy(prevD3DShaderFile, GUI.D3DshaderFileName); lstrcpy(prevD3DShaderFile, GUI.D3DshaderFileName);
lstrcpy(prevOGLShaderFile, GUI.OGLshaderFileName); lstrcpy(prevOGLShaderFile, GUI.OGLshaderFileName);
@ -7449,6 +7451,8 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
SendDlgItemMessage(hDlg, IDC_VSYNC, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_VSYNC, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (GUI.ReduceInputLag) if (GUI.ReduceInputLag)
SendDlgItemMessage(hDlg, IDC_REDUCEINPUTLAG, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SendDlgItemMessage(hDlg, IDC_REDUCEINPUTLAG, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
if (GUI.NTSCScanlines)
SendDlgItemMessage(hDlg, IDC_NTSCSCANLINES, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
SendDlgItemMessage(hDlg, IDC_FRAMERATESKIPSLIDER, TBM_SETRANGE, (WPARAM)true, (LPARAM)MAKELONG(0, 9)); SendDlgItemMessage(hDlg, IDC_FRAMERATESKIPSLIDER, TBM_SETRANGE, (WPARAM)true, (LPARAM)MAKELONG(0, 9));
if (Settings.SkipFrames != AUTO_FRAMERATE) if (Settings.SkipFrames != AUTO_FRAMERATE)
SendDlgItemMessage(hDlg, IDC_FRAMERATESKIPSLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)Settings.SkipFrames); SendDlgItemMessage(hDlg, IDC_FRAMERATESKIPSLIDER, TBM_SETPOS, (WPARAM)true, (LPARAM)Settings.SkipFrames);
@ -7671,6 +7675,12 @@ INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
WinRefreshDisplay(); WinRefreshDisplay();
break; break;
case IDC_NTSCSCANLINES:
GUI.NTSCScanlines = (bool)(IsDlgButtonChecked(hDlg, IDC_NTSCSCANLINES) == BST_CHECKED);
WinDisplayApplyChanges();
WinRefreshDisplay();
break;
case IDC_HIRESBLEND: case IDC_HIRESBLEND:
GUI.BlendHiRes = (bool)(IsDlgButtonChecked(hDlg,IDC_HIRESBLEND)==BST_CHECKED); GUI.BlendHiRes = (bool)(IsDlgButtonChecked(hDlg,IDC_HIRESBLEND)==BST_CHECKED);
WinRefreshDisplay(); WinRefreshDisplay();
@ -7962,6 +7972,7 @@ updateFilterBox2:
GUI.HeightExtend = prevHeightExtend; GUI.HeightExtend = prevHeightExtend;
GUI.shaderEnabled = prevShaderEnabled; GUI.shaderEnabled = prevShaderEnabled;
GUI.BlendHiRes = prevBlendHires; GUI.BlendHiRes = prevBlendHires;
GUI.NTSCScanlines = prevNTSCScanlines;
lstrcpy(GUI.D3DshaderFileName,prevD3DShaderFile); lstrcpy(GUI.D3DshaderFileName,prevD3DShaderFile);
lstrcpy(GUI.OGLshaderFileName,prevOGLShaderFile); lstrcpy(GUI.OGLshaderFileName,prevOGLShaderFile);
} }

View File

@ -359,6 +359,7 @@ struct sGUI {
HACCEL Accelerators; HACCEL Accelerators;
bool NeedDepthConvert; bool NeedDepthConvert;
bool DepthConverted; bool DepthConverted;
bool NTSCScanlines;
bool InactivePause; bool InactivePause;
bool CustomRomOpen; bool CustomRomOpen;