diff --git a/.gitignore b/.gitignore index b7279d4..e2fb980 100644 --- a/.gitignore +++ b/.gitignore @@ -190,3 +190,4 @@ ModelManifest.xml /Contralto.VC.VC.opendb /Contralto.VC.db /.vs/Contralto/v15/Server/sqlite3 +/.vs/Contralto/DesignTimeBuild/.dtbcache diff --git a/Contralto/Configuration.cs b/Contralto/Configuration.cs index 7a73b32..276caf2 100644 --- a/Contralto/Configuration.cs +++ b/Contralto/Configuration.cs @@ -259,17 +259,38 @@ namespace Contralto public static string GetAltoIRomPath(string romFileName) { - return Path.Combine("ROM", "AltoI", romFileName); + if (string.IsNullOrEmpty(StartupOptions.RomPath)) + { + return Path.Combine("ROM", "AltoI", romFileName); + } + else + { + return Path.Combine(StartupOptions.RomPath, "AltoI", romFileName); + } } public static string GetAltoIIRomPath(string romFileName) { - return Path.Combine("ROM", "AltoII", romFileName); + if (string.IsNullOrEmpty(StartupOptions.RomPath)) + { + return Path.Combine("ROM", "AltoII", romFileName); + } + else + { + return Path.Combine(StartupOptions.RomPath, "AltoII", romFileName); + } } public static string GetRomPath(string romFileName) { - return Path.Combine("ROM", romFileName); + if (string.IsNullOrEmpty(StartupOptions.RomPath)) + { + return Path.Combine("ROM", romFileName); + } + else + { + return Path.Combine(StartupOptions.RomPath, romFileName); + } } /// diff --git a/Contralto/IO/HostEthernetEncapsulation.cs b/Contralto/IO/HostEthernetEncapsulation.cs index 493e7b0..593be15 100644 --- a/Contralto/IO/HostEthernetEncapsulation.cs +++ b/Contralto/IO/HostEthernetEncapsulation.cs @@ -68,7 +68,8 @@ namespace Contralto.IO // // We use the friendly name to make it easier to specify in config files. // - if (((WinPcapDevice)device).Interface.FriendlyName.ToLowerInvariant() == name.ToLowerInvariant()) + if (!string.IsNullOrWhiteSpace(((WinPcapDevice)device).Interface.FriendlyName) && + ((WinPcapDevice)device).Interface.FriendlyName.ToLowerInvariant() == name.ToLowerInvariant()) { AttachInterface(device); break; diff --git a/Contralto/Program.cs b/Contralto/Program.cs index f77cbb3..a471cab 100644 --- a/Contralto/Program.cs +++ b/Contralto/Program.cs @@ -27,6 +27,8 @@ namespace Contralto public static string ConfigurationFile; public static string ScriptFile; + + public static string RomPath; } class Program @@ -67,6 +69,18 @@ namespace Contralto } break; + case "-rompath": + if (i < args.Length) + { + StartupOptions.RomPath = args[i]; + } + else + { + PrintUsage(); + return; + } + break; + default: PrintUsage(); return; diff --git a/Contralto/SdlUI/DebuggerPrompt.cs b/Contralto/SdlUI/DebuggerPrompt.cs index 90e05d1..73224a1 100644 --- a/Contralto/SdlUI/DebuggerPrompt.cs +++ b/Contralto/SdlUI/DebuggerPrompt.cs @@ -199,8 +199,11 @@ namespace Contralto.SdlUI clear = sb.ToString(); } - int column = ((_textPosition + _originColumn) % Console.BufferWidth); - int row = ((_textPosition + _originColumn) / Console.BufferWidth) + _originRow; + // Default to 80 if BufferWidth is zero (this can happen if stdout is being redirected) + int bufferWidth = Console.BufferWidth > 0 ? Console.BufferWidth : 80; + + int column = ((_textPosition + _originColumn) % bufferWidth); + int row = ((_textPosition + _originColumn) / bufferWidth) + _originRow; // Move cursor to origin to draw string Console.CursorLeft = _originColumn; diff --git a/Contralto/UI/SystemOptions.cs b/Contralto/UI/SystemOptions.cs index a1fe523..5dc31bd 100644 --- a/Contralto/UI/SystemOptions.cs +++ b/Contralto/UI/SystemOptions.cs @@ -163,7 +163,15 @@ namespace Contralto.UI { foreach (WinPcapDevice device in CaptureDeviceList.Instance) { - EthernetInterfaceListBox.Items.Add(new EthernetInterface(device.Interface.FriendlyName, device.Interface.Description)); + // + // NCap seems to return some interfaces with a null FriendlyName; empirically these + // are not real network adapters that would typically be used with ContrAlto so we + // will not display them here. + // + if (!string.IsNullOrWhiteSpace(device.Interface.FriendlyName)) + { + EthernetInterfaceListBox.Items.Add(new EthernetInterface(device.Interface.FriendlyName, device.Interface.Description)); + } } } break;