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

Commit 4145e72

Browse files
committed
Implemented launch timeout setting, fixed an issue with settings changes detection
1 parent b37d0a7 commit 4145e72

File tree

4 files changed

+62
-18
lines changed

4 files changed

+62
-18
lines changed

86BoxManager/dlgAbout.Designer.cs

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

86BoxManager/dlgSettings.Designer.cs

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

86BoxManager/dlgSettings.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System;
1+
using Microsoft.Win32;
2+
using System;
23
using System.Windows.Forms;
3-
using Microsoft.Win32;
44

55
namespace _86boxManager
66
{
@@ -44,25 +44,29 @@ private void btnCancel_Click(object sender, EventArgs e)
4444
private void btnApply_Click(object sender, EventArgs e)
4545
{
4646
SaveSettings();
47-
btnApply.Enabled = false;
47+
settingsChanged = CheckForChanges();
48+
btnApply.Enabled = settingsChanged;
4849
}
4950

5051
private void btnOK_Click(object sender, EventArgs e)
5152
{
52-
SaveSettings();
53+
if (settingsChanged)
54+
{
55+
SaveSettings();
56+
}
5357
Close();
5458
}
5559

5660
private void txt_TextChanged(object sender, EventArgs e)
5761
{
58-
if (string.IsNullOrWhiteSpace(txtEXEdir.Text) || string.IsNullOrWhiteSpace(txtCFGdir.Text))
62+
if (string.IsNullOrWhiteSpace(txtEXEdir.Text) || string.IsNullOrWhiteSpace(txtCFGdir.Text) || string.IsNullOrWhiteSpace(txtLaunchTimeout.Text))
5963
{
60-
btnOK.Enabled = false;
64+
btnApply.Enabled = false;
6165
}
6266
else
6367
{
6468
settingsChanged = CheckForChanges();
65-
btnOK.Enabled = true;
69+
btnApply.Enabled = settingsChanged;
6670
}
6771
}
6872

@@ -87,6 +91,7 @@ private void SaveSettings()
8791
regkey.SetValue("ShowConsole", cbxShowConsole.Checked, RegistryValueKind.DWord);
8892
regkey.SetValue("MinimizeToTray", cbxMinimizeTray.Checked, RegistryValueKind.DWord);
8993
regkey.SetValue("CloseToTray", cbxCloseTray.Checked, RegistryValueKind.DWord);
94+
regkey.SetValue("LaunchTimeout", int.Parse(txtLaunchTimeout.Text), RegistryValueKind.DWord);
9095
regkey.Close();
9196

9297
settingsChanged = CheckForChanges();
@@ -121,6 +126,7 @@ private void LoadSettings()
121126
cbxShowConsole.Checked = true;
122127
cbxMinimizeTray.Checked = false;
123128
cbxCloseTray.Checked = false;
129+
txtLaunchTimeout.Text = "5000";
124130

125131
SaveSettings(); //This will write the default values to the registry
126132
}
@@ -132,18 +138,20 @@ private void LoadSettings()
132138
cbxShowConsole.Checked = Convert.ToBoolean(regkey.GetValue("ShowConsole"));
133139
cbxMinimizeTray.Checked = Convert.ToBoolean(regkey.GetValue("MinimizeToTray"));
134140
cbxCloseTray.Checked = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
141+
txtLaunchTimeout.Text = Convert.ToString(regkey.GetValue("LaunchTimeout"));
135142
}
136143

137144
regkey.Close();
138145
}
139146
catch (Exception ex)
140147
{
141-
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\86Box Virtual Machines";
148+
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\86Box VMs";
142149
txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box";
143150
cbxMinimize.Checked = false;
144151
cbxShowConsole.Checked = true;
145152
cbxMinimizeTray.Checked = false;
146153
cbxCloseTray.Checked = false;
154+
txtLaunchTimeout.Text = "5000";
147155
}
148156
}
149157

@@ -216,6 +224,7 @@ private void ResetSettings()
216224
cbxShowConsole.Checked = true;
217225
cbxMinimizeTray.Checked = false;
218226
cbxCloseTray.Checked = false;
227+
txtLaunchTimeout.Text = "5000";
219228

220229
SaveSettings();
221230
regkey.Close();
@@ -243,7 +252,8 @@ private bool CheckForChanges()
243252
cbxMinimize.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")) ||
244253
cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) ||
245254
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
246-
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")));
255+
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")) ||
256+
txtLaunchTimeout.Text != Convert.ToString(regkey.GetValue("LaunchTimeout")));
247257

248258
return btnApply.Enabled;
249259
}

86BoxManager/frmMain.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public struct COPYDATASTRUCT
4040
private string hWndHex = ""; //Window handle of this window
4141
private const string ZEROID = "0000000000000000"; //Used for the id parameter of 86Box -H
4242
private int sortColumn = -1; //For column sorting's asc/desc capability
43+
private int launchTimeout = 5000; //Timeout for waiting for 86Box.exe to initialize
4344

4445
public frmMain()
4546
{
@@ -205,6 +206,7 @@ private void LoadSettings()
205206
showConsole = Convert.ToBoolean(regkey.GetValue("ShowConsole"));
206207
minimizeTray = Convert.ToBoolean(regkey.GetValue("MinimizeToTray"));
207208
closeTray = Convert.ToBoolean(regkey.GetValue("CloseToTray"));
209+
launchTimeout = int.Parse(regkey.GetValue("LaunchTimeout").ToString());
208210
}
209211
catch (Exception ex)
210212
{
@@ -224,6 +226,7 @@ private void LoadSettings()
224226
showConsole = true;
225227
minimizeTray = false;
226228
closeTray = false;
229+
launchTimeout = 5000;
227230

228231
//Defaults must also be written to the registry
229232
regkey.SetValue("EXEdir", exepath, RegistryValueKind.String);
@@ -232,6 +235,7 @@ private void LoadSettings()
232235
regkey.SetValue("ShowConsole", showConsole, RegistryValueKind.DWord);
233236
regkey.SetValue("MinimizeToTray", minimizeTray, RegistryValueKind.DWord);
234237
regkey.SetValue("CloseToTray", closeTray, RegistryValueKind.DWord);
238+
regkey.SetValue("LaunchTimeout", launchTimeout, RegistryValueKind.DWord);
235239
}
236240
finally
237241
{

0 commit comments

Comments
 (0)