add (odd) resolution warning to choose a/v writer and make 'autodetect' button apply CaptureOSD setting

This commit is contained in:
zeromus 2015-02-17 00:13:19 +00:00
parent f491f76207
commit dbbfda1c85
3 changed files with 79 additions and 21 deletions

View File

@ -41,18 +41,22 @@
this.buttonAuto = new System.Windows.Forms.Button(); this.buttonAuto = new System.Windows.Forms.Button();
this.panelSizeSelect = new System.Windows.Forms.Panel(); this.panelSizeSelect = new System.Windows.Forms.Panel();
this.checkBoxPad = new System.Windows.Forms.CheckBox(); this.checkBoxPad = new System.Windows.Forms.CheckBox();
this.checkBoxASync = new System.Windows.Forms.CheckBox();
this.lblSize = new System.Windows.Forms.Label();
this.numericTextBoxW = new BizHawk.Client.EmuHawk.NumericTextBox(); this.numericTextBoxW = new BizHawk.Client.EmuHawk.NumericTextBox();
this.numericTextBoxH = new BizHawk.Client.EmuHawk.NumericTextBox(); this.numericTextBoxH = new BizHawk.Client.EmuHawk.NumericTextBox();
this.checkBoxASync = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel();
this.lblResolutionWarning = new System.Windows.Forms.Label();
this.tableLayoutPanel4.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout();
this.panelSizeSelect.SuspendLayout(); this.panelSizeSelect.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// checkBoxResize // checkBoxResize
// //
this.checkBoxResize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxResize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.checkBoxResize.AutoSize = true; this.checkBoxResize.AutoSize = true;
this.checkBoxResize.Location = new System.Drawing.Point(347, 12); this.checkBoxResize.Location = new System.Drawing.Point(347, 35);
this.checkBoxResize.Name = "checkBoxResize"; this.checkBoxResize.Name = "checkBoxResize";
this.checkBoxResize.Size = new System.Drawing.Size(88, 17); this.checkBoxResize.Size = new System.Drawing.Size(88, 17);
this.checkBoxResize.TabIndex = 9; this.checkBoxResize.TabIndex = 9;
@ -145,24 +149,24 @@
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 0); this.label4.Location = new System.Drawing.Point(3, 0);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(30, 13); this.label4.Size = new System.Drawing.Size(42, 13);
this.label4.TabIndex = 13; this.label4.TabIndex = 13;
this.label4.Text = "Size:"; this.label4.Text = "Resize:";
// //
// buttonAuto // buttonAuto
// //
this.buttonAuto.Location = new System.Drawing.Point(0, 42); this.buttonAuto.Location = new System.Drawing.Point(89, 42);
this.buttonAuto.Name = "buttonAuto"; this.buttonAuto.Name = "buttonAuto";
this.buttonAuto.Size = new System.Drawing.Size(162, 23); this.buttonAuto.Size = new System.Drawing.Size(70, 34);
this.buttonAuto.TabIndex = 14; this.buttonAuto.TabIndex = 14;
this.buttonAuto.Text = "Autodetect Size"; this.buttonAuto.Text = "/\\ Set As Resize";
this.buttonAuto.UseVisualStyleBackColor = true; this.buttonAuto.UseVisualStyleBackColor = true;
this.buttonAuto.Click += new System.EventHandler(this.buttonAuto_Click); this.buttonAuto.Click += new System.EventHandler(this.buttonAuto_Click);
// //
// panelSizeSelect // panelSizeSelect
// //
this.panelSizeSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panelSizeSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panelSizeSelect.Controls.Add(this.checkBoxPad); this.panelSizeSelect.Controls.Add(this.lblSize);
this.panelSizeSelect.Controls.Add(this.label4); this.panelSizeSelect.Controls.Add(this.label4);
this.panelSizeSelect.Controls.Add(this.buttonAuto); this.panelSizeSelect.Controls.Add(this.buttonAuto);
this.panelSizeSelect.Controls.Add(this.numericTextBoxW); this.panelSizeSelect.Controls.Add(this.numericTextBoxW);
@ -170,19 +174,38 @@
this.panelSizeSelect.Controls.Add(this.label3); this.panelSizeSelect.Controls.Add(this.label3);
this.panelSizeSelect.Location = new System.Drawing.Point(347, 58); this.panelSizeSelect.Location = new System.Drawing.Point(347, 58);
this.panelSizeSelect.Name = "panelSizeSelect"; this.panelSizeSelect.Name = "panelSizeSelect";
this.panelSizeSelect.Size = new System.Drawing.Size(162, 105); this.panelSizeSelect.Size = new System.Drawing.Size(162, 84);
this.panelSizeSelect.TabIndex = 15; this.panelSizeSelect.TabIndex = 15;
// //
// checkBoxPad // checkBoxPad
// //
this.checkBoxPad.AutoSize = true; this.checkBoxPad.AutoSize = true;
this.checkBoxPad.Location = new System.Drawing.Point(0, 71); this.checkBoxPad.Location = new System.Drawing.Point(444, 35);
this.checkBoxPad.Name = "checkBoxPad"; this.checkBoxPad.Name = "checkBoxPad";
this.checkBoxPad.Size = new System.Drawing.Size(45, 17); this.checkBoxPad.Size = new System.Drawing.Size(45, 17);
this.checkBoxPad.TabIndex = 15; this.checkBoxPad.TabIndex = 15;
this.checkBoxPad.Text = "Pad"; this.checkBoxPad.Text = "Pad";
this.checkBoxPad.UseVisualStyleBackColor = true; this.checkBoxPad.UseVisualStyleBackColor = true;
// //
// checkBoxASync
//
this.checkBoxASync.AutoSize = true;
this.checkBoxASync.Location = new System.Drawing.Point(347, 12);
this.checkBoxASync.Name = "checkBoxASync";
this.checkBoxASync.Size = new System.Drawing.Size(95, 17);
this.checkBoxASync.TabIndex = 16;
this.checkBoxASync.Text = "Alternate Sync";
this.checkBoxASync.UseVisualStyleBackColor = true;
//
// lblSize
//
this.lblSize.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblSize.Location = new System.Drawing.Point(3, 42);
this.lblSize.Name = "lblSize";
this.lblSize.Size = new System.Drawing.Size(80, 34);
this.lblSize.TabIndex = 16;
this.lblSize.Text = "Size:\r\nTestxTest";
//
// numericTextBoxW // numericTextBoxW
// //
this.numericTextBoxW.AllowDecimal = false; this.numericTextBoxW.AllowDecimal = false;
@ -203,15 +226,24 @@
this.numericTextBoxH.Size = new System.Drawing.Size(70, 20); this.numericTextBoxH.Size = new System.Drawing.Size(70, 20);
this.numericTextBoxH.TabIndex = 11; this.numericTextBoxH.TabIndex = 11;
// //
// checkBoxASync // panel1
// //
this.checkBoxASync.AutoSize = true; this.panel1.Controls.Add(this.lblResolutionWarning);
this.checkBoxASync.Location = new System.Drawing.Point(347, 35); this.panel1.Location = new System.Drawing.Point(347, 148);
this.checkBoxASync.Name = "checkBoxASync"; this.panel1.Name = "panel1";
this.checkBoxASync.Size = new System.Drawing.Size(95, 17); this.panel1.Size = new System.Drawing.Size(162, 93);
this.checkBoxASync.TabIndex = 16; this.panel1.TabIndex = 17;
this.checkBoxASync.Text = "Alternate Sync"; //
this.checkBoxASync.UseVisualStyleBackColor = true; // lblResolutionWarning
//
this.lblResolutionWarning.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblResolutionWarning.Location = new System.Drawing.Point(4, 4);
this.lblResolutionWarning.Name = "lblResolutionWarning";
this.lblResolutionWarning.Size = new System.Drawing.Size(155, 98);
this.lblResolutionWarning.TabIndex = 0;
this.lblResolutionWarning.Text = "Resolution is not a multiple of 4! Odd or non-x4 resolutions breaks many codecs. " +
"Check your output carefully and adjust the window size or codec settings if need" +
"ed.";
// //
// VideoWriterChooserForm // VideoWriterChooserForm
// //
@ -220,6 +252,8 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel; this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(521, 440); this.ClientSize = new System.Drawing.Size(521, 440);
this.Controls.Add(this.panel1);
this.Controls.Add(this.checkBoxPad);
this.Controls.Add(this.checkBoxASync); this.Controls.Add(this.checkBoxASync);
this.Controls.Add(this.panelSizeSelect); this.Controls.Add(this.panelSizeSelect);
this.Controls.Add(this.tableLayoutPanel4); this.Controls.Add(this.tableLayoutPanel4);
@ -235,6 +269,7 @@
this.tableLayoutPanel4.PerformLayout(); this.tableLayoutPanel4.PerformLayout();
this.panelSizeSelect.ResumeLayout(false); this.panelSizeSelect.ResumeLayout(false);
this.panelSizeSelect.PerformLayout(); this.panelSizeSelect.PerformLayout();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -257,5 +292,8 @@
private System.Windows.Forms.Panel panelSizeSelect; private System.Windows.Forms.Panel panelSizeSelect;
private System.Windows.Forms.CheckBox checkBoxPad; private System.Windows.Forms.CheckBox checkBoxPad;
private System.Windows.Forms.CheckBox checkBoxASync; private System.Windows.Forms.CheckBox checkBoxASync;
private System.Windows.Forms.Label lblSize;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label lblResolutionWarning;
} }
} }

