diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
index 58c2bcbbbb..dd99f68b99 100644
--- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj
+++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj
@@ -175,6 +175,12 @@
+
+ Form
+
+
+ JMDForm.cs
+
@@ -305,6 +311,9 @@
Debugger.cs
Designer
+
+ JMDForm.cs
+
MainForm.cs
Designer
diff --git a/BizHawk.MultiClient/IVideoWriter.cs b/BizHawk.MultiClient/IVideoWriter.cs
index c6317a77d3..7d3e8dfdf5 100644
--- a/BizHawk.MultiClient/IVideoWriter.cs
+++ b/BizHawk.MultiClient/IVideoWriter.cs
@@ -39,6 +39,7 @@ namespace BizHawk
///
/// obtain a set of recording compression parameters
+ /// return null on user cancel
///
/// hwnd to attach to if the user is shown config dialog
/// codec token, dispose of it when you're done with it
diff --git a/BizHawk.MultiClient/JMDForm.Designer.cs b/BizHawk.MultiClient/JMDForm.Designer.cs
new file mode 100644
index 0000000000..1220292a8a
--- /dev/null
+++ b/BizHawk.MultiClient/JMDForm.Designer.cs
@@ -0,0 +1,178 @@
+namespace BizHawk.MultiClient
+{
+ partial class JMDForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.okButton = new System.Windows.Forms.Button();
+ this.threadsBar = new System.Windows.Forms.TrackBar();
+ this.compressionBar = new System.Windows.Forms.TrackBar();
+ this.threadLeft = new System.Windows.Forms.Label();
+ this.threadRight = new System.Windows.Forms.Label();
+ this.compressionLeft = new System.Windows.Forms.Label();
+ this.compressionRight = new System.Windows.Forms.Label();
+ this.threadTop = new System.Windows.Forms.Label();
+ this.compressionTop = new System.Windows.Forms.Label();
+ this.cancelButton = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.threadsBar)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.compressionBar)).BeginInit();
+ this.SuspendLayout();
+ //
+ // okButton
+ //
+ this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
+ this.okButton.Location = new System.Drawing.Point(23, 224);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(117, 30);
+ this.okButton.TabIndex = 0;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // threadsBar
+ //
+ this.threadsBar.Location = new System.Drawing.Point(88, 68);
+ this.threadsBar.Name = "threadsBar";
+ this.threadsBar.Size = new System.Drawing.Size(104, 42);
+ this.threadsBar.TabIndex = 5;
+ this.threadsBar.Scroll += new System.EventHandler(this.threadsBar_Scroll);
+ //
+ // compressionBar
+ //
+ this.compressionBar.Location = new System.Drawing.Point(88, 138);
+ this.compressionBar.Name = "compressionBar";
+ this.compressionBar.Size = new System.Drawing.Size(104, 42);
+ this.compressionBar.TabIndex = 9;
+ this.compressionBar.Scroll += new System.EventHandler(this.compressionBar_Scroll);
+ //
+ // threadLeft
+ //
+ this.threadLeft.AutoSize = true;
+ this.threadLeft.Location = new System.Drawing.Point(47, 68);
+ this.threadLeft.Name = "threadLeft";
+ this.threadLeft.Size = new System.Drawing.Size(35, 13);
+ this.threadLeft.TabIndex = 2;
+ this.threadLeft.Text = "label1";
+ //
+ // threadRight
+ //
+ this.threadRight.AutoSize = true;
+ this.threadRight.Location = new System.Drawing.Point(198, 68);
+ this.threadRight.Name = "threadRight";
+ this.threadRight.Size = new System.Drawing.Size(35, 13);
+ this.threadRight.TabIndex = 4;
+ this.threadRight.Text = "label2";
+ //
+ // compressionLeft
+ //
+ this.compressionLeft.AutoSize = true;
+ this.compressionLeft.Location = new System.Drawing.Point(47, 148);
+ this.compressionLeft.Name = "compressionLeft";
+ this.compressionLeft.Size = new System.Drawing.Size(35, 13);
+ this.compressionLeft.TabIndex = 6;
+ this.compressionLeft.Text = "label3";
+ //
+ // compressionRight
+ //
+ this.compressionRight.AutoSize = true;
+ this.compressionRight.Location = new System.Drawing.Point(198, 148);
+ this.compressionRight.Name = "compressionRight";
+ this.compressionRight.Size = new System.Drawing.Size(35, 13);
+ this.compressionRight.TabIndex = 8;
+ this.compressionRight.Text = "label4";
+ //
+ // threadTop
+ //
+ this.threadTop.AutoSize = true;
+ this.threadTop.Location = new System.Drawing.Point(94, 52);
+ this.threadTop.Name = "threadTop";
+ this.threadTop.Size = new System.Drawing.Size(98, 13);
+ this.threadTop.TabIndex = 3;
+ this.threadTop.Text = "Number of Threads";
+ this.threadTop.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
+ // compressionTop
+ //
+ this.compressionTop.AutoSize = true;
+ this.compressionTop.Location = new System.Drawing.Point(96, 122);
+ this.compressionTop.Name = "compressionTop";
+ this.compressionTop.Size = new System.Drawing.Size(96, 13);
+ this.compressionTop.TabIndex = 7;
+ this.compressionTop.Text = "Compression Level";
+ this.compressionTop.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
+ // cancelButton
+ //
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelButton.Location = new System.Drawing.Point(158, 224);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(122, 30);
+ this.cancelButton.TabIndex = 1;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // JMDForm
+ //
+ this.AcceptButton = this.okButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancelButton;
+ this.ClientSize = new System.Drawing.Size(292, 273);
+ this.Controls.Add(this.cancelButton);
+ this.Controls.Add(this.compressionTop);
+ this.Controls.Add(this.threadTop);
+ this.Controls.Add(this.compressionRight);
+ this.Controls.Add(this.compressionLeft);
+ this.Controls.Add(this.threadRight);
+ this.Controls.Add(this.threadLeft);
+ this.Controls.Add(this.compressionBar);
+ this.Controls.Add(this.threadsBar);
+ this.Controls.Add(this.okButton);
+ this.Name = "JMDForm";
+ this.Text = "JMD Compression Options";
+ ((System.ComponentModel.ISupportInitialize)(this.threadsBar)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.compressionBar)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.TrackBar threadsBar;
+ private System.Windows.Forms.TrackBar compressionBar;
+ private System.Windows.Forms.Label threadLeft;
+ private System.Windows.Forms.Label threadRight;
+ private System.Windows.Forms.Label compressionLeft;
+ private System.Windows.Forms.Label compressionRight;
+ private System.Windows.Forms.Label threadTop;
+ private System.Windows.Forms.Label compressionTop;
+ private System.Windows.Forms.Button cancelButton;
+ }
+}
\ No newline at end of file
diff --git a/BizHawk.MultiClient/JMDForm.cs b/BizHawk.MultiClient/JMDForm.cs
new file mode 100644
index 0000000000..86efc90668
--- /dev/null
+++ b/BizHawk.MultiClient/JMDForm.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace BizHawk.MultiClient
+{
+ public partial class JMDForm : Form
+ {
+ public JMDForm()
+ {
+ InitializeComponent();
+ }
+
+ private void okButton_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void threadsBar_Scroll(object sender, EventArgs e)
+ {
+ threadTop.Text = String.Format("Number of compression threads: {0}", threadsBar.Value);
+ }
+
+ private void compressionBar_Scroll(object sender, EventArgs e)
+ {
+ if (compressionBar.Value == compressionBar.Minimum)
+ compressionTop.Text = "Compression Level: NONE";
+ else
+ compressionTop.Text = String.Format("Compression Level: {0}", compressionBar.Value);
+ }
+
+ // we are given a HWND and need a IWin32Window
+ class WindowWrapper : IWin32Window
+ {
+ public WindowWrapper (IntPtr handle)
+ {
+ hwnd = handle;
+ }
+ public IntPtr Handle
+ {
+ get { return hwnd; }
+ }
+ IntPtr hwnd;
+ }
+
+
+ public static bool DoCompressionDlg(ref int threads, ref int complevel, int tmin, int tmax, int cmin, int cmax, IntPtr hwnd)
+ {
+ JMDForm j = new JMDForm();
+ j.threadsBar.Minimum = tmin;
+ j.threadsBar.Maximum = tmax;
+ j.compressionBar.Minimum = cmin;
+ j.compressionBar.Maximum = cmax;
+ j.threadsBar.Value = threads;
+ j.compressionBar.Value = complevel;
+ j.threadsBar_Scroll(null, null);
+ j.compressionBar_Scroll(null, null);
+ j.threadLeft.Text = String.Format("{0}", tmin);
+ j.threadRight.Text = String.Format("{0}", tmax);
+ j.compressionLeft.Text = String.Format("{0}", cmin);
+ j.compressionRight.Text = String.Format("{0}", cmax);
+
+ DialogResult d = j.ShowDialog(new WindowWrapper(hwnd));
+
+ threads = j.threadsBar.Value;
+ complevel = j.compressionBar.Value;
+
+ j.Dispose();
+ if (d == DialogResult.OK)
+ return true;
+ else
+ return false;
+ }
+
+
+ }
+}
diff --git a/BizHawk.MultiClient/JMDForm.resx b/BizHawk.MultiClient/JMDForm.resx
new file mode 100644
index 0000000000..29dcb1b3a3
--- /dev/null
+++ b/BizHawk.MultiClient/JMDForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/BizHawk.MultiClient/JMDWriter.cs b/BizHawk.MultiClient/JMDWriter.cs
index d3d1baa240..d3e1c69e2f 100644
--- a/BizHawk.MultiClient/JMDWriter.cs
+++ b/BizHawk.MultiClient/JMDWriter.cs
@@ -25,13 +25,13 @@ namespace BizHawk.MultiClient
public int compressionlevel
{
get;
- private set;
+ set;
}
public int numthreads
{
get;
- private set;
+ set;
}
public CodecToken()
@@ -134,8 +134,19 @@ namespace BizHawk.MultiClient
/// codec token, dispose of it when you're done with it
public IDisposable AcquireVideoCodecToken(IntPtr hwnd)
{
- // no user interaction for now
- return new CodecToken();
+ CodecToken ret = new CodecToken();
+
+ int t = ret.numthreads;
+ // Deflater.DEFAULT_COMPRESSION is actually a magic value and is not in the range, so guestimate
+ int c = (Deflater.BEST_COMPRESSION + Deflater.NO_COMPRESSION) / 2;
+
+ if (!JMDForm.DoCompressionDlg(ref t, ref c, 1, 6, Deflater.NO_COMPRESSION, Deflater.BEST_COMPRESSION, hwnd))
+ return null;
+
+ ret.numthreads = t;
+ ret.compressionlevel = c;
+
+ return ret;
}
///
diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs
index 0a4b5925c2..3f6a49c586 100644
--- a/BizHawk.MultiClient/MainForm.cs
+++ b/BizHawk.MultiClient/MainForm.cs
@@ -2681,7 +2681,14 @@ namespace BizHawk.MultiClient
aw.SetMovieParameters(fps, 0x01000000);
aw.SetVideoParameters(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight);
aw.SetAudioParameters(44100, 2, 16);
- var token = aw.AcquireVideoCodecToken(Global.MainForm.Handle); //, null);
+ var token = aw.AcquireVideoCodecToken(Global.MainForm.Handle);
+ if (token == null)
+ {
+ Global.OSD.AddMessage("AVI capture canceled.");
+ aw.Dispose();
+ return;
+ }
+
aw.SetVideoCodecToken(token);
aw.OpenFile(sfd.FileName);