Video: Bilinear Interpolation option

This commit is contained in:
Souryo 2016-05-24 19:45:58 -04:00
parent 6629ad4a59
commit 0cfe0246cf
14 changed files with 128 additions and 52 deletions

View file

@ -28,6 +28,7 @@ uint32_t EmulationSettings::_emulationSpeed = 100;
OverscanDimensions EmulationSettings::_overscan;
VideoFilterType EmulationSettings::_videoFilterType = VideoFilterType::None;
VideoResizeFilter EmulationSettings::_resizeFilter = VideoResizeFilter::NearestNeighbor;
double EmulationSettings::_videoScale = 1;
VideoAspectRatio EmulationSettings::_aspectRatio = VideoAspectRatio::Auto;

View file

@ -73,6 +73,12 @@ enum class VideoFilterType
HdPack = 999
};
enum class VideoResizeFilter
{
NearestNeighbor = 0,
Bilinear = 1
};
enum class VideoAspectRatio
{
Auto = 0,
@ -219,6 +225,7 @@ private:
static VideoFilterType _videoFilterType;
static double _videoScale;
static VideoAspectRatio _aspectRatio;
static VideoResizeFilter _resizeFilter;
static ConsoleType _consoleType;
static ExpansionPortDevice _expansionDevice;
@ -411,6 +418,16 @@ public:
return _videoFilterType;
}
static void SetVideoResizeFilter(VideoResizeFilter videoResizeFilter)
{
_resizeFilter = videoResizeFilter;
}
static VideoResizeFilter GetVideoResizeFilter()
{
return _resizeFilter;
}
static void SetVideoAspectRatio(VideoAspectRatio aspectRatio)
{
if(_aspectRatio != aspectRatio) {

View file

@ -26,7 +26,7 @@ TraceLogger::~TraceLogger()
void TraceLogger::LogStatic(string log)
{
if(_instance) {
_instance->_outputFile << "--- " << log << " ---" << std::endl;
_instance->_outputFile << "--- " << log << " --- Cycle: " << std::to_string(CPU::GetCycleCount()) << std::endl;
}
}
@ -43,5 +43,5 @@ void TraceLogger::Log(DebugState &state, shared_ptr<DisassemblyInfo> disassembly
_outputFile << std::uppercase << std::hex << (short)cpuState.DebugPC << ": " << disassembly << " "
<< "A:" << (short)cpuState.A << " X:" << (short)cpuState.X << " Y:" << (short)cpuState.Y << " P:" << (short)cpuState.PS << " SP:" << (short)cpuState.SP
<< std::dec
<< " CYC:" << (short)ppuState.Cycle << " SL:" << (short)ppuState.Scanline << std::endl;
<< " CYC:" << (short)ppuState.Cycle << " SL:" << (short)ppuState.Scanline << " CPU Cycle:" << cpuState.CycleCount << std::endl;
}

View file

@ -19,6 +19,7 @@ namespace Mesen.GUI.Config
public UInt32 OverscanBottom = 8;
public double VideoScale = 2;
public VideoFilterType VideoFilter = VideoFilterType.None;
public bool UseBilinearInterpolation = false;
public VideoAspectRatio AspectRatio = VideoAspectRatio.Auto;
public bool VerticalSync = false;
public bool UseHdPacks = false;
@ -41,6 +42,7 @@ namespace Mesen.GUI.Config
InteropEmu.SetOverscanDimensions(videoInfo.OverscanLeft, videoInfo.OverscanRight, videoInfo.OverscanTop, videoInfo.OverscanBottom);
InteropEmu.SetVideoFilter(videoInfo.VideoFilter);
InteropEmu.SetVideoResizeFilter(videoInfo.UseBilinearInterpolation ? VideoResizeFilter.Bilinear : VideoResizeFilter.NearestNeighbor);
InteropEmu.SetVideoScale(videoInfo.VideoScale);
InteropEmu.SetVideoAspectRatio(videoInfo.AspectRatio);

View file

@ -39,6 +39,7 @@
<Control ID="mnuVideoFilter">Filtre vidéo</Control>
<Control ID="mnuNoneFilter">Aucun</Control>
<Control ID="mnuNtscFilter">NTSC</Control>
<Control ID="mnuBilinearInterpolation">Utiliser l'interpolation bilinéaire</Control>
<Control ID="mnuAudioConfig">Audio</Control>
<Control ID="mnuInput">Manettes</Control>
<Control ID="mnuRegion">Région</Control>
@ -160,6 +161,7 @@
<Control ID="lblDisplayRatio">Format d'image :</Control>
<Control ID="lblEmuSpeedHint">(0 = Vitesse maximale)</Control>
<Control ID="lblEmulationSpeed">Vitesse d'émulation :</Control>
<Control ID="chkBilinearInterpolation">Utiliser l'interpolation bilinéaire lors du redimensionnement de l'image</Control>
<Control ID="chkShowFps">Afficher le FPS</Control>
<Control ID="chkUseHdPacks">Utiliser les packs haute-définition de HDNes</Control>
<Control ID="tpgOverscan">Overscan</Control>

View file

@ -39,6 +39,7 @@
<Control ID="mnuVideoFilter">画面エフェクト</Control>
<Control ID="mnuNoneFilter">なし</Control>
<Control ID="mnuNtscFilter">NTSC</Control>
<Control ID="mnuBilinearInterpolation">バイリニア補間</Control>
<Control ID="mnuAudioConfig">音声</Control>
<Control ID="mnuInput">コントローラ</Control>
<Control ID="mnuRegion">地域</Control>
@ -156,7 +157,8 @@
<Control ID="tpgGeneral">全般</Control>
<Control ID="lblVideoScale">映像サイズ:</Control>
<Control ID="lblVideoFilter">画面エフェクト:</Control>
<Control ID="chkVerticalSync">垂直同期を有効する</Control>
<Control ID="chkBilinearInterpolation">バイリニア補間を有効にする</Control>
<Control ID="chkVerticalSync">垂直同期を有効にする</Control>
<Control ID="lblDisplayRatio">画面アスペクト:</Control>
<Control ID="lblEmuSpeedHint">(0 = 最高速度)</Control>
<Control ID="lblEmulationSpeed">エミュレーションの速度:</Control>

View file

@ -68,6 +68,7 @@
this.btnResetPalette = new System.Windows.Forms.Button();
this.btnLoadPalFile = new System.Windows.Forms.Button();
this.colorDialog = new System.Windows.Forms.ColorDialog();
this.chkBilinearInterpolation = new System.Windows.Forms.CheckBox();
this.tlpMain.SuspendLayout();
this.flowLayoutPanel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudEmulationSpeed)).BeginInit();
@ -106,20 +107,22 @@
this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpMain.Controls.Add(this.lblVideoScale, 0, 0);
this.tlpMain.Controls.Add(this.lblVideoFilter, 0, 1);
this.tlpMain.Controls.Add(this.chkVerticalSync, 0, 4);
this.tlpMain.Controls.Add(this.chkVerticalSync, 0, 5);
this.tlpMain.Controls.Add(this.cboAspectRatio, 1, 2);
this.tlpMain.Controls.Add(this.lblDisplayRatio, 0, 2);
this.tlpMain.Controls.Add(this.flowLayoutPanel6, 1, 6);
this.tlpMain.Controls.Add(this.lblEmulationSpeed, 0, 6);
this.tlpMain.Controls.Add(this.chkShowFps, 0, 5);
this.tlpMain.Controls.Add(this.flowLayoutPanel7, 0, 3);
this.tlpMain.Controls.Add(this.flowLayoutPanel6, 1, 7);
this.tlpMain.Controls.Add(this.lblEmulationSpeed, 0, 7);
this.tlpMain.Controls.Add(this.chkShowFps, 0, 6);
this.tlpMain.Controls.Add(this.flowLayoutPanel7, 0, 4);
this.tlpMain.Controls.Add(this.nudScale, 1, 0);
this.tlpMain.Controls.Add(this.cboFilter, 1, 1);
this.tlpMain.Controls.Add(this.chkBilinearInterpolation, 0, 3);
this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpMain.Location = new System.Drawing.Point(3, 3);
this.tlpMain.Margin = new System.Windows.Forms.Padding(0);
this.tlpMain.Name = "tlpMain";
this.tlpMain.RowCount = 8;
this.tlpMain.RowCount = 9;
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
@ -128,7 +131,6 @@
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpMain.Size = new System.Drawing.Size(501, 336);
this.tlpMain.TabIndex = 1;
//
@ -157,7 +159,7 @@
this.chkVerticalSync.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.chkVerticalSync.AutoSize = true;
this.tlpMain.SetColumnSpan(this.chkVerticalSync, 2);
this.chkVerticalSync.Location = new System.Drawing.Point(3, 106);
this.chkVerticalSync.Location = new System.Drawing.Point(3, 129);
this.chkVerticalSync.Name = "chkVerticalSync";
this.chkVerticalSync.Size = new System.Drawing.Size(121, 17);
this.chkVerticalSync.TabIndex = 15;
@ -195,7 +197,7 @@
this.flowLayoutPanel6.Controls.Add(this.nudEmulationSpeed);
this.flowLayoutPanel6.Controls.Add(this.lblEmuSpeedHint);
this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel6.Location = new System.Drawing.Point(96, 149);
this.flowLayoutPanel6.Location = new System.Drawing.Point(96, 172);
this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
this.flowLayoutPanel6.Size = new System.Drawing.Size(405, 26);
@ -227,7 +229,7 @@
//
this.lblEmulationSpeed.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblEmulationSpeed.AutoSize = true;
this.lblEmulationSpeed.Location = new System.Drawing.Point(3, 155);
this.lblEmulationSpeed.Location = new System.Drawing.Point(3, 178);
this.lblEmulationSpeed.Name = "lblEmulationSpeed";
this.lblEmulationSpeed.Size = new System.Drawing.Size(90, 13);
this.lblEmulationSpeed.TabIndex = 0;
@ -238,7 +240,7 @@
this.chkShowFps.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.chkShowFps.AutoSize = true;
this.tlpMain.SetColumnSpan(this.chkShowFps, 2);
this.chkShowFps.Location = new System.Drawing.Point(3, 129);
this.chkShowFps.Location = new System.Drawing.Point(3, 152);
this.chkShowFps.Name = "chkShowFps";
this.chkShowFps.Size = new System.Drawing.Size(76, 17);
this.chkShowFps.TabIndex = 9;
@ -251,7 +253,7 @@
this.flowLayoutPanel7.Controls.Add(this.chkUseHdPacks);
this.flowLayoutPanel7.Controls.Add(this.picHdNesTooltip);
this.flowLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel7.Location = new System.Drawing.Point(0, 80);
this.flowLayoutPanel7.Location = new System.Drawing.Point(0, 103);
this.flowLayoutPanel7.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel7.Name = "flowLayoutPanel7";
this.flowLayoutPanel7.Size = new System.Drawing.Size(501, 23);
@ -582,6 +584,18 @@
this.btnLoadPalFile.UseVisualStyleBackColor = true;
this.btnLoadPalFile.Click += new System.EventHandler(this.btnLoadPalFile_Click);
//
// chkBilinearInterpolation
//
this.chkBilinearInterpolation.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.chkBilinearInterpolation.AutoSize = true;
this.tlpMain.SetColumnSpan(this.chkBilinearInterpolation, 2);
this.chkBilinearInterpolation.Location = new System.Drawing.Point(3, 83);
this.chkBilinearInterpolation.Name = "chkBilinearInterpolation";
this.chkBilinearInterpolation.Size = new System.Drawing.Size(206, 17);
this.chkBilinearInterpolation.TabIndex = 22;
this.chkBilinearInterpolation.Text = "Use bilinear interpolation when scaling";
this.chkBilinearInterpolation.UseVisualStyleBackColor = true;
//
// frmVideoConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -675,5 +689,6 @@
private System.Windows.Forms.Button btnLoadPalFile;
private System.Windows.Forms.ColorDialog colorDialog;
private System.Windows.Forms.NumericUpDown nudScale;
private System.Windows.Forms.CheckBox chkBilinearInterpolation;
}
}