View File

@ -19,8 +19,28 @@ namespace BizHawk.Client.EmuHawk
VideoWriterChooserForm() VideoWriterChooserForm()
{ {
InitializeComponent(); InitializeComponent();
CaptureWidth = Global.Emulator.CoreComm.NominalWidth;
CaptureHeight = Global.Emulator.CoreComm.NominalHeight;
if (Global.Config.AVI_CaptureOSD)
{
using (var bb = GlobalWin.MainForm.CaptureOSD())
{
CaptureWidth = bb.Width;
CaptureHeight = bb.Height;
}
}
lblSize.Text = string.Format("Size:\r\n{0}x{1}", CaptureWidth, CaptureHeight);
if (CaptureWidth % 4 != 0 || CaptureHeight % 4 != 0)
lblResolutionWarning.Visible = true;
else lblResolutionWarning.Visible = false;
} }
int CaptureWidth, CaptureHeight;
/// <summary> /// <summary>
/// chose an IVideoWriter /// chose an IVideoWriter
/// </summary> /// </summary>
@ -100,8 +120,8 @@ namespace BizHawk.Client.EmuHawk
private void buttonAuto_Click(object sender, EventArgs e) private void buttonAuto_Click(object sender, EventArgs e)
{ {
numericTextBoxW.Text = Global.Emulator.CoreComm.NominalWidth.ToString(); numericTextBoxW.Text = CaptureWidth.ToString();
numericTextBoxH.Text = Global.Emulator.CoreComm.NominalHeight.ToString(); numericTextBoxH.Text = CaptureHeight.ToString();
} }
private void buttonOK_Click(object sender, EventArgs e) private void buttonOK_Click(object sender, EventArgs e)

View File

@ -2206,7 +2206,7 @@ namespace BizHawk.Client.EmuHawk
Global.Emulator.HasSavestates(); Global.Emulator.HasSavestates();
} }
private BitmapBuffer CaptureOSD() public BitmapBuffer CaptureOSD()
{ {
var bb = GlobalWin.DisplayManager.RenderOffscreen(Global.Emulator.VideoProvider(), true); var bb = GlobalWin.DisplayManager.RenderOffscreen(Global.Emulator.VideoProvider(), true);
bb.Normalize(true); bb.Normalize(true);