mirror of
https://github.com/livingcomputermuseum/Darkstar.git
synced 2026-04-03 05:15:07 +00:00
Added Fullscreen support and a few shortcut keys. Modified TOD clock reset (if No Change is selected, the Power Loss flag is set at emulation reset). Added -config and -rompath startup flags.
This commit is contained in:
@@ -188,8 +188,8 @@ namespace D
|
||||
/// </summary>
|
||||
public static void ReadConfiguration()
|
||||
{
|
||||
if (Configuration.Platform == PlatformType.Windows)
|
||||
// && string.IsNullOrWhiteSpace(StartupOptions.ConfigurationFile))
|
||||
if (Configuration.Platform == PlatformType.Windows
|
||||
&& string.IsNullOrWhiteSpace(StartupOptions.ConfigurationFile))
|
||||
{
|
||||
//
|
||||
// By default, on Windows we use the app Settings functionality
|
||||
@@ -262,9 +262,9 @@ namespace D
|
||||
{
|
||||
string configFilePath = null;
|
||||
|
||||
if (false) //!string.IsNullOrWhiteSpace(StartupOptions.ConfigurationFile))
|
||||
if (!string.IsNullOrWhiteSpace(StartupOptions.ConfigurationFile))
|
||||
{
|
||||
// configFilePath = StartupOptions.ConfigurationFile;
|
||||
configFilePath = StartupOptions.ConfigurationFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -150,17 +150,35 @@ namespace D.IOP
|
||||
|
||||
private void LoadPROM(string promName, ushort address)
|
||||
{
|
||||
string promPath = Path.Combine("IOP", "PROM", promName);
|
||||
string promPath;
|
||||
|
||||
using (FileStream promStream = new FileStream(promPath, FileMode.Open, FileAccess.Read))
|
||||
if (!string.IsNullOrWhiteSpace(StartupOptions.RomPath))
|
||||
{
|
||||
if (promStream.Length != 0x800)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
String.Format("PROM file {0} has unexpected size 0x{1:x}", promName, promStream.Length));
|
||||
}
|
||||
promPath = Path.Combine(StartupOptions.RomPath, promName);
|
||||
}
|
||||
else
|
||||
{
|
||||
promPath = Path.Combine("IOP", "PROM", promName);
|
||||
}
|
||||
|
||||
promStream.Read(_rom, address, 0x800);
|
||||
try
|
||||
{
|
||||
using (FileStream promStream = new FileStream(promPath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
if (promStream.Length != 0x800)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
String.Format("PROM file {0} has unexpected size 0x{1:x}", promName, promStream.Length));
|
||||
}
|
||||
|
||||
promStream.Read(_rom, address, 0x800);
|
||||
}
|
||||
}
|
||||
catch(FileNotFoundException e)
|
||||
{
|
||||
throw new FileNotFoundException(
|
||||
String.Format("PROM file {0} was not found in directory {1}", promName, promPath),
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace D.IOP
|
||||
|
||||
_todReadBit = 0;
|
||||
_mode = TODAccessMode.None;
|
||||
_powerLoss = false;
|
||||
_powerLoss = PowerUpSetMode == TODPowerUpSetMode.NoChange ? true : false;
|
||||
|
||||
PowerUpSetMode = Configuration.TODSetMode;
|
||||
PowerUpSetTime = (PowerUpSetMode == TODPowerUpSetMode.SpecificDate) ?
|
||||
|
||||
52
D/Program.cs
52
D/Program.cs
@@ -32,11 +32,58 @@ using D.UI;
|
||||
|
||||
namespace D
|
||||
{
|
||||
public static class StartupOptions
|
||||
{
|
||||
public static string ConfigurationFile;
|
||||
|
||||
public static string RomPath;
|
||||
|
||||
}
|
||||
public class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//
|
||||
// Check for command-line arguments.
|
||||
//
|
||||
if (args.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
switch (args[i++].ToLowerInvariant())
|
||||
{
|
||||
case "-config":
|
||||
if (i < args.Length)
|
||||
{
|
||||
StartupOptions.ConfigurationFile = args[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintUsage();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case "-rompath":
|
||||
if (i < args.Length)
|
||||
{
|
||||
StartupOptions.RomPath = args[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintUsage();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
PrintUsage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PrintHerald();
|
||||
|
||||
// Cons up a system to run stuff on.
|
||||
@@ -72,5 +119,10 @@ namespace D
|
||||
Console.WriteLine("Bug reports to joshd@livingcomputers.org");
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
private static void PrintUsage()
|
||||
{
|
||||
Console.WriteLine("Usage: Darkstar [-config <configurationFile>] [-rompath <path>]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ namespace D.UI
|
||||
if (e.Alt)
|
||||
{
|
||||
ReleaseMouse();
|
||||
e.SuppressKeyPress = true;
|
||||
e.SuppressKeyPress = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,7 +702,7 @@ namespace D.UI
|
||||
// to be the dimensions of the (possibly scaled) display + status bar.
|
||||
// This will cause the window to resize to fit.
|
||||
//
|
||||
UIPanel.Size =
|
||||
UIPanel.Size =
|
||||
new Size(
|
||||
(int)(_displayWidth * _displayScale),
|
||||
(int)(_displayHeight * _displayScale) + this.SystemStatus.Height);
|
||||
@@ -1037,6 +1037,69 @@ namespace D.UI
|
||||
_renderEvent.type = (SDL.SDL_EventType)_renderEventType;
|
||||
}
|
||||
|
||||
private void ToggleFullScreen(bool fullScreen)
|
||||
{
|
||||
_fullScreenDisplay = !_fullScreenDisplay;
|
||||
|
||||
if (_fullScreenDisplay)
|
||||
{
|
||||
SuspendLayout();
|
||||
MainMenuStrip.Visible = false;
|
||||
SystemStatus.Visible = false;
|
||||
this.FormBorderStyle = FormBorderStyle.None;
|
||||
this.WindowState = FormWindowState.Maximized;
|
||||
this.BackColor = Color.Black;
|
||||
DisplayBox.Dock = DockStyle.None;
|
||||
|
||||
// Select scale based on aspect ratio of screen.
|
||||
if (this.Width < this.Height)
|
||||
{
|
||||
_displayScale = Math.Floor((double)this.Width / (double)_displayWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
_displayScale = Math.Floor((double)this.Height / (double)_displayHeight);
|
||||
}
|
||||
|
||||
// Scale the DisplayBox
|
||||
DisplayBox.Size = new Size(
|
||||
(int)(_displayWidth * _displayScale),
|
||||
(int)(_displayHeight * _displayScale));
|
||||
|
||||
// And center it in the middle of the window
|
||||
DisplayBox.Location = new Point(
|
||||
(this.Width - DisplayBox.Width) / 2,
|
||||
(this.Height - DisplayBox.Height) / 2);
|
||||
|
||||
ResumeLayout();
|
||||
PerformLayout();
|
||||
|
||||
CaptureMouse();
|
||||
|
||||
// Force a display render to clean up garbage.
|
||||
Render();
|
||||
}
|
||||
else
|
||||
{
|
||||
SuspendLayout();
|
||||
MainMenuStrip.Visible = true;
|
||||
SystemStatus.Visible = true;
|
||||
this.FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
this.BackColor = SystemColors.Window;
|
||||
|
||||
DisplayBox.Dock = DockStyle.Fill;
|
||||
_displayScale = Configuration.DisplayScale;
|
||||
UpdateDisplayScale();
|
||||
|
||||
ResumeLayout();
|
||||
PerformLayout();
|
||||
|
||||
// Force a display render to clean up garbage.
|
||||
Render();
|
||||
}
|
||||
}
|
||||
|
||||
private DSystem _system;
|
||||
|
||||
//
|
||||
@@ -1062,7 +1125,7 @@ namespace D.UI
|
||||
private const int _displayHeight = 860;
|
||||
private double _displayScale;
|
||||
private int _frameCount;
|
||||
|
||||
private bool _fullScreenDisplay;
|
||||
|
||||
//
|
||||
// Keyboard data
|
||||
|
||||
44
D/UI/DWindow.Designer.cs
generated
44
D/UI/DWindow.Designer.cs
generated
@@ -74,6 +74,7 @@ namespace D.UI
|
||||
this.NewQ2080ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.HardDiskLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ConfigurationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FullScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.showDebuggerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.HelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -113,6 +114,7 @@ namespace D.UI
|
||||
this.floppyToolStripMenuItem,
|
||||
this.HardDiskToolStripMenuItem,
|
||||
this.ConfigurationToolStripMenuItem,
|
||||
this.FullScreenToolStripMenuItem,
|
||||
this.showDebuggerToolStripMenuItem,
|
||||
this.ExitToolStripMenuItem});
|
||||
this.SystemToolStripMenuItem.Name = "SystemToolStripMenuItem";
|
||||
@@ -122,21 +124,25 @@ namespace D.UI
|
||||
// StartToolStripMenuItem
|
||||
//
|
||||
this.StartToolStripMenuItem.Name = "StartToolStripMenuItem";
|
||||
this.StartToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.StartToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.S)));
|
||||
this.StartToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.StartToolStripMenuItem.Text = "Start";
|
||||
this.StartToolStripMenuItem.Click += new System.EventHandler(this.StartToolStripMenuItem_Click);
|
||||
//
|
||||
// ResetToolStripMenuItem
|
||||
//
|
||||
this.ResetToolStripMenuItem.Name = "ResetToolStripMenuItem";
|
||||
this.ResetToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.ResetToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.R)));
|
||||
this.ResetToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.ResetToolStripMenuItem.Text = "Reset";
|
||||
this.ResetToolStripMenuItem.Click += new System.EventHandler(this.ResetToolStripMenuItem_Click);
|
||||
//
|
||||
// AlternateBootToolStripMenuItem
|
||||
//
|
||||
this.AlternateBootToolStripMenuItem.Name = "AlternateBootToolStripMenuItem";
|
||||
this.AlternateBootToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.AlternateBootToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.AlternateBootToolStripMenuItem.Text = "Alternate Boot";
|
||||
//
|
||||
// floppyToolStripMenuItem
|
||||
@@ -146,20 +152,22 @@ namespace D.UI
|
||||
this.FloppyUnloadToolStripMenuItem,
|
||||
this.FloppyLabelToolStripMenuItem});
|
||||
this.floppyToolStripMenuItem.Name = "floppyToolStripMenuItem";
|
||||
this.floppyToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.floppyToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.floppyToolStripMenuItem.Text = "Floppy Disk";
|
||||
//
|
||||
// FloppyLoadToolStripMenuItem
|
||||
//
|
||||
this.FloppyLoadToolStripMenuItem.Name = "FloppyLoadToolStripMenuItem";
|
||||
this.FloppyLoadToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
|
||||
this.FloppyLoadToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.D)));
|
||||
this.FloppyLoadToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
|
||||
this.FloppyLoadToolStripMenuItem.Text = "Load...";
|
||||
this.FloppyLoadToolStripMenuItem.Click += new System.EventHandler(this.FloppyLoadToolStripMenuItem_Click);
|
||||
//
|
||||
// FloppyUnloadToolStripMenuItem
|
||||
//
|
||||
this.FloppyUnloadToolStripMenuItem.Name = "FloppyUnloadToolStripMenuItem";
|
||||
this.FloppyUnloadToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
|
||||
this.FloppyUnloadToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
|
||||
this.FloppyUnloadToolStripMenuItem.Text = "Unload";
|
||||
this.FloppyUnloadToolStripMenuItem.Click += new System.EventHandler(this.FloppyUnloadToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -167,7 +175,7 @@ namespace D.UI
|
||||
//
|
||||
this.FloppyLabelToolStripMenuItem.Enabled = false;
|
||||
this.FloppyLabelToolStripMenuItem.Name = "FloppyLabelToolStripMenuItem";
|
||||
this.FloppyLabelToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
|
||||
this.FloppyLabelToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
|
||||
this.FloppyLabelToolStripMenuItem.Text = "No Floppy Loaded";
|
||||
//
|
||||
// HardDiskToolStripMenuItem
|
||||
@@ -177,12 +185,14 @@ namespace D.UI
|
||||
this.NewHardDiskToolStripMenuItem,
|
||||
this.HardDiskLabelToolStripMenuItem});
|
||||
this.HardDiskToolStripMenuItem.Name = "HardDiskToolStripMenuItem";
|
||||
this.HardDiskToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.HardDiskToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.HardDiskToolStripMenuItem.Text = "Hard Disk";
|
||||
//
|
||||
// LoadHardDiskToolStripMenuItem
|
||||
//
|
||||
this.LoadHardDiskToolStripMenuItem.Name = "LoadHardDiskToolStripMenuItem";
|
||||
this.LoadHardDiskToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.H)));
|
||||
this.LoadHardDiskToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.LoadHardDiskToolStripMenuItem.Text = "Load...";
|
||||
this.LoadHardDiskToolStripMenuItem.Click += new System.EventHandler(this.LoadHardDiskToolStripMenuItem_Click);
|
||||
@@ -231,21 +241,32 @@ namespace D.UI
|
||||
// ConfigurationToolStripMenuItem
|
||||
//
|
||||
this.ConfigurationToolStripMenuItem.Name = "ConfigurationToolStripMenuItem";
|
||||
this.ConfigurationToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.ConfigurationToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.C)));
|
||||
this.ConfigurationToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.ConfigurationToolStripMenuItem.Text = "Configuration...";
|
||||
this.ConfigurationToolStripMenuItem.Click += new System.EventHandler(this.ConfigurationToolStripMenuItem_Click);
|
||||
//
|
||||
// FullScreenToolStripMenuItem
|
||||
//
|
||||
this.FullScreenToolStripMenuItem.Name = "FullScreenToolStripMenuItem";
|
||||
this.FullScreenToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.F)));
|
||||
this.FullScreenToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.FullScreenToolStripMenuItem.Text = "Full Screen";
|
||||
this.FullScreenToolStripMenuItem.Click += new System.EventHandler(this.FullScreenToolStripMenuItem_Click);
|
||||
//
|
||||
// showDebuggerToolStripMenuItem
|
||||
//
|
||||
this.showDebuggerToolStripMenuItem.Name = "showDebuggerToolStripMenuItem";
|
||||
this.showDebuggerToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.showDebuggerToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.showDebuggerToolStripMenuItem.Text = "Show Debugger";
|
||||
this.showDebuggerToolStripMenuItem.Click += new System.EventHandler(this.ShowDebuggerToolStripMenu_Click);
|
||||
//
|
||||
// ExitToolStripMenuItem
|
||||
//
|
||||
this.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
|
||||
this.ExitToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
|
||||
this.ExitToolStripMenuItem.Size = new System.Drawing.Size(231, 22);
|
||||
this.ExitToolStripMenuItem.Text = "Exit";
|
||||
this.ExitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
|
||||
//
|
||||
@@ -405,5 +426,6 @@ namespace D.UI
|
||||
private System.Windows.Forms.ToolStripMenuItem NewQ2080ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripProgressBar ProgressBar;
|
||||
private System.Windows.Forms.ToolStripMenuItem ViewDocumentationToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem FullScreenToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace D.UI
|
||||
UpdateMPCode();
|
||||
UpdateHardDriveLabel();
|
||||
UpdateFloppyDriveLabel();
|
||||
UpdateMouseState();
|
||||
UpdateMouseState();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -348,6 +348,11 @@ namespace D.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void FullScreenToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToggleFullScreen(true);
|
||||
}
|
||||
|
||||
private void ShowDebuggerToolStripMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_debuggerWindow == null)
|
||||
@@ -579,6 +584,6 @@ namespace D.UI
|
||||
//
|
||||
private const string _hardDiskFilter = "Star Hard Disk Images (*.img)|*.img|All Files(*.*)|*.*";
|
||||
private const string _floppyDiskFilter = "Star Floppy Disk Images (*.imd)|*.imd|All Files(*.*)|*.*";
|
||||
private const string _readmeFilename = "readme.txt";
|
||||
private const string _readmeFilename = "readme.txt";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user