diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index 70c819165d..22418902bb 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -122,6 +122,9 @@ AppleII.cs + + AppleII.cs + AppleII.cs diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IEmulator.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IEmulator.cs index cf07fe2e33..2b1726e992 100644 --- a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IEmulator.cs @@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII public IController Controller { get; set; } - public int Frame { get; set; } public string SystemId { get { return "AppleII"; } } @@ -51,6 +50,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII public void ResetCounters() { Frame = 0; + LagCount = 0; + IsLagFrame = false; } public CoreComm CoreComm { get; private set; } diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IStatable.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IStatable.cs index 99f971cb93..1226b5a44a 100644 --- a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IStatable.cs +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.IStatable.cs @@ -22,6 +22,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII public void SaveStateBinary(BinaryWriter writer) { writer.Write(Frame); + writer.Write(LagCount); + writer.Write(IsLagFrame); writer.Write(CurrentDisk); _machine.SaveState(writer); } @@ -29,6 +31,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII public void LoadStateBinary(BinaryReader reader) { Frame = reader.ReadInt32(); + LagCount = reader.ReadInt32(); + IsLagFrame = reader.ReadBoolean(); CurrentDisk = reader.ReadInt32(); InitDisk(); _machine.LoadState(reader); diff --git a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs index 8b4c76f394..08c4e96546 100644 --- a/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs +++ b/BizHawk.Emulation.Cores/Computers/AppleII/AppleII.cs @@ -172,6 +172,11 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII _machine.Buttons = GetButtons(); _machine.BizFrameAdvance(); + if (IsLagFrame) + { + LagCount++; + } + Frame++; } diff --git a/ExternalCoreProjects/Virtu/Machine.cs b/ExternalCoreProjects/Virtu/Machine.cs index fe25d4522a..5334d67569 100644 --- a/ExternalCoreProjects/Virtu/Machine.cs +++ b/ExternalCoreProjects/Virtu/Machine.cs @@ -327,7 +327,8 @@ namespace Jellyfish.Virtu public void BizFrameAdvance() { - Services.GetService().Update(); + Lagged = true; + Services.GetService().Update(); Services.GetService().Update(); //frame begins at vsync.. beginning of vblank while (Video.IsVBlank) @@ -384,5 +385,7 @@ namespace Jellyfish.Virtu private AutoResetEvent _pauseEvent = new AutoResetEvent(false); private AutoResetEvent _unpauseEvent = new AutoResetEvent(false); + + public bool Lagged { get; set; } } } diff --git a/ExternalCoreProjects/Virtu/Memory.cs b/ExternalCoreProjects/Virtu/Memory.cs index 991a8335c4..6c90939738 100644 --- a/ExternalCoreProjects/Virtu/Memory.cs +++ b/ExternalCoreProjects/Virtu/Memory.cs @@ -286,7 +286,8 @@ namespace Jellyfish.Virtu [SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")] private int ReadIoRegionC0C0(int address) { - switch (address) + Machine.Lagged = false; + switch (address) { case 0xC000: case 0xC001: case 0xC002: case 0xC003: case 0xC004: case 0xC005: case 0xC006: case 0xC007: // [7-15] case 0xC008: case 0xC009: case 0xC00A: case 0xC00B: case 0xC00C: case 0xC00D: case 0xC00E: case 0xC00F: diff --git a/References/Virtu.dll b/References/Virtu.dll index accbb4d4f0..13786ad65e 100644 Binary files a/References/Virtu.dll and b/References/Virtu.dll differ