Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Commit 4efedcf

Browse files
committed
Added preliminary logging support
-L parameter for 86Box.exe is now implemented, still needs to include a logfile path as well. Minor code fixes and enhancements.
1 parent a5acfd4 commit 4efedcf

File tree

4 files changed

+88
-66
lines changed

4 files changed

+88
-66
lines changed

86BoxManager/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333

34-
[assembly: AssemblyVersion("1.4.3.0")]
35-
[assembly: AssemblyFileVersion("1.4.3.0")]
34+
[assembly: AssemblyVersion("1.5.0.0")]
35+
[assembly: AssemblyFileVersion("1.5.0.0")]

86BoxManager/dlgSettings.Designer.cs

Lines changed: 63 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

86BoxManager/dlgSettings.cs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ private void SaveSettings()
130130
regkey.SetValue("MinimizeToTray", cbxMinimizeTray.Checked, RegistryValueKind.DWord);
131131
regkey.SetValue("CloseToTray", cbxCloseTray.Checked, RegistryValueKind.DWord);
132132
regkey.SetValue("LaunchTimeout", int.Parse(txtLaunchTimeout.Text), RegistryValueKind.DWord);
133+
regkey.SetValue("EnableLogging", cbxLogging.Checked, RegistryValueKind.DWord);
133134
regkey.Close();
134135

135136
settingsChanged = CheckForChanges();
@@ -170,6 +171,7 @@ private void LoadSettings()
170171
cbxShowConsole.Checked = true;
171172
cbxMinimizeTray.Checked = false;
172173
cbxCloseTray.Checked = false;
174+
cbxLogging.Checked = false;
173175
txtLaunchTimeout.Text = "5000";
174176

175177
SaveSettings(); //This will write the default values to the registry
@@ -182,6 +184,7 @@ private void LoadSettings()
182184
cbxShowConsole.Checked = Convert.ToBoolean(regkey.GetValue("ShowConsole"));
183185
cbxMinimizeTray.Checked = Convert.ToBoolean(regkey.GetValue("MinimizeToTray"));
184186
cbxCloseTray.Checked = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
187+
cbxLogging.Checked = Convert.ToBoolean(regkey.GetValue("EnableLogging"));
185188
txtLaunchTimeout.Text = Convert.ToString(regkey.GetValue("LaunchTimeout"));
186189
}
187190

@@ -195,6 +198,7 @@ private void LoadSettings()
195198
cbxShowConsole.Checked = true;
196199
cbxMinimizeTray.Checked = false;
197200
cbxCloseTray.Checked = false;
201+
cbxLogging.Checked = false;
198202
txtLaunchTimeout.Text = "5000";
199203
}
200204
}
@@ -235,16 +239,6 @@ private void btnBrowse2_Click(object sender, EventArgs e)
235239
}
236240
}
237241

238-
private void cbxMinimize_CheckedChanged(object sender, EventArgs e)
239-
{
240-
settingsChanged = CheckForChanges();
241-
}
242-
243-
private void cbxShowConsole_CheckedChanged(object sender, EventArgs e)
244-
{
245-
settingsChanged = CheckForChanges();
246-
}
247-
248242
private void btnDefaults_Click(object sender, EventArgs e)
249243
{
250244
DialogResult result = MessageBox.Show("All settings will be reset to their default values. Do you wish to continue?", "Settings will be reset", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
@@ -272,22 +266,13 @@ private void ResetSettings()
272266
cbxShowConsole.Checked = true;
273267
cbxMinimizeTray.Checked = false;
274268
cbxCloseTray.Checked = false;
269+
cbxLogging.Checked = false;
275270
txtLaunchTimeout.Text = "5000";
276271

277272
SaveSettings();
278273
regkey.Close();
279274
}
280275

281-
private void cbxCloseTray_CheckedChanged(object sender, EventArgs e)
282-
{
283-
settingsChanged = CheckForChanges();
284-
}
285-
286-
private void cbxMinimizeTray_CheckedChanged(object sender, EventArgs e)
287-
{
288-
settingsChanged = CheckForChanges();
289-
}
290-
291276
//Checks if all controls match the currently saved settings to determine if any changes were made
292277
private bool CheckForChanges()
293278
{
@@ -301,7 +286,8 @@ private bool CheckForChanges()
301286
cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) ||
302287
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
303288
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")) ||
304-
txtLaunchTimeout.Text != Convert.ToString(regkey.GetValue("LaunchTimeout")));
289+
txtLaunchTimeout.Text != Convert.ToString(regkey.GetValue("LaunchTimeout")) ||
290+
cbxLogging.Checked != Convert.ToBoolean(regkey.GetValue("EnableLogging")));
305291

