From 218b57c5a9608f5b274248a71b0e5c71790d9ad0 Mon Sep 17 00:00:00 2001 From: ClAndrew Date: Sat, 30 Apr 2022 11:21:22 -0700 Subject: [PATCH] Use of --hex command line arg doesn't require also specifying --autoRun Repro: 1. Run "FoenixIDE.exe" 2. In the UI, disable autoRun. 3. Close emulator (.ini file gets saved). 4. Run "FoenixIDE.exe --hex someKernel.hex" Expected: Emulator launches without autoRun Actual: Emulator launches with autoRun Explanation: if you use any command line switch (e.g., --hex) then the emulator looks for autoRun in the command line too. If you don't specify autoRun on the command line, it won't fall back to reading it from the .ini file. Instead. autoRun always stays at the default (true). --- Main/UI/MainWindow.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Main/UI/MainWindow.cs b/Main/UI/MainWindow.cs index 1ba9cb9..c843317 100644 --- a/Main/UI/MainWindow.cs +++ b/Main/UI/MainWindow.cs @@ -58,6 +58,9 @@ public partial class MainWindow : Form public MainWindow(Dictionary context) { + bool autoRunCommandLineSpecified = false; + bool boardVersionCommandLineSpecified = false; + if (context != null) { if (context.ContainsKey("jumpStartAddress")) @@ -71,6 +74,7 @@ public MainWindow(Dictionary context) if (context.ContainsKey("autoRun")) { autoRun = "true".Equals(context["autoRun"]); + autoRunCommandLineSpecified = true; } if (context.ContainsKey("disabledIRQs")) { @@ -90,12 +94,16 @@ public MainWindow(Dictionary context) { version = BoardVersion.RevUPlus; } + boardVersionCommandLineSpecified = true; } } // If the user didn't specify context switches, read the ini setting - if (context == null) + if (!autoRunCommandLineSpecified) { autoRun = Simulator.Properties.Settings.Default.Autorun; + } + if (!boardVersionCommandLineSpecified) + { switch (Simulator.Properties.Settings.Default.BoardRevision) { case "B":