diff --git a/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs b/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs
index 6d6620478c..d68a34e804 100644
--- a/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs
+++ b/BizHawk.Client.EmuHawk/DisplayManager/DisplayManager.cs
@@ -128,6 +128,11 @@ namespace BizHawk.Client.EmuHawk
///
public System.Windows.Forms.Padding GameExtraPadding;
+ ///
+ /// additional pixels added at the native level for the use of lua drawing. essentially just gets tacked onto the final calculated window sizes.
+ ///
+ public System.Windows.Forms.Padding ClientExtraPadding;
+
TextureFrugalizer VideoTextureFrugalizer;
Dictionary LuaSurfaceFrugalizers = new Dictionary();
RenderTargetFrugalizer[] ShaderChainFrugalizers;
@@ -498,6 +503,9 @@ namespace BizHawk.Client.EmuHawk
chain_outsize = new Size(bufferWidth * zoom, bufferHeight * zoom);
}
+ chain_outsize.Width += ClientExtraPadding.Horizontal;
+ chain_outsize.Height += ClientExtraPadding.Vertical;
+
var job = new JobInfo
{
videoProvider = fvp,
@@ -609,6 +617,7 @@ namespace BizHawk.Client.EmuHawk
fPresent.GuiRenderer = Renderer;
fPresent.Config_FixAspectRatio = Global.Config.DispFixAspectRatio;
fPresent.Config_FixScaleInteger = Global.Config.DispFixScaleInteger;
+ fPresent.Padding = ClientExtraPadding;
fPresent.GL = GL;
diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs
index a6a4825917..c143b587f0 100644
--- a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs
+++ b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs
@@ -222,7 +222,11 @@ namespace BizHawk.Client.EmuHawk.Filters
LL.vh = size.Height;
}
else
+ {
LL = new LetterboxingLogic(Config_FixAspectRatio, Config_FixScaleInteger, OutputSize.Width, OutputSize.Height, size.Width, size.Height, TextureSize, VirtualTextureSize);
+ LL.vx += Padding.Left;
+ LL.vy += Padding.Top;
+ }
return size;
}
@@ -254,8 +258,16 @@ namespace BizHawk.Client.EmuHawk.Filters
LL.vw = InputSize.Width;
LL.vh = InputSize.Height;
}
- else
- LL = new LetterboxingLogic(Config_FixAspectRatio, Config_FixScaleInteger, OutputSize.Width, OutputSize.Height, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize);
+ else
+ {
+ int ow = OutputSize.Width;
+ int oh = OutputSize.Height;
+ ow -= Padding.Horizontal;
+ oh -= Padding.Vertical;
+ LL = new LetterboxingLogic(Config_FixAspectRatio, Config_FixScaleInteger, ow, oh, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize);
+ LL.vx += Padding.Left;
+ LL.vy += Padding.Top;
+ }
ContentSize = new Size(LL.vw,LL.vh);
}
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs
index 73967db45e..753a70339b 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs
@@ -161,6 +161,16 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.FrameBufferResized();
}
+ [LuaMethodAttributes(
+ "SetClientExtraPadding",
+ "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements"
+ )]
+ public static void SetClientExtraPadding(int left, int top, int right, int bottom)
+ {
+ GlobalWin.DisplayManager.ClientExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
+ GlobalWin.MainForm.FrameBufferResized();
+ }
+
[LuaMethodAttributes(
"ispaused",
"Returns true if emulator is paused, otherwise, false"