N64: Adding a dummy emulator

This commit is contained in:
pjgat09 2013-04-29 01:57:41 +00:00
parent 8a56a46900
commit a4fb43185a
4 changed files with 109 additions and 2 deletions

View File

@ -173,6 +173,7 @@
<Compile Include="Consoles\Nintendo\Gameboy\LibGambatte.cs" />
<Compile Include="Consoles\Nintendo\GBA\LibMeteor.cs" />
<Compile Include="Consoles\Nintendo\GBA\Meteor.cs" />
<Compile Include="Consoles\Nintendo\N64\N64.cs" />
<Compile Include="Consoles\Nintendo\NES\APU.cs" />
<Compile Include="Consoles\Nintendo\NES\BoardSystem.cs" />
<Compile Include="Consoles\Nintendo\NES\Boards\AVE-NINA.cs" />

View File

@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
namespace BizHawk.Emulation.Consoles.Nintendo.N64
{
public class N64 : IEmulator, IVideoProvider, ISoundProvider
{
public string SystemId { get { return "N64"; } }
public CoreComm CoreComm { get; private set; }
public byte[] rom;
public GameInfo game;
public IVideoProvider VideoProvider { get { return this; } }
public int[] frameBuffer = new int[640 * 480];
public int[] GetVideoBuffer() { return frameBuffer; }
public int VirtualWidth { get { return 640; } }
public int BufferWidth { get { return 640; } }
public int BufferHeight { get { return 480; } }
public int BackgroundColor { get { return 0; } }
public ISoundProvider SoundProvider { get { return this; } }
public void GetSamples(short[] samples) { }
public void DiscardSamples() { }
public int MaxVolume { get; set; }
public ISyncSoundProvider SyncSoundProvider { get { return null; } }
public bool StartAsyncSound() { return true; }
public void EndAsyncSound() { }
public ControllerDefinition ControllerDefinition { get { return N64ControllerDefinition; } }
public IController Controller { get; set; }
public static readonly ControllerDefinition N64ControllerDefinition = new ControllerDefinition
{
Name = "Nintento 64 Controller",
BoolButtons =
{
"DPad R", "DPad L", "DPad D", "DPad U", "Start", "Z", "B", "A", "C Right", "C Left", "C Down", "C Up", "R", "L"
}
};
public int Frame { get; set; }
public int LagCount { get; set; }
public bool IsLagFrame { get { return true; } }
public void ResetFrameCounter() { }
public void FrameAdvance(bool render, bool rendersound) { Frame++; }
public bool DeterministicEmulation { get; set; }
public byte[] ReadSaveRam() { return null; }
public void StoreSaveRam(byte[] data) { }
public void ClearSaveRam() { }
public bool SaveRamModified { get; set; }
void SyncState(Serializer ser)
{
ser.BeginSection("N64");
ser.EndSection();
}
public void SaveStateText(TextWriter writer) { SyncState(Serializer.CreateTextWriter(writer)); }
public void LoadStateText(TextReader reader) { SyncState(Serializer.CreateTextReader(reader)); }
public void SaveStateBinary(BinaryWriter bw) { SyncState(Serializer.CreateBinaryWriter(bw)); }
public void LoadStateBinary(BinaryReader br) { SyncState(Serializer.CreateBinaryReader(br)); }
public byte[] SaveStateBinary()
{
MemoryStream ms = new MemoryStream();
BinaryWriter bw = new BinaryWriter(ms);
SaveStateBinary(bw);
bw.Flush();
return ms.ToArray();
}
public IList<MemoryDomain> MemoryDomains { get { return null; } }
public MemoryDomain MainMemory { get { return null; } }
public void Dispose() { }
public N64(CoreComm comm, GameInfo game, byte[] rom)
{
CoreComm = comm;
this.rom = rom;
this.game = game;
}
}
}

View File

@ -168,6 +168,12 @@ namespace BizHawk
case ".GBA":
Game.System = "GBA";
break;
case ".Z64":
case ".V64":
case ".N64":
Game.System = "N64";
break;
}
Game.Name = Path.GetFileNameWithoutExtension(fileName).Replace('_', ' ');

View File

@ -20,6 +20,7 @@ using BizHawk.Emulation.Consoles.GB;
using BizHawk.Emulation.Consoles.Nintendo.GBA;
using BizHawk.Emulation.Computers.Commodore64;
using BizHawk.Emulation;
using BizHawk.Emulation.Consoles.Nintendo.N64;
namespace BizHawk.MultiClient
{
@ -1566,6 +1567,7 @@ namespace BizHawk.MultiClient
case "C64": str += "Commodore 64"; break;
case "Coleco": str += "ColecoVision"; break;
case "GBA": str += "Game Boy Advance"; break;
case "N64": str += "Nintendo 64"; break;
}
if (INTERIM) str += " (interim)";
@ -1797,7 +1799,7 @@ namespace BizHawk.MultiClient
if (path == null) return false;
using (var file = new HawkFile())
{
string[] romExtensions = new[] { "SMS", "SMC", "SFC", "PCE", "SGX", "GG", "SG", "BIN", "GEN", "MD", "SMD", "GB", "NES", "FDS", "ROM", "INT", "GBC", "UNF", "A78", "CRT", "COL", "XML" };
string[] romExtensions = new[] { "SMS", "SMC", "SFC", "PCE", "SGX", "GG", "SG", "BIN", "GEN", "MD", "SMD", "GB", "NES", "FDS", "ROM", "INT", "GBC", "UNF", "A78", "CRT", "COL", "XML", "Z64", "V64", "N64" };
//lets not use this unless we need to
//file.NonArchiveExtensions = romExtensions;
@ -2231,6 +2233,12 @@ namespace BizHawk.MultiClient
nextEmulator = gba;
}
break;
case "N64":
if (INTERIM)
{
nextEmulator = new N64(nextComm, game, rom.RomData);
}
break;
}
}
@ -3667,7 +3675,7 @@ namespace BizHawk.MultiClient
if (INTERIM)
{
ofd.Filter = FormatFilter(
"Rom Files", "*.nes;*.fds;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.cue;*.exe;*.gb;*.gbc;*.gen;*.md;*.col;.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.sgb;*.xml;%ARCH%",
"Rom Files", "*.nes;*.fds;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.cue;*.exe;*.gb;*.gbc;*.gen;*.md;*.col;.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.sgb;*.xml;*.z64;*.v64;*.n64;%ARCH%",
"Music Files", "*.psf;*.sid",
"Disc Images", "*.cue",
"NES", "*.nes;*.fds;%ARCH%",
@ -3687,6 +3695,7 @@ namespace BizHawk.MultiClient
"PSF Playstation Sound File (very experimental)", "*.psf",
"Commodore 64 (experimental)", "*.prg; *.d64, *.g64; *.crt;%ARCH%",
"SID Commodore 64 Music File", "*.sid;%ARCH%",
"Nintendo 64", "*.z64;*.v64;*.n64",
"All Files", "*.*");
}
else