lets try something that compiles

This commit is contained in:
goyuken 2014-12-05 02:39:42 +00:00
parent 92de864fab
commit 1f9b4d23fe
2 changed files with 30 additions and 38 deletions
BizHawk.Emulation.Cores/Consoles/Nintendo

View File

@ -24,7 +24,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
ServiceProvider = new BasicServiceProvider(this);
CoreComm = comm;
MemoryCallbacks = new MemoryCallbackSystem();
byte[] biosfile = CoreComm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory.");
if (file.Length > 32 * 1024 * 1024)
@ -306,7 +305,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
LibVBANext.SetWriteCallback(Core, MemoryCallbacks.HasWrites ? writecb : null);
}
void SyncTracerCallback()
void SyncTraceCallback()
{
LibVBANext.SetTraceCallback(Core, Tracer.Enabled ? tracecb : null);
}

View File

@ -36,20 +36,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
public int LagCount { get; set; }
public bool IsLagFrame { get; private set; }
private InputCallbackSystem _inputCallbacks = new InputCallbackSystem();
// low priority TODO: due to certain aspects of the core implementation,
// we don't smartly use the ActiveChanged event here.
public IInputCallbackSystem InputCallbacks { get { return _inputCallbacks; } }
/// <summary>
/// for use in dual core
/// </summary>
/// <param name="ics"></param>
public void ConnectInputCallbackSystem(InputCallbackSystem ics)
{
_inputCallbacks = ics;
}
// all cycle counts are relative to a 2*1024*1024 mhz refclock
/// <summary>
@ -140,7 +126,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
ServiceProvider = new BasicServiceProvider(this);
Tracer = new TraceBuffer();
MemoryCallbacks = new MemoryCallbackSystem();
InitMemoryCallbacks();
CoreComm = comm;
comm.VsyncNum = 262144;
@ -277,8 +263,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
public ITracer Tracer { get; private set; }
public IMemoryCallbackSystem MemoryCallbacks { get; private set; }
/// <summary>
/// true if the emulator is currently emulating CGB
/// </summary>
@ -288,6 +272,20 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
return (LibGambatte.gambatte_iscgb(GambatteState));
}
private InputCallbackSystem _inputCallbacks = new InputCallbackSystem();
// low priority TODO: due to certain aspects of the core implementation,
// we don't smartly use the ActiveChanged event here.
public IInputCallbackSystem InputCallbacks { get { return _inputCallbacks; } }
/// <summary>
/// for use in dual core
/// </summary>
/// <param name="ics"></param>
public void ConnectInputCallbackSystem(InputCallbackSystem ics)
{
_inputCallbacks = ics;
}
#endregion
internal void FrameAdvancePrep()
@ -320,7 +318,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
if (Controller["Power"])
LibGambatte.gambatte_reset(GambatteState, GetCurrentTime());
RefreshMemoryCallbacks();
if (Tracer.Enabled)
tracecb = MakeTrace;
else
@ -644,28 +641,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
LibGambatte.MemoryCallback writecb;
LibGambatte.MemoryCallback execcb;
private readonly MemoryCallbackSystem _memorycallbacks = new MemoryCallbackSystem();
public IMemoryCallbackSystem MemoryCallbacks { get { return _memorycallbacks; } }
void InitMemoryCallbacks()
{
readcb = (addr) => MemoryCallbacks.CallRead(addr);
writecb = (addr) => MemoryCallbacks.CallWrite(addr);
execcb = (addr) => MemoryCallbacks.CallExecute(addr);
_memorycallbacks.ActiveChanged += RefreshMemoryCallbacks;
}
void RefreshMemoryCallbacks()
{
var mcs = MemoryCallbacks;
// we RefreshMemoryCallbacks() after the triggers in case the trigger turns itself off at that point
if (mcs.HasReads)
readcb = delegate(uint addr) { mcs.CallRead(addr); RefreshMemoryCallbacks(); };
else
readcb = null;
if (mcs.HasWrites)
writecb = delegate(uint addr) { mcs.CallWrite(addr); RefreshMemoryCallbacks(); };
else
writecb = null;
if (mcs.HasExecutes)
execcb = delegate(uint addr) { mcs.CallExecute(addr); RefreshMemoryCallbacks(); };
else
execcb = null;
LibGambatte.gambatte_setreadcallback(GambatteState, readcb);
LibGambatte.gambatte_setwritecallback(GambatteState, writecb);
LibGambatte.gambatte_setexeccallback(GambatteState, execcb);
LibGambatte.gambatte_setreadcallback(GambatteState, mcs.HasReads ? readcb : null);
LibGambatte.gambatte_setwritecallback(GambatteState, mcs.HasWrites ? writecb : null);
LibGambatte.gambatte_setexeccallback(GambatteState, mcs.HasExecutes ? execcb : null);
}
#endregion