diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 045bf03234..a8884ae6be 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -238,6 +238,7 @@ Component + Form diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index ad8c01f91e..4d563db72a 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -67,6 +67,7 @@ namespace BizHawk.MultiClient public MainForm(string[] args) { InitializeComponent(); + Global.Game = new NullGame(); if (Global.Config.ShowLogWindow) { LogConsole.ShowConsole(); @@ -804,6 +805,7 @@ namespace BizHawk.MultiClient public bool LoadRom(string path) { + if (path == null) return false; using (var file = new HawkFile()) { string[] romExtensions = new string[] { "SMS", "PCE", "SGX", "GG", "SG", "BIN", "SMD", "GB", "NES", "ROM" }; @@ -2013,7 +2015,7 @@ namespace BizHawk.MultiClient { CloseGame(); Global.Emulator = new NullEmulator(); - Global.Game = null; + Global.Game = new NullGame(); RamSearch1.Restart(); RamWatch1.Restart(); HexEditor1.Restart(); diff --git a/BizHawk.MultiClient/NullGame.cs b/BizHawk.MultiClient/NullGame.cs new file mode 100644 index 0000000000..ca6b776feb --- /dev/null +++ b/BizHawk.MultiClient/NullGame.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; + +namespace BizHawk.MultiClient +{ + public class NullGame : RomGame + { + private List options; + private const int BankSize = 4096; + new public RomStatus Status { get; private set; } + new public string Name { get { return "Null Game"; } set { } } + new public string FilesystemSafeName { get { return "Null Game"; } } + + public NullGame() + { + FileData = new byte[1]; + FileData[0] = new byte(); + RomData = new byte[1]; + RomData[0] = new byte(); + System = "Null"; + Status = RomStatus.GoodDump; + options = new List(); + options.Add("null"); + } + + private byte[] DeInterleaveSMD(byte[] source) + { + return FileData; + } + + private void CheckForPatchOptions() + { + } + + new public string SaveRamPath + { + get + { + return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.BasePath, ""), "Null Game.SaveRAM"); + } + } + + + + new public string SaveStatePrefix + { + get + { + string Bind = ""; + if (Global.Config.BindSavestatesToMovies && Global.MainForm.UserMovie.Mode != MOVIEMODE.INACTIVE) + Bind += " - " + Path.GetFileNameWithoutExtension(Global.MainForm.UserMovie.Filename); + + return Path.Combine(PathManager.MakeAbsolutePath(Global.Config.BasePath, ""), "Null Game" + Bind); + } + } + + new public string MoviePrefix + { + get + { + return PathManager.MakeAbsolutePath(Global.Config.BasePath, "") + "Null Game"; + } + } + + new public string ScreenshotPrefix + { + get + { + return PathManager.MakeAbsolutePath(Global.Config.BasePath, "") + "/" + "Null Game"; + } + } + } +} diff --git a/BizHawk.MultiClient/RecordMovie.cs b/BizHawk.MultiClient/RecordMovie.cs index 24f96797d4..1d891f2e38 100644 --- a/BizHawk.MultiClient/RecordMovie.cs +++ b/BizHawk.MultiClient/RecordMovie.cs @@ -86,7 +86,7 @@ namespace BizHawk.MultiClient MovieToRecord.Header.Comments.Add(str); } } - + file.Delete(); } Global.MainForm.StartNewMovie(MovieToRecord, true); @@ -112,7 +112,7 @@ namespace BizHawk.MultiClient sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, ""); sfd.DefaultExt = ".tas"; sfd.FileName = Global.Game.FilesystemSafeName; - sfd.Filter = "Movie files (*.tas)|*.TAS"; + sfd.Filter = "Movie files (*.tas)|*.tas"; Global.Sound.StopSound(); var result = sfd.ShowDialog(); diff --git a/BizHawk.MultiClient/RomGame.cs b/BizHawk.MultiClient/RomGame.cs index 2c2f1de2e9..309357e2c7 100644 --- a/BizHawk.MultiClient/RomGame.cs +++ b/BizHawk.MultiClient/RomGame.cs @@ -10,7 +10,7 @@ namespace BizHawk.MultiClient public byte[] RomData; public byte[] FileData; public string System; - public RomStatus Status { get; private set; } + public RomStatus Status { get; private set; } private string name; private string filesystemSafeName;