Apple II - wire up the lag counter, may or may not be correct logic, don't know too much about Apple II internals, but eyeballing the code, it looks like a reasonable place to decide if input was polled.

This commit is contained in:
adelikat 2015-04-26 12:40:21 +00:00
parent bd07bfa310
commit dbc3a5cb2c
7 changed files with 20 additions and 3 deletions

View File

@ -122,6 +122,9 @@
<Compile Include="Computers\AppleII\AppleII.IEmulator.cs"> <Compile Include="Computers\AppleII\AppleII.IEmulator.cs">
<DependentUpon>AppleII.cs</DependentUpon> <DependentUpon>AppleII.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Computers\AppleII\AppleII.IInputPollable.cs">
<DependentUpon>AppleII.cs</DependentUpon>
</Compile>
<Compile Include="Computers\AppleII\AppleII.IMemoryDomains.cs"> <Compile Include="Computers\AppleII\AppleII.IMemoryDomains.cs">
<DependentUpon>AppleII.cs</DependentUpon> <DependentUpon>AppleII.cs</DependentUpon>
</Compile> </Compile>

View File

@ -34,7 +34,6 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
public IController Controller { get; set; } public IController Controller { get; set; }
public int Frame { get; set; } public int Frame { get; set; }
public string SystemId { get { return "AppleII"; } } public string SystemId { get { return "AppleII"; } }
@ -51,6 +50,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
public void ResetCounters() public void ResetCounters()
{ {
Frame = 0; Frame = 0;
LagCount = 0;
IsLagFrame = false;
} }
public CoreComm CoreComm { get; private set; } public CoreComm CoreComm { get; private set; }

View File

@ -22,6 +22,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(BinaryWriter writer)
{ {
writer.Write(Frame); writer.Write(Frame);
writer.Write(LagCount);
writer.Write(IsLagFrame);
writer.Write(CurrentDisk); writer.Write(CurrentDisk);
_machine.SaveState(writer); _machine.SaveState(writer);
} }
@ -29,6 +31,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
public void LoadStateBinary(BinaryReader reader) public void LoadStateBinary(BinaryReader reader)
{ {
Frame = reader.ReadInt32(); Frame = reader.ReadInt32();
LagCount = reader.ReadInt32();
IsLagFrame = reader.ReadBoolean();
CurrentDisk = reader.ReadInt32(); CurrentDisk = reader.ReadInt32();
InitDisk(); InitDisk();
_machine.LoadState(reader); _machine.LoadState(reader);

View File

@ -172,6 +172,11 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
_machine.Buttons = GetButtons(); _machine.Buttons = GetButtons();
_machine.BizFrameAdvance(); _machine.BizFrameAdvance();
if (IsLagFrame)
{
LagCount++;
}
Frame++; Frame++;
} }

View File

@ -327,6 +327,7 @@ namespace Jellyfish.Virtu
public void BizFrameAdvance() public void BizFrameAdvance()
{ {
Lagged = true;
Services.GetService<KeyboardService>().Update(); Services.GetService<KeyboardService>().Update();
Services.GetService<GamePortService>().Update(); Services.GetService<GamePortService>().Update();
//frame begins at vsync.. beginning of vblank //frame begins at vsync.. beginning of vblank
@ -384,5 +385,7 @@ namespace Jellyfish.Virtu
private AutoResetEvent _pauseEvent = new AutoResetEvent(false); private AutoResetEvent _pauseEvent = new AutoResetEvent(false);
private AutoResetEvent _unpauseEvent = new AutoResetEvent(false); private AutoResetEvent _unpauseEvent = new AutoResetEvent(false);
public bool Lagged { get; set; }
} }
} }

View File

@ -286,6 +286,7 @@ namespace Jellyfish.Virtu
[SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")] [SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")]
private int ReadIoRegionC0C0(int address) private int ReadIoRegionC0C0(int address)
{ {
Machine.Lagged = false;
switch (address) switch (address)
{ {
case 0xC000: case 0xC001: case 0xC002: case 0xC003: case 0xC004: case 0xC005: case 0xC006: case 0xC007: // [7-15] case 0xC000: case 0xC001: case 0xC002: case 0xC003: case 0xC004: case 0xC005: case 0xC006: case 0xC007: // [7-15]

Binary file not shown.