View file

@ -25,6 +25,7 @@ namespace Mesen.GUI.Forms.Config
AddBinding("EmulationSpeed", nudEmulationSpeed);
AddBinding("ShowFPS", chkShowFps);
AddBinding("UseBilinearInterpolation", chkBilinearInterpolation);
AddBinding("VerticalSync", chkVerticalSync);
AddBinding("UseHdPacks", chkUseHdPacks);

View file

@ -148,6 +148,8 @@ namespace Mesen.GUI.Forms
this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem19 = new System.Windows.Forms.ToolStripSeparator();
this.mnuBilinearInterpolation = new System.Windows.Forms.ToolStripMenuItem();
this.panelRenderer.SuspendLayout();
this.menuStrip.SuspendLayout();
this.SuspendLayout();
@ -405,7 +407,7 @@ namespace Mesen.GUI.Forms
this.mnuShowFPS});
this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed;
this.mnuEmulationSpeed.Name = "mnuEmulationSpeed";
this.mnuEmulationSpeed.Size = new System.Drawing.Size(135, 22);
this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22);
this.mnuEmulationSpeed.Text = "Speed";
//
// mnuEmuSpeedNormal
@ -504,7 +506,7 @@ namespace Mesen.GUI.Forms
this.mnuFullscreen});
this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen;
this.mnuVideoScale.Name = "mnuVideoScale";
this.mnuVideoScale.Size = new System.Drawing.Size(135, 22);
this.mnuVideoScale.Size = new System.Drawing.Size(152, 22);
this.mnuVideoScale.Text = "Video Size";
//
// mnuScale1x
@ -581,153 +583,155 @@ namespace Mesen.GUI.Forms
this.toolStripMenuItem18,
this.mnu2xSaiFilter,
this.mnuSuper2xSaiFilter,
this.mnuSuperEagleFilter});
this.mnuSuperEagleFilter,
this.toolStripMenuItem19,
this.mnuBilinearInterpolation});
this.mnuVideoFilter.Name = "mnuVideoFilter";
this.mnuVideoFilter.Size = new System.Drawing.Size(135, 22);
this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22);
this.mnuVideoFilter.Text = "Video Filter";
//
// mnuNoneFilter
//
this.mnuNoneFilter.Name = "mnuNoneFilter";
this.mnuNoneFilter.Size = new System.Drawing.Size(132, 22);
this.mnuNoneFilter.Size = new System.Drawing.Size(206, 22);
this.mnuNoneFilter.Text = "None";
this.mnuNoneFilter.Click += new System.EventHandler(this.mnuNoneFilter_Click);
//
// mnuNtscFilter
//
this.mnuNtscFilter.Name = "mnuNtscFilter";
this.mnuNtscFilter.Size = new System.Drawing.Size(132, 22);
this.mnuNtscFilter.Size = new System.Drawing.Size(206, 22);
this.mnuNtscFilter.Text = "NTSC";
this.mnuNtscFilter.Click += new System.EventHandler(this.mnuNtscFilter_Click);
//
// toolStripMenuItem15
//
this.toolStripMenuItem15.Name = "toolStripMenuItem15";
this.toolStripMenuItem15.Size = new System.Drawing.Size(129, 6);
this.toolStripMenuItem15.Size = new System.Drawing.Size(203, 6);
//
// mnuXBRZ2xFilter
//
this.mnuXBRZ2xFilter.Name = "mnuXBRZ2xFilter";
this.mnuXBRZ2xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuXBRZ2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ2xFilter.Text = "xBRZ 2x";
this.mnuXBRZ2xFilter.Click += new System.EventHandler(this.mnuXBRZ2xFilter_Click);
//
// mnuXBRZ3xFilter
//
this.mnuXBRZ3xFilter.Name = "mnuXBRZ3xFilter";
this.mnuXBRZ3xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuXBRZ3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ3xFilter.Text = "xBRZ 3x";
this.mnuXBRZ3xFilter.Click += new System.EventHandler(this.mnuXBRZ3xFilter_Click);
//
// mnuXBRZ4xFilter
//
this.mnuXBRZ4xFilter.Name = "mnuXBRZ4xFilter";
this.mnuXBRZ4xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuXBRZ4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ4xFilter.Text = "xBRZ 4x";
this.mnuXBRZ4xFilter.Click += new System.EventHandler(this.mnuXBRZ4xFilter_Click);
//
// mnuXBRZ5xFilter
//
this.mnuXBRZ5xFilter.Name = "mnuXBRZ5xFilter";
this.mnuXBRZ5xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuXBRZ5xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ5xFilter.Text = "xBRZ 5x";
this.mnuXBRZ5xFilter.Click += new System.EventHandler(this.mnuXBRZ5xFilter_Click);
//
// mnuXBRZ6xFilter
//
this.mnuXBRZ6xFilter.Name = "mnuXBRZ6xFilter";
this.mnuXBRZ6xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuXBRZ6xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuXBRZ6xFilter.Text = "xBRZ 6x";
this.mnuXBRZ6xFilter.Click += new System.EventHandler(this.mnuXBRZ6xFilter_Click);
//
// toolStripMenuItem16
//
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
this.toolStripMenuItem16.Size = new System.Drawing.Size(129, 6);
this.toolStripMenuItem16.Size = new System.Drawing.Size(203, 6);
//
// mnuHQ2xFilter
//
this.mnuHQ2xFilter.Name = "mnuHQ2xFilter";
this.mnuHQ2xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuHQ2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuHQ2xFilter.Text = "HQ 2x";
this.mnuHQ2xFilter.Click += new System.EventHandler(this.mnuHQ2xFilter_Click);
//
// mnuHQ3xFilter
//
this.mnuHQ3xFilter.Name = "mnuHQ3xFilter";
this.mnuHQ3xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuHQ3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuHQ3xFilter.Text = "HQ 3x";
this.mnuHQ3xFilter.Click += new System.EventHandler(this.mnuHQ3xFilter_Click);
//
// mnuHQ4xFilter
//
this.mnuHQ4xFilter.Name = "mnuHQ4xFilter";
this.mnuHQ4xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuHQ4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuHQ4xFilter.Text = "HQ 4x";
this.mnuHQ4xFilter.Click += new System.EventHandler(this.mnuHQ4xFilter_Click);
//
// toolStripMenuItem17
//
this.toolStripMenuItem17.Name = "toolStripMenuItem17";
this.toolStripMenuItem17.Size = new System.Drawing.Size(129, 6);
this.toolStripMenuItem17.Size = new System.Drawing.Size(203, 6);
//
// mnuScale2xFilter
//
this.mnuScale2xFilter.Name = "mnuScale2xFilter";
this.mnuScale2xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuScale2xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuScale2xFilter.Text = "Scale2x";
this.mnuScale2xFilter.Click += new System.EventHandler(this.mnuScale2xFilter_Click);
//
// mnuScale3xFilter
//
this.mnuScale3xFilter.Name = "mnuScale3xFilter";
this.mnuScale3xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuScale3xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuScale3xFilter.Text = "Scale3x";
this.mnuScale3xFilter.Click += new System.EventHandler(this.mnuScale3xFilter_Click);
//
// mnuScale4xFilter
//
this.mnuScale4xFilter.Name = "mnuScale4xFilter";
this.mnuScale4xFilter.Size = new System.Drawing.Size(132, 22);
this.mnuScale4xFilter.Size = new System.Drawing.Size(206, 22);
this.mnuScale4xFilter.Text = "Scale4x";
this.mnuScale4xFilter.Click += new System.EventHandler(this.mnuScale4xFilter_Click);
//
// toolStripMenuItem18
//
this.toolStripMenuItem18.Name = "toolStripMenuItem18";
this.toolStripMenuItem18.Size = new System.Drawing.Size(129, 6);
this.toolStripMenuItem18.Size = new System.Drawing.Size(203, 6);
//
// mnu2xSaiFilter
//
this.mnu2xSaiFilter.Name = "mnu2xSaiFilter";
this.mnu2xSaiFilter.Size = new System.Drawing.Size(132, 22);
this.mnu2xSaiFilter.Size = new System.Drawing.Size(206, 22);
this.mnu2xSaiFilter.Text = "2xSai";
this.mnu2xSaiFilter.Click += new System.EventHandler(this.mnu2xSaiFilter_Click);
//
// mnuSuper2xSaiFilter
//
this.mnuSuper2xSaiFilter.Name = "mnuSuper2xSaiFilter";
this.mnuSuper2xSaiFilter.Size = new System.Drawing.Size(132, 22);
this.mnuSuper2xSaiFilter.Size = new System.Drawing.Size(206, 22);
this.mnuSuper2xSaiFilter.Text = "Super2xSai";
this.mnuSuper2xSaiFilter.Click += new System.EventHandler(this.mnuSuper2xSaiFilter_Click);
//
// mnuSuperEagleFilter
//
this.mnuSuperEagleFilter.Name = "mnuSuperEagleFilter";
this.mnuSuperEagleFilter.Size = new System.Drawing.Size(132, 22);
this.mnuSuperEagleFilter.Size = new System.Drawing.Size(206, 22);
this.mnuSuperEagleFilter.Text = "SuperEagle";
this.mnuSuperEagleFilter.Click += new System.EventHandler(this.mnuSuperEagleFilter_Click);
//
// toolStripMenuItem10
//
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(132, 6);
this.toolStripMenuItem10.Size = new System.Drawing.Size(149, 6);
//
// mnuAudioConfig
//
this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio;
this.mnuAudioConfig.Name = "mnuAudioConfig";
this.mnuAudioConfig.Size = new System.Drawing.Size(135, 22);
this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22);
this.mnuAudioConfig.Text = "Audio";
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
//
@ -735,7 +739,7 @@ namespace Mesen.GUI.Forms
//
this.mnuInput.Image = global::Mesen.GUI.Properties.Resources.Controller;
this.mnuInput.Name = "mnuInput";
this.mnuInput.Size = new System.Drawing.Size(135, 22);
this.mnuInput.Size = new System.Drawing.Size(152, 22);
this.mnuInput.Text = "Input";
this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click);
//
@ -748,7 +752,7 @@ namespace Mesen.GUI.Forms
this.mnuRegionDendy});
this.mnuRegion.Image = global::Mesen.GUI.Properties.Resources.Globe;
this.mnuRegion.Name = "mnuRegion";
this.mnuRegion.Size = new System.Drawing.Size(135, 22);
this.mnuRegion.Size = new System.Drawing.Size(152, 22);
this.mnuRegion.Text = "Region";
//
// mnuRegionAuto
@ -783,20 +787,20 @@ namespace Mesen.GUI.Forms
//
this.mnuVideoConfig.Image = global::Mesen.GUI.Properties.Resources.Video;
this.mnuVideoConfig.Name = "mnuVideoConfig";
this.mnuVideoConfig.Size = new System.Drawing.Size(135, 22);
this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22);
this.mnuVideoConfig.Text = "Video";
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
//
// toolStripMenuItem11
//
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
this.toolStripMenuItem11.Size = new System.Drawing.Size(132, 6);
this.toolStripMenuItem11.Size = new System.Drawing.Size(149, 6);
//
// mnuPreferences
//
this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Cog;
this.mnuPreferences.Name = "mnuPreferences";
this.mnuPreferences.Size = new System.Drawing.Size(135, 22);
this.mnuPreferences.Size = new System.Drawing.Size(152, 22);
this.mnuPreferences.Text = "Preferences";
this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click);
//
@ -1101,6 +1105,19 @@ namespace Mesen.GUI.Forms
this.mnuAbout.Text = "About";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
//
// toolStripMenuItem19
//
this.toolStripMenuItem19.Name = "toolStripMenuItem19";
this.toolStripMenuItem19.Size = new System.Drawing.Size(203, 6);
//
// mnuBilinearInterpolation
//
this.mnuBilinearInterpolation.CheckOnClick = true;
this.mnuBilinearInterpolation.Name = "mnuBilinearInterpolation";
this.mnuBilinearInterpolation.Size = new System.Drawing.Size(206, 22);
this.mnuBilinearInterpolation.Text = "Use Bilinear Interpolation";
this.mnuBilinearInterpolation.Click += new System.EventHandler(this.mnuBilinearInterpolation_Click);
//
// frmMain
//
this.AllowDrop = true;
@ -1244,6 +1261,8 @@ namespace Mesen.GUI.Forms
private System.Windows.Forms.ToolStripMenuItem mnu2xSaiFilter;
private System.Windows.Forms.ToolStripMenuItem mnuSuper2xSaiFilter;
private System.Windows.Forms.ToolStripMenuItem mnuSuperEagleFilter;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem19;
private System.Windows.Forms.ToolStripMenuItem mnuBilinearInterpolation;
}
}

