AsInputPollable()
This commit is contained in:
parent
e2033c9d2e
commit
f5cc38c9cd
|
@ -152,7 +152,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (Global.Emulator.CanPollInput())
|
if (Global.Emulator.CanPollInput())
|
||||||
{
|
{
|
||||||
return (Global.Emulator as IInputPollable).IsLagFrame;
|
return Global.Emulator.AsInputPollable().IsLagFrame;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (Global.Emulator.CanPollInput())
|
if (Global.Emulator.CanPollInput())
|
||||||
{
|
{
|
||||||
return (Global.Emulator as IInputPollable).LagCount;
|
return Global.Emulator.AsInputPollable().LagCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -161,7 +161,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
(Global.Emulator as IInputPollable).InputCallbacks.Add(nlf.Callback);
|
Global.Emulator.AsInputPollable().InputCallbacks.Add(nlf.Callback);
|
||||||
}
|
}
|
||||||
catch (NotImplementedException)
|
catch (NotImplementedException)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (Global.Emulator.CanPollInput())
|
if (Global.Emulator.CanPollInput())
|
||||||
{
|
{
|
||||||
(Global.Emulator as IInputPollable).InputCallbacks.Remove(function.Callback);
|
Global.Emulator.AsInputPollable().InputCallbacks.Remove(function.Callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.Emulator.CoreComm.MemoryCallbackSystem.Remove(function.Callback);
|
Global.Emulator.CoreComm.MemoryCallbackSystem.Remove(function.Callback);
|
||||||
|
@ -31,7 +31,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (Global.Emulator.CanPollInput())
|
if (Global.Emulator.CanPollInput())
|
||||||
{
|
{
|
||||||
(Global.Emulator as IInputPollable).InputCallbacks.RemoveAll(this.Select(x => x.Callback));
|
Global.Emulator.AsInputPollable().InputCallbacks.RemoveAll(this.Select(x => x.Callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.Emulator.CoreComm.MemoryCallbackSystem.RemoveAll(this.Select(x => x.Callback));
|
Global.Emulator.CoreComm.MemoryCallbackSystem.RemoveAll(this.Select(x => x.Callback));
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||||
|
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
|
@ -23,10 +23,10 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (frame == LagLog.Count)
|
if (frame == LagLog.Count)
|
||||||
{
|
{
|
||||||
LagLog[frame] = (Global.Emulator as IInputPollable).IsLagFrame; // Note: Side effects!
|
LagLog[frame] = Global.Emulator.AsInputPollable().IsLagFrame; // Note: Side effects!
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Global.Emulator as IInputPollable).IsLagFrame;
|
return Global.Emulator.AsInputPollable().IsLagFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||||
|
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||||
|
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
|
@ -15,7 +16,7 @@ namespace BizHawk.Client.Common
|
||||||
base.RecordFrame(frame, source);
|
base.RecordFrame(frame, source);
|
||||||
|
|
||||||
LagLog.RemoveFrom(frame);
|
LagLog.RemoveFrom(frame);
|
||||||
LagLog[frame] = (Global.Emulator as IInputPollable).IsLagFrame;
|
LagLog[frame] = Global.Emulator.AsInputPollable().IsLagFrame;
|
||||||
|
|
||||||
StateManager.Capture();
|
StateManager.Capture();
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,7 +306,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (frame == Global.Emulator.Frame) // Take this opportunity to capture lag and state info if we do not have it
|
if (frame == Global.Emulator.Frame) // Take this opportunity to capture lag and state info if we do not have it
|
||||||
{
|
{
|
||||||
LagLog[Global.Emulator.Frame] = (Global.Emulator as IInputPollable).IsLagFrame;
|
LagLog[Global.Emulator.Frame] = Global.Emulator.AsInputPollable().IsLagFrame;
|
||||||
|
|
||||||
if (!StateManager.HasState(frame))
|
if (!StateManager.HasState(frame))
|
||||||
{
|
{
|
||||||
|
|
|
@ -390,7 +390,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Global.Config.DisplayLagCounter && Global.Emulator.CanPollInput())
|
if (Global.Config.DisplayLagCounter && Global.Emulator.CanPollInput())
|
||||||
{
|
{
|
||||||
var counter = (Global.Emulator as IInputPollable).LagCount.ToString();
|
var counter = Global.Emulator.AsInputPollable().LagCount.ToString();
|
||||||
var x = GetX(g, Global.Config.DispLagx, Global.Config.DispLaganchor, counter);
|
var x = GetX(g, Global.Config.DispLagx, Global.Config.DispLaganchor, counter);
|
||||||
var y = GetY(g, Global.Config.DispLagy, Global.Config.DispLaganchor, counter);
|
var y = GetY(g, Global.Config.DispLagy, Global.Config.DispLaganchor, counter);
|
||||||
|
|
||||||
|
|
|
@ -2651,7 +2651,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (Global.Emulator.CanPollInput())
|
if (Global.Emulator.CanPollInput())
|
||||||
{
|
{
|
||||||
return (Global.Emulator as IInputPollable).IsLagFrame;
|
return Global.Emulator.AsInputPollable().IsLagFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -183,7 +183,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// some cores really really really like it if you drain their audio every frame
|
// some cores really really really like it if you drain their audio every frame
|
||||||
emu.SyncSoundProvider.GetSamples(out samp, out nsamp);
|
emu.SyncSoundProvider.GetSamples(out samp, out nsamp);
|
||||||
current.Frames++;
|
current.Frames++;
|
||||||
if (emu.CanPollInput() && (emu as IInputPollable).IsLagFrame)
|
if (emu.CanPollInput() && emu.AsInputPollable().IsLagFrame)
|
||||||
current.LaggedFrames++;
|
current.LaggedFrames++;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.IO;
|
||||||
|
|
||||||
using BizHawk.Common.BufferExtensions;
|
using BizHawk.Common.BufferExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi;
|
using BizHawk.Emulation.Cores.Nintendo.N64.NativeApi;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Nintendo.N64
|
namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||||
|
@ -123,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
||||||
// Order is important because the register with the mupen core
|
// Order is important because the register with the mupen core
|
||||||
_videoProvider = new N64VideoProvider(api, videosettings);
|
_videoProvider = new N64VideoProvider(api, videosettings);
|
||||||
_audioProvider = new N64Audio(api);
|
_audioProvider = new N64Audio(api);
|
||||||
_inputProvider = new N64Input(this as IInputPollable, api, comm, this._syncSettings.Controllers);
|
_inputProvider = new N64Input(this.AsInputPollable(), api, comm, this._syncSettings.Controllers);
|
||||||
|
|
||||||
|
|
||||||
string rsp = _syncSettings.Rsp == N64SyncSettings.RspType.Rsp_Hle ?
|
string rsp = _syncSettings.Rsp == N64SyncSettings.RspType.Rsp_Hle ?
|
||||||
|
|
Loading…
Reference in New Issue