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

Commit f76f58a

Browse files
committed
Version 1.5.4
Fixed issue #61 Reworked the settings code a bit again to fix issue #62 Change the error dialog for VM configure when 86Box.exe can't be found from issue #60 Resetting the settings to default values no longer automatically saves them
1 parent 5fa586a commit f76f58a

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
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.5.3.0")]
35-
[assembly: AssemblyFileVersion("1.5.3.0")]
34+
[assembly: AssemblyVersion("1.5.4.0")]
35+
[assembly: AssemblyFileVersion("1.5.4.0")]

86BoxManager/dlgAddVM.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private void btnBrowse_Click(object sender, EventArgs e)
9191

9292
private void cbxImport_CheckedChanged(object sender, EventArgs e)
9393
{
94-
existingVM = true;
94+
existingVM = !existingVM;
9595
txtImportPath.Enabled = cbxImport.Checked;
9696
btnBrowse.Enabled = cbxImport.Checked;
9797
}

86BoxManager/dlgSettings.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.cs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ private void btnCancel_Click(object sender, EventArgs e)
4747

4848
private void btnApply_Click(object sender, EventArgs e)
4949
{
50-
SaveSettings();
50+
bool success = SaveSettings();
51+
if (!success)
52+
{
53+
return;
54+
}
5155
settingsChanged = CheckForChanges();
5256
btnApply.Enabled = settingsChanged;
5357
}
@@ -64,7 +68,7 @@ private void btnOK_Click(object sender, EventArgs e)
6468
private void txt_TextChanged(object sender, EventArgs e)
6569
{
6670
if (string.IsNullOrWhiteSpace(txtEXEdir.Text) || string.IsNullOrWhiteSpace(txtCFGdir.Text) ||
67-
string.IsNullOrWhiteSpace(txtLaunchTimeout.Text) || string.IsNullOrWhiteSpace(txtLogPath.Text))
71+
string.IsNullOrWhiteSpace(txtLaunchTimeout.Text))
6872
{
6973
btnApply.Enabled = false;
7074
}
@@ -106,11 +110,23 @@ private void Get86BoxVersion()
106110

107111
//TODO: Rewrite
108112
//Save the settings to the registry
109-
private void SaveSettings()
113+
private bool SaveSettings()
110114
{
115+
if (cbxLogging.Checked && string.IsNullOrWhiteSpace(txtLogPath.Text))
116+
{
117+
DialogResult result = MessageBox.Show("Using an empty or whitespace string for the log path will prevent 86Box from logging anything. Are you sure you want to use this path?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
118+
if (result == DialogResult.No)
119+
{
120+
return false;
121+
}
122+
}
111123
if (!File.Exists(txtEXEdir.Text + "86Box.exe") && !File.Exists(txtEXEdir.Text + @"\86Box.exe"))
112124
{
113-
MessageBox.Show("86Box.exe could not be found in the directory you specified. Make sure the path is correct or you won't be able to use any virtual machines.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
125+
DialogResult result = MessageBox.Show("86Box.exe could not be found in the directory you specified, so you won't be able to use any virtual machines. Are you sure you want to use this path?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
126+
if (result == DialogResult.No)
127+
{
128+
return false;
129+
}
114130
}
115131
try
116132
{
@@ -142,11 +158,13 @@ private void SaveSettings()
142158
catch (Exception ex)
143159
{
144160
MessageBox.Show("An error has occurred. Please provide the following information to the developer:\n" + ex.Message + "\n" + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
161+
return false;
145162
}
146163
finally
147164
{
148165
Get86BoxVersion(); //Get the new exe version in any case
149166
}
167+
return true;
150168
}
151169

152170
//TODO: Rewrite
@@ -266,13 +284,13 @@ private void btnDefaults_Click(object sender, EventArgs e)
266284
private void ResetSettings()
267285
{
268286
RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
269-
270287
if (regkey == null)
271288
{
272289
Registry.CurrentUser.CreateSubKey(@"SOFTWARE\86Box");
273290
regkey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\86Box", true);
274291
regkey.CreateSubKey("Virtual Machines");
275292
}
293+
regkey.Close();
276294

277295
txtCFGdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\86Box VMs\";
278296
txtEXEdir.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\86Box\";
@@ -287,8 +305,7 @@ private void ResetSettings()
287305
txtLogPath.Enabled = false;
288306
btnBrowse3.Enabled = false;
289307

290-
SaveSettings();
291-
regkey.Close();
308+
settingsChanged = CheckForChanges();
292309
}
293310

294311
//Checks if all controls match the currently saved settings to determine if any changes were made
@@ -301,13 +318,13 @@ private bool CheckForChanges()
301318
btnApply.Enabled = (
302319
txtEXEdir.Text != regkey.GetValue("EXEdir").ToString() ||
303320
txtCFGdir.Text != regkey.GetValue("CFGdir").ToString() ||
321+
txtLogPath.Text != regkey.GetValue("LogPath").ToString() ||
322+
txtLaunchTimeout.Text != regkey.GetValue("LaunchTimeout").ToString() ||
304323
cbxMinimize.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeOnVMStart")) ||
305324
cbxShowConsole.Checked != Convert.ToBoolean(regkey.GetValue("ShowConsole")) ||
306325
cbxMinimizeTray.Checked != Convert.ToBoolean(regkey.GetValue("MinimizeToTray")) ||
307326
cbxCloseTray.Checked != Convert.ToBoolean(regkey.GetValue("CloseToTray")) ||
308-
txtLaunchTimeout.Text != regkey.GetValue("LaunchTimeout").ToString() ||
309327
cbxLogging.Checked != Convert.ToBoolean(regkey.GetValue("EnableLogging")) ||
310-
txtLogPath.Text != regkey.GetValue("LogPath").ToString() ||
311328
cbxGrid.Checked != Convert.ToBoolean(regkey.GetValue("EnableGridLines")));
312329

313330
return btnApply.Enabled;

86BoxManager/frmMain.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,10 @@ private void VMConfigure()
711711
btnPause.Text = "Pause";
712712
btnCtrlAltDel.Enabled = false;
713713
}
714+
catch (Win32Exception ex)
715+
{
716+
MessageBox.Show("Cannot find 86Box.exe. Make sure your settings are correct and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
717+
}
714718
catch (Exception ex)
715719
{
716720
//Revert to stopped status and alert the user

0 commit comments

Comments
 (0)