diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index a3e5a58ef3..394c9102b0 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -173,6 +173,7 @@
+
diff --git a/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs b/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs
new file mode 100644
index 0000000000..9a2f67efac
--- /dev/null
+++ b/BizHawk.Emulation/Consoles/Nintendo/N64/N64.cs
@@ -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 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;
+ }
+ }
+}
diff --git a/BizHawk.Emulation/Database/Database.cs b/BizHawk.Emulation/Database/Database.cs
index 2a79a804e8..77070200e3 100644
--- a/BizHawk.Emulation/Database/Database.cs
+++ b/BizHawk.Emulation/Database/Database.cs
@@ -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('_', ' ');
diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs
index d89a1ccd2d..dd6600f3ea 100644
--- a/BizHawk.MultiClient/MainForm.cs
+++ b/BizHawk.MultiClient/MainForm.cs
@@ -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