View file

@ -241,6 +241,7 @@ namespace Mesen.GUI.Forms
}
mnuShowFPS.Checked = ConfigManager.Config.VideoInfo.ShowFPS;
mnuBilinearInterpolation.Checked = ConfigManager.Config.VideoInfo.UseBilinearInterpolation;
UpdateEmulationSpeedMenu();
UpdateScaleMenu(ConfigManager.Config.VideoInfo.VideoScale);
UpdateFilterMenu(ConfigManager.Config.VideoInfo.VideoFilter);
@ -1295,5 +1296,12 @@ namespace Mesen.GUI.Forms
VsConfigInfo.ApplyConfig();
}
}
private void mnuBilinearInterpolation_Click(object sender, EventArgs e)
{
ConfigManager.Config.VideoInfo.UseBilinearInterpolation = mnuBilinearInterpolation.Checked;
ConfigManager.Config.ApplyConfig();
ConfigManager.ApplyChanges();
}
}
}

View file

@ -116,6 +116,7 @@ namespace Mesen.GUI
[DllImport(DLLPath)] public static extern void SetVideoScale(double scale);
[DllImport(DLLPath)] public static extern void SetVideoAspectRatio(VideoAspectRatio aspectRatio);
[DllImport(DLLPath)] public static extern void SetVideoFilter(VideoFilterType filter);
[DllImport(DLLPath)] public static extern void SetVideoResizeFilter(VideoResizeFilter filter);
[DllImport(DLLPath)] public static extern void SetRgbPalette(Int32[] palette);
[DllImport(DLLPath, EntryPoint="GetRgbPalette")] private static extern void GetRgbPaletteWrapper(IntPtr paletteBuffer);
@ -650,6 +651,12 @@ namespace Mesen.GUI
SuperEagle = 15
}
public enum VideoResizeFilter
{
NearestNeighbor = 0,
Bilinear = 1
}
public enum VideoAspectRatio
{
Auto = 0,

View file

@ -266,6 +266,7 @@ namespace InteropEmu {
DllExport void __stdcall SetVideoScale(double scale) { EmulationSettings::SetVideoScale(scale); }
DllExport void __stdcall SetVideoAspectRatio(VideoAspectRatio aspectRatio) { EmulationSettings::SetVideoAspectRatio(aspectRatio); }
DllExport void __stdcall SetVideoFilter(VideoFilterType filter) { EmulationSettings::SetVideoFilterType(filter); }
DllExport void __stdcall SetVideoResizeFilter(VideoResizeFilter filter) { EmulationSettings::SetVideoResizeFilter(filter); }
DllExport void __stdcall GetRgbPalette(uint32_t *paletteBuffer) { EmulationSettings::GetRgbPalette(paletteBuffer); }
DllExport void __stdcall SetRgbPalette(uint32_t *paletteBuffer) { EmulationSettings::SetRgbPalette(paletteBuffer); }

View file

@ -39,7 +39,7 @@ namespace NES
ScreenSize screenSize;
VideoDecoder::GetInstance()->GetScreenSize(screenSize, false);
if(_screenHeight != screenSize.Height || _screenWidth != screenSize.Width || _nesFrameHeight != height || _nesFrameWidth != width) {
if(_screenHeight != screenSize.Height || _screenWidth != screenSize.Width || _nesFrameHeight != height || _nesFrameWidth != width || _resizeFilter != EmulationSettings::GetVideoResizeFilter()) {
_frameLock.Acquire();
_nesFrameHeight = height;
_nesFrameWidth = width;
@ -268,10 +268,12 @@ namespace NES
_largeFont.reset(new SpriteFont(_pd3dDevice, L"Resources\\Font.64.spritefont"));
_font.reset(new SpriteFont(_pd3dDevice, L"Resources\\Font.24.spritefont"));
_resizeFilter = EmulationSettings::GetVideoResizeFilter();
//Sample state
D3D11_SAMPLER_DESC samplerDesc;
ZeroMemory(&samplerDesc, sizeof(samplerDesc));
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
samplerDesc.Filter = _resizeFilter == VideoResizeFilter::Bilinear ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
@ -284,10 +286,6 @@ namespace NES
_pd3dDevice->CreateSamplerState(&samplerDesc, &_samplerState);
/*if(!FAILED(CreateDDSTextureFromFile(_pd3dDevice, L"Resources\\Toast.dds", nullptr, &_toastTexture))) {
return S_FALSE;
}*/
return S_OK;
}

View file

@ -3,6 +3,7 @@
#include "stdafx.h"
#include "../Core/IRenderingDevice.h"
#include "../Core/IMessageManager.h"
#include "../Core/EmulationSettings.h"
#include "../Utilities/FolderUtilities.h"
#include "../Utilities/SimpleLock.h"
#include "../Utilities/Timer.h"
@ -36,6 +37,8 @@ namespace NES {
bool _frameChanged = true;
SimpleLock _frameLock;
VideoResizeFilter _resizeFilter = VideoResizeFilter::NearestNeighbor;
Timer _fpsTimer;
uint32_t _lastFrameCount = 0;
uint32_t _renderedFrameCount = 0;