add an option to capture the Lua without capturing the full OSD, when… (#2527)

* add an option to capture the Lua without capturing the full OSD, when recording an AVI

* revert designer changes from commit 146022c not related to the new CaptureLuaMenuItem

* improve code readability
This commit is contained in:
SuuperW 2021-01-15 15:03:46 -06:00 committed by GitHub
parent 889d3262b1
commit f2747b31b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 1 deletions

View File

@ -92,6 +92,7 @@ namespace BizHawk.Client.Common
public bool SkipLagFrame { get; set; }
public bool SuppressAskSave { get; set; }
public bool AviCaptureOsd { get; set; }
public bool AviCaptureLua { get; set; }
public bool ScreenshotCaptureOsd { get; set; }
public bool FirstBoot { get; set; } = true;
public bool UpdateAutoCheckEnabled { get; set; }

View File

@ -546,6 +546,23 @@ namespace BizHawk.Client.EmuHawk
UpdateSourceInternal(job);
return job.OffscreenBb;
}
/// <summary>
/// Does the display process to an offscreen buffer, suitable for a Lua-inclusive movie.
/// </summary>
public BitmapBuffer RenderOffscreenLua(IVideoProvider videoProvider)
{
var job = new JobInfo
{
VideoProvider = videoProvider,
Simulate = false,
ChainOutsize = new Size(videoProvider.BufferWidth, videoProvider.BufferHeight),
Offscreen = true,
IncludeOSD = false,
IncludeUserFilters = false,
};
UpdateSourceInternal(job);
return job.OffscreenBb;
}
private class FakeVideoProvider : IVideoProvider
{

View File

@ -100,6 +100,7 @@ namespace BizHawk.Client.EmuHawk
this.StopAVIMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.toolStripSeparator19 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx();
this.CaptureOSDMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.CaptureLuaMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SynclessRecordingMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.ScreenshotSubMenu = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.ScreenshotMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
@ -829,6 +830,7 @@ namespace BizHawk.Client.EmuHawk
this.StopAVIMenuItem,
this.toolStripSeparator19,
this.CaptureOSDMenuItem,
this.CaptureLuaMenuItem,
this.SynclessRecordingMenuItem});
this.AVSubMenu.Text = "&AVI/WAV";
this.AVSubMenu.DropDownOpened += new System.EventHandler(this.AVSubMenu_DropDownOpened);
@ -850,9 +852,18 @@ namespace BizHawk.Client.EmuHawk
//
// CaptureOSDMenuItem
//
this.CaptureOSDMenuItem.CheckOnClick = true;
this.CaptureOSDMenuItem.Text = "Capture OSD";
this.CaptureOSDMenuItem.Click += new System.EventHandler(this.CaptureOSDMenuItem_Click);
//
// CaptureLuaMenuItem
//
this.CaptureLuaMenuItem.CheckOnClick = true;
this.CaptureLuaMenuItem.Name = "CaptureLuaMenuItem";
this.CaptureLuaMenuItem.Size = new System.Drawing.Size(225, 22);
this.CaptureLuaMenuItem.Text = "Capture Lua";
this.CaptureLuaMenuItem.Click += new System.EventHandler(this.CaptureLuaMenuItem_Click);
//
// SynclessRecordingMenuItem
//
this.SynclessRecordingMenuItem.Text = "S&yncless Recording Tools";
@ -2778,5 +2789,6 @@ namespace BizHawk.Client.EmuHawk
private BizHawk.WinForms.Controls.ToolStripMenuItemEx NdsSyncSettingsMenuItem;
private BizHawk.WinForms.Controls.ToolStripMenuItemEx NdsSettingsMenuItem;
private BizHawk.WinForms.Controls.ToolStripSeparatorEx toolStripSeparator8;
private System.Windows.Forms.ToolStripMenuItem CaptureLuaMenuItem;
}
}

View File

@ -215,6 +215,7 @@ namespace BizHawk.Client.EmuHawk
ConfigAndRecordAVMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Record A/V"].Bindings;
StopAVIMenuItem.ShortcutKeyDisplayString = Config.HotkeyBindings["Stop A/V"].Bindings;
CaptureOSDMenuItem.Checked = Config.AviCaptureOsd;
CaptureLuaMenuItem.Checked = Config.AviCaptureLua || Config.AviCaptureOsd; // or with osd is for better compatibility with old config files
RecordAVMenuItem.Enabled = !string.IsNullOrEmpty(Config.VideoWriter) && _currAviWriter == null;
@ -538,7 +539,18 @@ namespace BizHawk.Client.EmuHawk
private void CaptureOSDMenuItem_Click(object sender, EventArgs e)
{
Config.AviCaptureOsd ^= true;
bool c = ((ToolStripMenuItem)sender).Checked;
Config.AviCaptureOsd = c;
if (c) // Logic to capture OSD w/o Lua does not currently exist, so disallow that.
Config.AviCaptureLua = true;
}
private void CaptureLuaMenuItem_Click(object sender, EventArgs e)
{
bool c = ((ToolStripMenuItem)sender).Checked;
Config.AviCaptureLua = c;
if (!c) // Logic to capture OSD w/o Lua does not currently exist, so disallow that.
Config.AviCaptureOsd = false;
}
private void ScreenshotMenuItem_Click(object sender, EventArgs e)

View File

@ -2510,6 +2510,12 @@ namespace BizHawk.Client.EmuHawk
bb.DiscardAlpha();
return bb;
}
public BitmapBuffer CaptureLua()
{
var bb = DisplayManager.RenderOffscreenLua(_currentVideoProvider);
bb.DiscardAlpha();
return bb;
}
private void IncreaseWindowSize()
{
@ -3422,6 +3428,11 @@ namespace BizHawk.Client.EmuHawk
output = new BitmapBufferVideoProvider(CaptureOSD());
disposableOutput = (IDisposable) output;
}
else if (Config.AviCaptureLua)
{
output = new BitmapBufferVideoProvider(CaptureLua());
disposableOutput = (IDisposable) output;
}
else
{
output = _currentVideoProvider;