-Copied over the functions I need to implement for GB, leaving FrameAdvance and GetVideoBuffer unimplemented until I fully understand them.

This commit is contained in:
brandman211 2012-05-28 08:37:52 +00:00
parent c813cd853b
commit c3a4b12ca9
3 changed files with 89 additions and 1 deletions

View File

@ -111,6 +111,7 @@
<Compile Include="Consoles\Coleco\VDP.ModeTMS.cs" />
<Compile Include="Consoles\Coleco\VDP.Tables.cs" />
<Compile Include="Consoles\GB\Graphics.cs" />
<Compile Include="Consoles\GB\Input.cs" />
<Compile Include="Consoles\GB\MemoryMap.cs" />
<Compile Include="Consoles\GB\GB.cs" />
<Compile Include="Consoles\Nintendo\NES\APU.cs" />

View File

@ -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<MemoryDomain> 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<MemoryDomain> 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; } }
}
}

View File

@ -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; }
}
}