diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj index 68509e58f0..86c81c48da 100644 --- a/BizHawk.Emulation/BizHawk.Emulation.csproj +++ b/BizHawk.Emulation/BizHawk.Emulation.csproj @@ -111,6 +111,7 @@ + diff --git a/BizHawk.Emulation/Consoles/GB/GB.cs b/BizHawk.Emulation/Consoles/GB/GB.cs index f999202feb..b1bf431432 100644 --- a/BizHawk.Emulation/Consoles/GB/GB.cs +++ b/BizHawk.Emulation/Consoles/GB/GB.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using BizHawk.Emulation.CPUs.Z80GB; /* @@ -8,9 +9,12 @@ contains several comments from the articles. */ namespace BizHawk.Emulation.Consoles.GB { - public partial class GB/* : IEmulator, IVideoProvider */ + public partial class GB : IEmulator, IVideoProvider { private Z80 CPU; + private int lagCount = 0; + private bool isLagFrame = false; + private IList memoryDomains; public GB(GameInfo game, byte[] rom, bool skipBIOS) { @@ -18,11 +22,72 @@ namespace BizHawk.Emulation.Consoles.GB HardReset(); } + public int BufferWidth { get { return 160; } } + public int BufferHeight { get { return 144; } } + public int BackgroundColor { get { return 0; } } + public CoreInputComm CoreInputComm { get; set; } + public CoreOutputComm CoreOutputComm { get; private set; } + public bool DeterministicEmulation { get; set; } + public void Dispose() { } + public int Frame { get; set; } + + public void FrameAdvance(bool render) + { + throw new NotImplementedException(); + } + public void HardReset() { CPU = new CPUs.Z80GB.Z80(); CPU.ReadMemory = ReadMemory; CPU.WriteMemory = WriteMemory; } + + public int[] GetVideoBuffer() + { + throw new NotImplementedException(); + } + + public IList MemoryDomains { get { return memoryDomains; } } + public bool IsLagFrame { get { return isLagFrame; } } + public int LagCount { get { return lagCount; } set { lagCount = value; } } + public void LoadStateBinary(System.IO.BinaryReader reader) + { + throw new NotImplementedException(); + } + + public void LoadStateText(System.IO.TextReader reader) + { + throw new NotImplementedException(); + } + + public MemoryDomain MainMemory { get { return memoryDomains[0]; } } + + public void ResetFrameCounter() + { + Frame = 0; + } + + public byte[] SaveRam { get { throw new NotImplementedException(); } } + public bool SaveRamModified { get { return false; } set { } } + + public void SaveStateBinary(System.IO.BinaryWriter writer) + { + throw new NotImplementedException(); + } + + public byte[] SaveStateBinary() + { + return new byte[0]; + } + + public void SaveStateText(System.IO.TextWriter writer) + { + throw new NotImplementedException(); + } + + public ISoundProvider SoundProvider { get { return new NullEmulator(); } } + public string SystemId { get { return "GB"; } } + public IVideoProvider VideoProvider { get { return this; } } } } diff --git a/BizHawk.Emulation/Consoles/GB/Input.cs b/BizHawk.Emulation/Consoles/GB/Input.cs new file mode 100644 index 0000000000..7f3a0e18ac --- /dev/null +++ b/BizHawk.Emulation/Consoles/GB/Input.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.Emulation.Consoles.GB +{ + public partial class GB + { + public static readonly ControllerDefinition GbController = new ControllerDefinition + { + Name = "Gameboy Controller", + BoolButtons = + { + "Up", "Down", "Left", "Right", "A", "B", "Select", "Start" + } + }; + + public ControllerDefinition ControllerDefinition { get { return GbController; } } + public IController Controller { get; set; } + } +}