306292
return btnApply.Enabled;
307293
}
@@ -314,5 +300,10 @@ private bool CheckForChanges()
314300
regkey.Close();
315301
}
316302
}
303+
304+
private void cbx_CheckedChanged(object sender, EventArgs e)
305+
{
306+
settingsChanged = CheckForChanges();
307+
}
317308
}
318309
}

86BoxManager/frmMain.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
using System;
2-
using System.Windows.Forms;
3-
using System.Diagnostics;
4-
using System.Runtime.InteropServices;
1+
using IWshRuntimeLibrary;
52
using Microsoft.Win32;
3+
using System;
64
using System.ComponentModel;
5+
using System.Diagnostics;
76
using System.IO;
7+
using System.Runtime.InteropServices;
88
using System.Runtime.Serialization.Formatters.Binary;
9-
using IWshRuntimeLibrary;
10-
using System.Collections.Generic;
119
using System.Threading;
10+
using System.Windows.Forms;
1211

1312
namespace _86boxManager
1413
{
@@ -41,6 +40,7 @@ public struct COPYDATASTRUCT
4140
private const string ZEROID = "0000000000000000"; //Used for the id parameter of 86Box -H
4241
private int sortColumn = -1; //For column sorting's asc/desc capability
4342
private int launchTimeout = 5000; //Timeout for waiting for 86Box.exe to initialize
43+
private bool logging = false; //Logging enabled for 86Box.exe (-L parameter)?
4444

4545
public frmMain()
4646
{
@@ -126,7 +126,6 @@ private void lstVMs_SelectedIndexChanged(object sender, EventArgs e)
126126
VM vm = (VM)lstVMs.SelectedItems[0].Tag;
127127
if (vm.Status == VM.STATUS_RUNNING)
128128
{
129-
//btnConfigure.Enabled = false;
130129
btnStart.Enabled = true;
131130
btnStart.Text = "Stop";
132131
toolTip.SetToolTip(btnStart, "Stop this virtual machine");
@@ -415,7 +414,6 @@ private void cmsVM_Opening(object sender, CancelEventArgs e)
415414
//Closing 86Box Manager before closing all the VMs can lead to weirdness if 86Box Manager is then restarted. So let's warn the user just in case and request confirmation.
416415
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
417416
{
418-
//List<ListViewItem> vms = new List<ListViewItem>();
419417
int vmCount = 0;
420418
if (e.CloseReason == CloseReason.UserClosing && closeTray)
421419
{
@@ -478,7 +476,6 @@ private void VMPause()
478476
{
479477
VM vm = (VM)lstVMs.SelectedItems[0].Tag;
480478
PostMessage(vm.hWnd, 0x8890, IntPtr.Zero, IntPtr.Zero);
481-
vm.Status = VM.STATUS_PAUSED;
482479
lstVMs.SelectedItems[0].SubItems[1].Text = vm.GetStatusString();
483480
lstVMs.SelectedItems[0].ImageIndex = 2;
484481
pauseToolStripMenuItem.Text = "Resume";
@@ -514,6 +511,10 @@ private void VMStart()
514511
Process p = new Process();
515512
p.StartInfo.FileName = exepath + "86Box.exe";
516513
p.StartInfo.Arguments = "-P \"" + lstVMs.SelectedItems[0].SubItems[2].Text + "\" -H " + ZEROID + "," + hWndHex;
514+
if (logging)
515+
{
516+
p.StartInfo.Arguments += " -L";
517+
}
517518
if (!showConsole)
518519
{
519520
p.StartInfo.RedirectStandardOutput = true;
@@ -522,12 +523,11 @@ private void VMStart()
522523

523524
p.Start();
524525
vm.Pid = p.Id;
525-
bool initSuccess = p.WaitForInputIdle(launchTimeout); //Wait 5 seconds so hWnd can be obtained
526+
bool initSuccess = p.WaitForInputIdle(launchTimeout); //Wait for the specified amount of time so hWnd can be obtained
526527

527528
if (!p.MainWindowHandle.Equals(IntPtr.Zero) && initSuccess)
528529
{
529530
vm.hWnd = p.MainWindowHandle; //Get the window handle of the newly created process
530-
//vm.Pid = p.Id; //Assign the pid to the VM
531531
vm.Status = VM.STATUS_RUNNING;
532532
lstVMs.SelectedItems[0].SubItems[1].Text = vm.GetStatusString();
533533
lstVMs.SelectedItems[0].ImageIndex = 1;

0 commit comments

Comments
 (0)