1
0
mirror of https://github.com/livingcomputermuseum/ContrAlto.git synced 2026-03-09 20:18:33 +00:00

Added "-rompath" startup option to allow specifying an alternate path for microcode ROMs. Updated raw Ethernet handling to work with ncap (which replaces WinPcap since it's no longer being updated) running in WinPcap mode. Fixed bug with DebuggerPrompt -- when run with stdin/out redirected, Console.Width is 0, resulting in a div/zero issue.

This commit is contained in:
Josh Dersch
2019-02-21 16:43:44 -08:00
parent 11c168e201
commit 60bb9bfd13
6 changed files with 55 additions and 7 deletions

1
.gitignore vendored
View File

@@ -190,3 +190,4 @@ ModelManifest.xml
/Contralto.VC.VC.opendb
/Contralto.VC.db
/.vs/Contralto/v15/Server/sqlite3
/.vs/Contralto/DesignTimeBuild/.dtbcache

View File

@@ -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);
}
}
/// <summary>

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;