FDS: connect drive LED front end feature. also fix a bitsy savestate&saveram issue
This commit is contained in:
parent
7e9d487580
commit
91a71febe5
|
@ -65,7 +65,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
currentside = tmp == 1234567 ? null : (int?)tmp;
|
currentside = tmp == 1234567 ? null : (int?)tmp;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NumSides; i++)
|
for (int i = 0; i < NumSides; i++)
|
||||||
ser.Sync("diskdiffs" + i, ref diskdiffs[i], false);
|
ser.Sync("diskdiffs" + i, ref diskdiffs[i], true);
|
||||||
ser.Sync("_timerirq", ref _timerirq);
|
ser.Sync("_timerirq", ref _timerirq);
|
||||||
ser.Sync("_diskirq", ref _diskirq);
|
ser.Sync("_diskirq", ref _diskirq);
|
||||||
ser.Sync("diskenable", ref diskenable);
|
ser.Sync("diskenable", ref diskenable);
|
||||||
|
@ -79,6 +79,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
SetIRQ();
|
SetIRQ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetDriveLightCallback(Action<bool> callback)
|
||||||
|
{
|
||||||
|
diskdrive.DriveLightCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// should only be called once, before emulation begins
|
/// should only be called once, before emulation begins
|
||||||
|
@ -140,7 +144,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
byte[] buf = new byte[65500];
|
byte[] buf = new byte[65500];
|
||||||
Buffer.BlockCopy(diskimage, 16 + side * 65500, buf, 0, 65500);
|
Buffer.BlockCopy(diskimage, 16 + side * 65500, buf, 0, 65500);
|
||||||
diskdrive.InsertBrokenImage(buf, false /*true*/);
|
diskdrive.InsertBrokenImage(buf, false /*true*/);
|
||||||
if (diskdiffs[side] != null)
|
if (diskdiffs[side] != null && diskdiffs[side].Length > 0)
|
||||||
diskdrive.ApplyDiff(diskdiffs[side]);
|
diskdrive.ApplyDiff(diskdiffs[side]);
|
||||||
currentside = side;
|
currentside = side;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,6 +202,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public Action<bool> DriveLightCallback;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// eject the loaded disk
|
/// eject the loaded disk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -211,6 +213,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
state = RamAdapterState.IDLE;
|
state = RamAdapterState.IDLE;
|
||||||
SetCycles();
|
SetCycles();
|
||||||
Console.WriteLine("FDS: Disk ejected");
|
Console.WriteLine("FDS: Disk ejected");
|
||||||
|
if (DriveLightCallback != null)
|
||||||
|
DriveLightCallback(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -231,6 +235,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
SetCycles();
|
SetCycles();
|
||||||
Console.WriteLine("FDS: Disk Inserted");
|
Console.WriteLine("FDS: Disk Inserted");
|
||||||
originaldisk = (byte[])disk.Clone();
|
originaldisk = (byte[])disk.Clone();
|
||||||
|
if (DriveLightCallback != null)
|
||||||
|
DriveLightCallback(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -378,6 +384,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
state = RamAdapterState.SPINUP;
|
state = RamAdapterState.SPINUP;
|
||||||
SetCycles();
|
SetCycles();
|
||||||
//}
|
//}
|
||||||
|
if (DriveLightCallback != null)
|
||||||
|
DriveLightCallback(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((value & 2) != 0)
|
if ((value & 2) != 0)
|
||||||
|
@ -488,6 +496,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
state = RamAdapterState.RESET;
|
state = RamAdapterState.RESET;
|
||||||
transferreset = false;
|
transferreset = false;
|
||||||
//numcrc = 0;
|
//numcrc = 0;
|
||||||
|
if (DriveLightCallback != null)
|
||||||
|
DriveLightCallback(false);
|
||||||
}
|
}
|
||||||
SetCycles();
|
SetCycles();
|
||||||
break;
|
break;
|
||||||
|
@ -500,12 +510,16 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
transferreset = false;
|
transferreset = false;
|
||||||
//numcrc = 0;
|
//numcrc = 0;
|
||||||
Console.WriteLine("FDS: Return or Insert Complete");
|
Console.WriteLine("FDS: Return or Insert Complete");
|
||||||
|
if (DriveLightCallback != null)
|
||||||
|
DriveLightCallback(false);
|
||||||
break;
|
break;
|
||||||
case RamAdapterState.SPINUP:
|
case RamAdapterState.SPINUP:
|
||||||
state = RamAdapterState.RUNNING;
|
state = RamAdapterState.RUNNING;
|
||||||
SetCycles();
|
SetCycles();
|
||||||
//transferreset = false; // this definitely does not happen.
|
//transferreset = false; // this definitely does not happen.
|
||||||
Console.WriteLine("FDS: Spin up complete! Disk is running");
|
Console.WriteLine("FDS: Spin up complete! Disk is running");
|
||||||
|
if (DriveLightCallback != null)
|
||||||
|
DriveLightCallback(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RamAdapterState.IDLE:
|
case RamAdapterState.IDLE:
|
||||||
|
|
|
@ -32,6 +32,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
ControllerDefinition.BoolButtons.Add("FDS Eject");
|
ControllerDefinition.BoolButtons.Add("FDS Eject");
|
||||||
for (int i = 0; i < b.NumSides; i++)
|
for (int i = 0; i < b.NumSides; i++)
|
||||||
ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
|
ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
|
||||||
|
|
||||||
|
CoreOutputComm.UsesDriveLed = true;
|
||||||
|
b.SetDriveLightCallback((val) => CoreOutputComm.DriveLED = val);
|
||||||
}
|
}
|
||||||
if (vs_io)
|
if (vs_io)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue