2014-02-03 05:27:59 +00:00
|
|
|
|
using System;
|
2014-04-15 21:46:18 +00:00
|
|
|
|
using System.IO;
|
2014-02-03 05:27:59 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
using BizHawk.Client.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.EmuHawk.config
|
|
|
|
|
{
|
|
|
|
|
public partial class DisplayConfigLite : Form
|
|
|
|
|
{
|
2015-08-30 13:44:46 +00:00
|
|
|
|
public bool NeedReset;
|
|
|
|
|
|
2014-04-15 21:46:18 +00:00
|
|
|
|
string PathSelection;
|
2015-08-30 13:44:46 +00:00
|
|
|
|
|
2014-02-03 05:27:59 +00:00
|
|
|
|
public DisplayConfigLite()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
rbNone.Checked = Global.Config.TargetDisplayFilter == 0;
|
2014-12-05 00:39:02 +00:00
|
|
|
|
rbHq2x.Checked = Global.Config.TargetDisplayFilter == 1;
|
2014-02-03 05:27:59 +00:00
|
|
|
|
rbScanlines.Checked = Global.Config.TargetDisplayFilter == 2;
|
2014-04-15 21:46:18 +00:00
|
|
|
|
rbUser.Checked = Global.Config.TargetDisplayFilter == 3;
|
|
|
|
|
|
|
|
|
|
PathSelection = Global.Config.DispUserFilterPath ?? "";
|
|
|
|
|
RefreshState();
|
|
|
|
|
|
|
|
|
|
rbFinalFilterNone.Checked = Global.Config.DispFinalFilter == 0;
|
|
|
|
|
rbFinalFilterBilinear.Checked = Global.Config.DispFinalFilter == 1;
|
|
|
|
|
rbFinalFilterBicubic.Checked = Global.Config.DispFinalFilter == 2;
|
|
|
|
|
|
2014-12-05 00:39:02 +00:00
|
|
|
|
tbScanlineIntensity.Value = Global.Config.TargetScanlineFilterIntensity;
|
2014-04-15 21:46:18 +00:00
|
|
|
|
checkLetterbox.Checked = Global.Config.DispFixAspectRatio;
|
|
|
|
|
checkPadInteger.Checked = Global.Config.DispFixScaleInteger;
|
2015-07-24 20:59:53 +00:00
|
|
|
|
cbFullscreenHacks.Checked = Global.Config.DispFullscreenHacks;
|
2014-12-05 00:39:02 +00:00
|
|
|
|
|
2015-08-18 04:26:19 +00:00
|
|
|
|
if (Global.Config.DispSpeedupFeatures == 2) rbDisplayFull.Checked = true;
|
|
|
|
|
if (Global.Config.DispSpeedupFeatures == 1) rbDisplayMinimal.Checked = true;
|
|
|
|
|
if (Global.Config.DispSpeedupFeatures == 0) rbDisplayAbsoluteZero.Checked = true;
|
|
|
|
|
|
2014-12-07 02:26:52 +00:00
|
|
|
|
rbOpenGL.Checked = Global.Config.DispMethod == Config.EDispMethod.OpenGL;
|
|
|
|
|
rbGDIPlus.Checked = Global.Config.DispMethod == Config.EDispMethod.GdiPlus;
|
2014-12-08 02:15:42 +00:00
|
|
|
|
rbD3D9.Checked = Global.Config.DispMethod == Config.EDispMethod.SlimDX9;
|
2014-12-07 02:26:52 +00:00
|
|
|
|
|
2014-12-14 01:43:46 +00:00
|
|
|
|
cbStatusBarWindowed.Checked = Global.Config.DispChrome_StatusBarWindowed;
|
|
|
|
|
cbCaptionWindowed.Checked = Global.Config.DispChrome_CaptionWindowed;
|
|
|
|
|
cbMenuWindowed.Checked = Global.Config.DispChrome_MenuWindowed;
|
|
|
|
|
cbStatusBarFullscreen.Checked = Global.Config.DispChrome_StatusBarFullscreen;
|
|
|
|
|
cbMenuFullscreen.Checked = Global.Config.DispChrome_MenuFullscreen;
|
|
|
|
|
trackbarFrameSizeWindowed.Value = Global.Config.DispChrome_FrameWindowed;
|
2015-07-24 20:59:53 +00:00
|
|
|
|
cbFSAutohideMouse.Checked = Global.Config.DispChrome_Fullscreen_AutohideMouse;
|
2014-12-14 01:43:46 +00:00
|
|
|
|
SyncTrackbar();
|
|
|
|
|
|
2015-09-08 19:03:52 +00:00
|
|
|
|
cbAllowDoubleclickFullscreen.Checked = Global.Config.DispChrome_AllowDoubleClickFullscreen;
|
|
|
|
|
|
2015-07-06 17:31:30 +00:00
|
|
|
|
nudPrescale.Value = Global.Config.DispPrescale;
|
|
|
|
|
|
2014-12-05 00:39:02 +00:00
|
|
|
|
// null emulator config hack
|
|
|
|
|
{
|
|
|
|
|
NullEmulator.NullEmulatorSettings s;
|
|
|
|
|
if (Global.Emulator is NullEmulator)
|
|
|
|
|
s = (Global.Emulator as dynamic).GetSettings();
|
|
|
|
|
else
|
|
|
|
|
s = (NullEmulator.NullEmulatorSettings)Global.Config.GetCoreSettings<NullEmulator>();
|
|
|
|
|
checkSnowyNullEmulator.Checked = s.SnowyDisplay;
|
|
|
|
|
}
|
2014-05-03 02:52:35 +00:00
|
|
|
|
|
2014-09-14 00:51:30 +00:00
|
|
|
|
if (Global.Config.DispManagerAR == Config.EDispManagerAR.None)
|
|
|
|
|
rbUseRaw.Checked = true;
|
|
|
|
|
else if (Global.Config.DispManagerAR == Config.EDispManagerAR.System)
|
|
|
|
|
rbUseSystem.Checked = true;
|
|
|
|
|
else if (Global.Config.DispManagerAR == Config.EDispManagerAR.Custom)
|
|
|
|
|
rbUseCustom.Checked = true;
|
|
|
|
|
|
|
|
|
|
txtCustomARWidth.Text = Global.Config.DispCustomUserARWidth.ToString();
|
|
|
|
|
txtCustomARHeight.Text = Global.Config.DispCustomUserARHeight.ToString();
|
|
|
|
|
|
2014-05-03 02:52:35 +00:00
|
|
|
|
RefreshAspectRatioOptions();
|
2014-02-03 05:27:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-12-05 00:39:02 +00:00
|
|
|
|
if (rbNone.Checked)
|
2014-02-03 05:27:59 +00:00
|
|
|
|
Global.Config.TargetDisplayFilter = 0;
|
|
|
|
|
if (rbHq2x.Checked)
|
|
|
|
|
Global.Config.TargetDisplayFilter = 1;
|
|
|
|
|
if (rbScanlines.Checked)
|
|
|
|
|
Global.Config.TargetDisplayFilter = 2;
|
2014-04-15 21:46:18 +00:00
|
|
|
|
if (rbUser.Checked)
|
|
|
|
|
Global.Config.TargetDisplayFilter = 3;
|
|
|
|
|
|
2014-12-05 00:39:02 +00:00
|
|
|
|
if (rbFinalFilterNone.Checked)
|
2014-04-15 21:46:18 +00:00
|
|
|
|
Global.Config.DispFinalFilter = 0;
|
2014-12-05 00:39:02 +00:00
|
|
|
|
if (rbFinalFilterBilinear.Checked)
|
2014-04-15 21:46:18 +00:00
|
|
|
|
Global.Config.DispFinalFilter = 1;
|
2014-12-05 00:39:02 +00:00
|
|
|
|
if (rbFinalFilterBicubic.Checked)
|
2014-04-15 21:46:18 +00:00
|
|
|
|
Global.Config.DispFinalFilter = 2;
|
2014-02-03 05:27:59 +00:00
|
|
|
|
|
2015-07-06 17:31:30 +00:00
|
|
|
|
Global.Config.DispPrescale = (int)nudPrescale.Value;
|
|
|
|
|
|
2014-02-03 07:01:31 +00:00
|
|
|
|
Global.Config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value;
|
2014-04-30 22:40:16 +00:00
|
|
|
|
Global.Config.DispFixAspectRatio = checkLetterbox.Checked;
|
|
|
|
|
Global.Config.DispFixScaleInteger = checkPadInteger.Checked;
|
2015-07-24 20:59:53 +00:00
|
|
|
|
Global.Config.DispFullscreenHacks = cbFullscreenHacks.Checked;
|
2014-12-05 00:39:02 +00:00
|
|
|
|
|
2014-12-14 01:43:46 +00:00
|
|
|
|
Global.Config.DispChrome_StatusBarWindowed = cbStatusBarWindowed.Checked;
|
|
|
|
|
Global.Config.DispChrome_CaptionWindowed = cbCaptionWindowed.Checked;
|
|
|
|
|
Global.Config.DispChrome_MenuWindowed = cbMenuWindowed.Checked;
|
|
|
|
|
Global.Config.DispChrome_StatusBarFullscreen = cbStatusBarFullscreen.Checked;
|
|
|
|
|
Global.Config.DispChrome_MenuFullscreen = cbMenuFullscreen.Checked;
|
|
|
|
|
Global.Config.DispChrome_FrameWindowed = trackbarFrameSizeWindowed.Value;
|
2015-07-24 20:59:53 +00:00
|
|
|
|
Global.Config.DispChrome_Fullscreen_AutohideMouse = cbFSAutohideMouse.Checked;
|
2015-09-08 19:03:52 +00:00
|
|
|
|
Global.Config.DispChrome_AllowDoubleClickFullscreen = cbAllowDoubleclickFullscreen.Checked;
|
2014-12-14 01:43:46 +00:00
|
|
|
|
|
2015-08-18 04:26:19 +00:00
|
|
|
|
if (rbDisplayFull.Checked) Global.Config.DispSpeedupFeatures = 2;
|
|
|
|
|
if (rbDisplayMinimal.Checked) Global.Config.DispSpeedupFeatures = 1;
|
|
|
|
|
if (rbDisplayAbsoluteZero.Checked) Global.Config.DispSpeedupFeatures = 0;
|
|
|
|
|
|
2014-12-05 00:39:02 +00:00
|
|
|
|
// HACK:: null emulator's settings don't persist to config normally
|
|
|
|
|
{
|
|
|
|
|
NullEmulator.NullEmulatorSettings s;
|
|
|
|
|
if (Global.Emulator is NullEmulator)
|
|
|
|
|
s = (Global.Emulator as dynamic).GetSettings();
|
|
|
|
|
else
|
|
|
|
|
s = (NullEmulator.NullEmulatorSettings)Global.Config.GetCoreSettings<NullEmulator>();
|
|
|
|
|
s.SnowyDisplay = checkSnowyNullEmulator.Checked;
|
|
|
|
|
|
|
|
|
|
Global.Config.PutCoreSettings<NullEmulator>(s);
|
|
|
|
|
if (Global.Emulator is NullEmulator)
|
|
|
|
|
(Global.Emulator as dynamic).PutSettings(s);
|
|
|
|
|
}
|
2014-02-03 05:27:59 +00:00
|
|
|
|
|
2014-09-14 00:51:30 +00:00
|
|
|
|
if (rbUseRaw.Checked)
|
|
|
|
|
Global.Config.DispManagerAR = Config.EDispManagerAR.None;
|
|
|
|
|
else if (rbUseSystem.Checked)
|
|
|
|
|
Global.Config.DispManagerAR = Config.EDispManagerAR.System;
|
|
|
|
|
else if (rbUseCustom.Checked)
|
|
|
|
|
Global.Config.DispManagerAR = Config.EDispManagerAR.Custom;
|
|
|
|
|
|
|
|
|
|
int.TryParse(txtCustomARWidth.Text, out Global.Config.DispCustomUserARWidth);
|
|
|
|
|
int.TryParse(txtCustomARHeight.Text, out Global.Config.DispCustomUserARHeight);
|
|
|
|
|
|
2015-08-30 13:44:46 +00:00
|
|
|
|
var oldDisplayMethod = Global.Config.DispMethod;
|
2014-12-07 02:26:52 +00:00
|
|
|
|
if(rbOpenGL.Checked)
|
|
|
|
|
Global.Config.DispMethod = Config.EDispMethod.OpenGL;
|
|
|
|
|
if(rbGDIPlus.Checked)
|
|
|
|
|
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
|
2014-12-08 02:15:42 +00:00
|
|
|
|
if(rbD3D9.Checked)
|
|
|
|
|
Global.Config.DispMethod = Config.EDispMethod.SlimDX9;
|
2014-12-07 02:26:52 +00:00
|
|
|
|
|
2015-08-30 13:44:46 +00:00
|
|
|
|
if (oldDisplayMethod != Global.Config.DispMethod)
|
|
|
|
|
NeedReset = true;
|
|
|
|
|
|
2014-04-15 21:46:18 +00:00
|
|
|
|
Global.Config.DispUserFilterPath = PathSelection;
|
|
|
|
|
GlobalWin.DisplayManager.RefreshUserShader();
|
|
|
|
|
|
2014-06-29 02:28:48 +00:00
|
|
|
|
DialogResult = DialogResult.OK;
|
2014-02-03 05:27:59 +00:00
|
|
|
|
Close();
|
|
|
|
|
}
|
2014-04-15 21:46:18 +00:00
|
|
|
|
|
|
|
|
|
void RefreshState()
|
|
|
|
|
{
|
|
|
|
|
lblUserFilterName.Text = Path.GetFileNameWithoutExtension(PathSelection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnSelectUserFilter_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var ofd = new OpenFileDialog();
|
|
|
|
|
ofd.Filter = ".CGP (*.cgp)|*.cgp";
|
|
|
|
|
ofd.FileName = PathSelection;
|
2014-06-29 02:28:48 +00:00
|
|
|
|
if (ofd.ShowDialog() == DialogResult.OK)
|
2014-04-15 21:46:18 +00:00
|
|
|
|
{
|
|
|
|
|
rbUser.Checked = true;
|
|
|
|
|
PathSelection = Path.GetFullPath(ofd.FileName);
|
|
|
|
|
RefreshState();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-03 02:52:35 +00:00
|
|
|
|
private void checkLetterbox_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RefreshAspectRatioOptions();
|
|
|
|
|
}
|
|
|
|
|
private void checkPadInteger_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RefreshAspectRatioOptions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rbUseRaw_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RefreshAspectRatioOptions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void rbUseSystem_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
RefreshAspectRatioOptions();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RefreshAspectRatioOptions()
|
|
|
|
|
{
|
|
|
|
|
grpARSelection.Enabled = checkLetterbox.Checked;
|
|
|
|
|
checkPadInteger.Enabled = checkLetterbox.Checked;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-09 16:54:56 +00:00
|
|
|
|
public void tbScanlineIntensity_Scroll(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Global.Config.TargetScanlineFilterIntensity = tbScanlineIntensity.Value;
|
|
|
|
|
int scanlines = Global.Config.TargetScanlineFilterIntensity;
|
|
|
|
|
float percentage = (float) scanlines / 255 * 100;
|
|
|
|
|
if (percentage > 100) percentage = 100;
|
|
|
|
|
lblScanlines.Text = String.Format("{0:F2}", percentage) + "%";
|
|
|
|
|
}
|
2014-05-03 02:52:35 +00:00
|
|
|
|
|
2014-12-14 01:43:46 +00:00
|
|
|
|
private void trackbarFrameSizeWindowed_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
SyncTrackbar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SyncTrackbar()
|
|
|
|
|
{
|
|
|
|
|
if (trackbarFrameSizeWindowed.Value == 0)
|
|
|
|
|
lblFrameTypeWindowed.Text = "None";
|
|
|
|
|
if (trackbarFrameSizeWindowed.Value == 1)
|
|
|
|
|
lblFrameTypeWindowed.Text = "Thin";
|
|
|
|
|
if (trackbarFrameSizeWindowed.Value == 2)
|
|
|
|
|
lblFrameTypeWindowed.Text = "Thick";
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-03 05:27:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|