mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2025-02-17 04:32:21 +00:00
1) Cosmetic changes. 2) Removed volume from disk settings to simplify *.dsk support - if volume matters use another disk format.
--HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4020423
This commit is contained in:
parent
1af55a3406
commit
18ac684607
@ -14,7 +14,7 @@ namespace Jellyfish.Library
|
||||
int index = builder.Length;
|
||||
do
|
||||
{
|
||||
builder.Insert(index, _digits, (number % 10) + 9, 1);
|
||||
builder.Insert(index, Digits, (number % 10) + 9, 1);
|
||||
number /= 10;
|
||||
}
|
||||
while (number != 0);
|
||||
@ -22,6 +22,6 @@ namespace Jellyfish.Library
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static readonly char[] _digits = new char[] { '9', '8', '7', '6', '5', '4', '3', '2', '1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
private static readonly char[] Digits = new char[] { '9', '8', '7', '6', '5', '4', '3', '2', '1', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Jellyfish.Virtu.Properties
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
}
|
||||
}
|
@ -11,8 +11,8 @@ namespace Jellyfish.Virtu
|
||||
Data = data;
|
||||
IsWriteProtected = true; // TODO use isWriteProtected
|
||||
}
|
||||
|
||||
public static Disk525 CreateDisk(string name, byte[] data, int volume, bool isWriteProtected)
|
||||
|
||||
public static Disk525 CreateDisk(string name, byte[] data, bool isWriteProtected)
|
||||
{
|
||||
if (name.EndsWith(".nib", StringComparison.OrdinalIgnoreCase) && (data.Length == TrackCount * TrackSize))
|
||||
{
|
||||
@ -20,7 +20,7 @@ namespace Jellyfish.Virtu
|
||||
}
|
||||
else if (name.EndsWith(".dsk", StringComparison.OrdinalIgnoreCase) && (data.Length == TrackCount * SectorCount * SectorSize))
|
||||
{
|
||||
return new DiskDsk(name, data, volume, isWriteProtected);
|
||||
return new DiskDsk(name, data, isWriteProtected);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -4,10 +4,9 @@ namespace Jellyfish.Virtu
|
||||
{
|
||||
public sealed class DiskDsk : Disk525
|
||||
{
|
||||
public DiskDsk(string name, byte[] data, int volume, bool isWriteProtected) :
|
||||
public DiskDsk(string name, byte[] data, bool isWriteProtected) :
|
||||
base(name, data, isWriteProtected)
|
||||
{
|
||||
Volume = volume;
|
||||
}
|
||||
|
||||
public override void ReadTrack(int number, int fraction, byte[] buffer)
|
||||
@ -22,6 +21,6 @@ namespace Jellyfish.Virtu
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private int Volume { get; set; }
|
||||
private const int Volume = 0xFE;
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ namespace Jellyfish.Virtu
|
||||
}
|
||||
if (settings.Disk1.Name.Length > 0)
|
||||
{
|
||||
_drives[0].InsertDisk(settings.Disk1.Name, settings.Disk1.Volume, settings.Disk1.IsWriteProtected);
|
||||
_drives[0].InsertDisk(settings.Disk1.Name, settings.Disk1.IsWriteProtected);
|
||||
}
|
||||
if (settings.Disk2.Name.Length > 0)
|
||||
{
|
||||
_drives[1].InsertDisk(settings.Disk2.Name, settings.Disk2.Volume, settings.Disk2.IsWriteProtected);
|
||||
_drives[1].InsertDisk(settings.Disk2.Name, settings.Disk2.IsWriteProtected);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,14 +22,14 @@ namespace Jellyfish.Virtu
|
||||
}
|
||||
}
|
||||
|
||||
public void InsertDisk(string fileName, int volume, bool isWriteProtected)
|
||||
public void InsertDisk(string fileName, bool isWriteProtected)
|
||||
{
|
||||
FlushTrack();
|
||||
|
||||
// TODO handle null param/empty string for eject, or add Eject()
|
||||
|
||||
byte[] fileData = FileHelpers.ReadAllBytes(fileName);
|
||||
_disk = Disk525.CreateDisk(fileName, fileData, volume, isWriteProtected);
|
||||
_disk = Disk525.CreateDisk(fileName, fileData, isWriteProtected);
|
||||
_trackLoaded = false;
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ namespace Jellyfish.Virtu.Settings
|
||||
Cpu = new CpuSettings { Is65C02 = true, IsThrottled = true };
|
||||
DiskII = new DiskIISettings
|
||||
{
|
||||
Disk1 = new DiskSettings { Name = string.Empty, Volume = 0xFE, IsWriteProtected = false },
|
||||
Disk2 = new DiskSettings { Name = string.Empty, Volume = 0xFE, IsWriteProtected = false }
|
||||
Disk1 = new DiskSettings { Name = string.Empty, IsWriteProtected = false },
|
||||
Disk2 = new DiskSettings { Name = string.Empty, IsWriteProtected = false }
|
||||
};
|
||||
Keyboard = new KeyboardSettings
|
||||
{
|
||||
@ -85,13 +85,11 @@ namespace Jellyfish.Virtu.Settings
|
||||
Disk1 = new DiskSettings
|
||||
{
|
||||
Name = (string)disk1.Attribute("Name") ?? string.Empty,
|
||||
Volume = (int)disk1.Attribute("Volume"),
|
||||
IsWriteProtected = (bool)disk1.Attribute("IsWriteProtected")
|
||||
},
|
||||
Disk2 = new DiskSettings
|
||||
{
|
||||
Name = (string)disk2.Attribute("Name") ?? string.Empty,
|
||||
Volume = (int)disk2.Attribute("Volume"),
|
||||
IsWriteProtected = (bool)disk2.Attribute("IsWriteProtected")
|
||||
},
|
||||
};
|
||||
@ -214,11 +212,9 @@ namespace Jellyfish.Virtu.Settings
|
||||
new XElement(ns + "DiskII",
|
||||
new XElement(ns + "Disk1",
|
||||
new XAttribute("Name", DiskII.Disk1.Name),
|
||||
new XAttribute("Volume", DiskII.Disk1.Volume),
|
||||
new XAttribute("IsWriteProtected", DiskII.Disk1.IsWriteProtected)),
|
||||
new XElement(ns + "Disk2",
|
||||
new XAttribute("Name", DiskII.Disk2.Name),
|
||||
new XAttribute("Volume", DiskII.Disk2.Volume),
|
||||
new XAttribute("IsWriteProtected", DiskII.Disk2.IsWriteProtected))),
|
||||
new XElement(ns + "Keyboard",
|
||||
new XAttribute("UseGamePort", Keyboard.UseGamePort),
|
||||
@ -318,7 +314,6 @@ namespace Jellyfish.Virtu.Settings
|
||||
public class DiskSettings
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Volume { get; set; }
|
||||
public bool IsWriteProtected { get; set; }
|
||||
};
|
||||
|
||||
|
@ -91,8 +91,8 @@ namespace Jellyfish.Virtu.Services
|
||||
private int GetAsciiKey(Key key, int platformKeyCode)
|
||||
{
|
||||
ModifierKeys modifiers = System.Windows.Input.Keyboard.Modifiers;
|
||||
bool control = ((modifiers & ModifierKeys.Control) == ModifierKeys.Control);
|
||||
bool shift = ((modifiers & ModifierKeys.Shift) == ModifierKeys.Shift);
|
||||
bool control = ((modifiers & ModifierKeys.Control) != 0);
|
||||
bool shift = ((modifiers & ModifierKeys.Shift) != 0);
|
||||
bool capsLock = shift ^ _capsLock;
|
||||
|
||||
switch (key)
|
||||
|
@ -25,7 +25,7 @@ namespace Jellyfish.Virtu.Services
|
||||
// try
|
||||
// {
|
||||
// OpenFileDialog dialog = new OpenFileDialog(); // SL expects all dialogs to be user initiated, ie from within an event handler.
|
||||
// dialog.Filter = "Disk Files (*.nib)|*.nib|All Files (*.*)|*.*";
|
||||
// dialog.Filter = "Disk Files (*.dsk;*.nib)|*.dsk;*.nib|All Files (*.*)|*.*";
|
||||
// bool? result = dialog.ShowDialog();
|
||||
// if (result.HasValue && result.Value)
|
||||
// {
|
||||
|
@ -16,7 +16,7 @@ namespace Jellyfish.Virtu.Services
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.Filter = "Disk Files (*.nib)|*.nib|All Files (*.*)|*.*";
|
||||
dialog.Filter = "Disk Files (*.dsk;*.nib)|*.dsk;*.nib|All Files (*.*)|*.*";
|
||||
bool? result = dialog.ShowDialog();
|
||||
if (result.HasValue && result.Value)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user