mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-05-31 15:41:33 +00:00
Added DiskIIDrive.RemoveDisk.
Added DisableResetKey to Keyboard settings.
This commit is contained in:
parent
6aa86024d3
commit
5f66151bc5
|
@ -58,13 +58,19 @@ public void SaveState(BinaryWriter writer)
|
||||||
public void InsertDisk(string name, Stream stream, bool isWriteProtected)
|
public void InsertDisk(string name, Stream stream, bool isWriteProtected)
|
||||||
{
|
{
|
||||||
FlushTrack();
|
FlushTrack();
|
||||||
|
|
||||||
// TODO handle null param/empty string for eject, or add Eject()
|
|
||||||
|
|
||||||
_disk = Disk525.CreateDisk(name, stream, isWriteProtected);
|
_disk = Disk525.CreateDisk(name, stream, isWriteProtected);
|
||||||
_trackLoaded = false;
|
_trackLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RemoveDisk()
|
||||||
|
{
|
||||||
|
_trackLoaded = false;
|
||||||
|
_trackChanged = false;
|
||||||
|
_trackNumber = 0;
|
||||||
|
_trackOffset = 0;
|
||||||
|
_disk = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyPhaseChange(int phaseState)
|
public void ApplyPhaseChange(int phaseState)
|
||||||
{
|
{
|
||||||
// step the drive head according to stepper magnet changes
|
// step the drive head according to stepper magnet changes
|
||||||
|
@ -139,12 +145,12 @@ public void FlushTrack()
|
||||||
|
|
||||||
private readonly int[][] DriveArmStepDelta = new int[PhaseCount][];
|
private readonly int[][] DriveArmStepDelta = new int[PhaseCount][];
|
||||||
|
|
||||||
private Disk525 _disk;
|
|
||||||
private bool _trackLoaded;
|
private bool _trackLoaded;
|
||||||
private bool _trackChanged;
|
private bool _trackChanged;
|
||||||
private int _trackNumber;
|
private int _trackNumber;
|
||||||
private int _trackOffset;
|
private int _trackOffset;
|
||||||
private byte[] _trackData = new byte[Disk525.TrackSize];
|
private byte[] _trackData = new byte[Disk525.TrackSize];
|
||||||
|
private Disk525 _disk;
|
||||||
|
|
||||||
private Random _random = new Random();
|
private Random _random = new Random();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ public override void LoadState(BinaryReader reader, Version version)
|
||||||
throw new ArgumentNullException("reader");
|
throw new ArgumentNullException("reader");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisableResetKey = reader.ReadBoolean();
|
||||||
|
|
||||||
UseGamePort = reader.ReadBoolean();
|
UseGamePort = reader.ReadBoolean();
|
||||||
Joystick0UpLeftKey = reader.ReadInt32();
|
Joystick0UpLeftKey = reader.ReadInt32();
|
||||||
Joystick0UpKey = reader.ReadInt32();
|
Joystick0UpKey = reader.ReadInt32();
|
||||||
|
@ -55,6 +57,8 @@ public override void SaveState(BinaryWriter writer)
|
||||||
throw new ArgumentNullException("writer");
|
throw new ArgumentNullException("writer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writer.Write(DisableResetKey);
|
||||||
|
|
||||||
writer.Write(UseGamePort);
|
writer.Write(UseGamePort);
|
||||||
writer.Write(Joystick0UpLeftKey);
|
writer.Write(Joystick0UpLeftKey);
|
||||||
writer.Write(Joystick0UpKey);
|
writer.Write(Joystick0UpKey);
|
||||||
|
@ -82,6 +86,8 @@ public void ResetStrobe()
|
||||||
Strobe = false;
|
Strobe = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DisableResetKey { get; set; }
|
||||||
|
|
||||||
public bool UseGamePort { get; set; }
|
public bool UseGamePort { get; set; }
|
||||||
public int Joystick0UpLeftKey { get; set; }
|
public int Joystick0UpLeftKey { get; set; }
|
||||||
public int Joystick0UpKey { get; set; }
|
public int Joystick0UpKey { get; set; }
|
||||||
|
|
|
@ -158,16 +158,6 @@ private void LoadState(Stream stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Uninitialize()
|
|
||||||
{
|
|
||||||
foreach (var component in Components)
|
|
||||||
{
|
|
||||||
//_debugService.WriteLine("Uninitializing component '{0}'", component.GetType().Name);
|
|
||||||
component.Uninitialize();
|
|
||||||
//_debugService.WriteLine("Uninitialized component '{0}'", component.GetType().Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveState()
|
private void SaveState()
|
||||||
{
|
{
|
||||||
_storageService.Save(Machine.StateFileName, stream => SaveState(stream));
|
_storageService.Save(Machine.StateFileName, stream => SaveState(stream));
|
||||||
|
@ -188,6 +178,16 @@ private void SaveState(Stream stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Uninitialize()
|
||||||
|
{
|
||||||
|
foreach (var component in Components)
|
||||||
|
{
|
||||||
|
//_debugService.WriteLine("Uninitializing component '{0}'", component.GetType().Name);
|
||||||
|
component.Uninitialize();
|
||||||
|
//_debugService.WriteLine("Uninitialized component '{0}'", component.GetType().Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Run() // machine thread
|
private void Run() // machine thread
|
||||||
{
|
{
|
||||||
//_debugService = Services.GetService<DebugService>();
|
//_debugService = Services.GetService<DebugService>();
|
||||||
|
@ -219,7 +219,7 @@ private void Run() // machine thread
|
||||||
Uninitialize();
|
Uninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public const string Version = "0.9.1.0";
|
public const string Version = "0.9.2.0";
|
||||||
|
|
||||||
public MachineEvents Events { get; private set; }
|
public MachineEvents Events { get; private set; }
|
||||||
public MachineServices Services { get; private set; }
|
public MachineServices Services { get; private set; }
|
||||||
|
|
|
@ -11,7 +11,9 @@ protected KeyboardService(Machine machine) :
|
||||||
|
|
||||||
public virtual void Update() // main thread
|
public virtual void Update() // main thread
|
||||||
{
|
{
|
||||||
if (IsResetKeyDown)
|
var keyboard = Machine.Keyboard;
|
||||||
|
|
||||||
|
if (IsResetKeyDown && !keyboard.DisableResetKey)
|
||||||
{
|
{
|
||||||
if (!_resetKeyDown)
|
if (!_resetKeyDown)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user