From 81bd846a0cfbf5d69c7621d87a5442a50c1f467a Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 23 May 2014 00:50:19 +0000 Subject: [PATCH] finetune displaymanager sizing to eliminate sidebars from default 2x NES scenario. please check platforms you care about (a2600 mostly) to make sure they havent regressed --- .../DisplayManager/DisplayManager.cs | 13 +++++++++++++ .../DisplayManager/Filters/Gui.cs | 10 +++++++++- BizHawk.Client.EmuHawk/MainForm.Events.cs | 4 +++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs b/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs index 83b3ebcf33..01d025d38b 100644 --- a/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs +++ b/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs @@ -294,6 +294,19 @@ namespace BizHawk.Client.EmuHawk var filterProgram = UpdateSourceInternal(fvp, true, chain_outsize); var size = filterProgram.Filters[filterProgram.Filters.Count - 1].FindOutput().SurfaceFormat.Size; + + //zero 22-may-2014 - added this to combat problem where nes would default to having sidebars + //this would use the actual chain output size. this is undesireable, in the following scenario: + //load a nes game at 2x with system-preferred and integer AR enabled, and there will be sidebars. + //the sidebars were created by this, so we can peek into it and remove the sidebars. + //Only do this if integer fixing is enabled, since only in that case do we have discardable sidebars. + //Otherwise discarding the 'sidebars' would result in cropping image. + //This is getting complicated.. + if (Global.Config.DispFixScaleInteger) + { + var fp = filterProgram["presentation"] as Filters.FinalPresentation; + size = fp.GetContentSize(); + } return size; } diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs index 2e96afb405..94f1bc3ed4 100644 --- a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs +++ b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs @@ -49,9 +49,15 @@ namespace BizHawk.Client.EmuHawk.Filters //this doesnt make sense if (!maintainAspect) maintainInteger = false; - + float widthScale = (float)targetWidth / sourceWidth; float heightScale = (float)targetHeight / sourceHeight; + //zero 22-may-2014 - added this to combat problem where nes would default to having sidebars + if (Global.Config.DispFixScaleInteger) + { + widthScale = (float)targetWidth / textureSize.Width; + heightScale = (float)targetHeight / textureSize.Height; + } if (maintainAspect) { @@ -186,6 +192,8 @@ namespace BizHawk.Client.EmuHawk.Filters LL = new LetterboxingLogic(Global.Config.DispFixAspectRatio, Global.Config.DispFixScaleInteger, OutputSize.Width, OutputSize.Height, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize); } + public Size GetContentSize() { return new Size(LL.vw, LL.vh); } + public override Vector2 UntransformPoint(string channel, Vector2 point) { if (nop) diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index 9af989f125..80e7a333cf 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1854,7 +1854,9 @@ namespace BizHawk.Client.EmuHawk private void DisplayConfigMenuItem_Click(object sender, EventArgs e) { - new config.DisplayConfigLite().ShowDialog(); + var result = new config.DisplayConfigLite().ShowDialog(); + if (result == System.Windows.Forms.DialogResult.OK) + FrameBufferResized(); } private void CoreSelectionContextSubMenu_DropDownOpened(object sender, EventArgs e)