Add NullGame as an inherited class of RomGame and assign Global.Game to this instead of null whenever a ROM is not loaded. This fixes using the record dialog with no game loaded and lots of other situations during Null Emulator. Also cleaned up the record dialog a bit
This commit is contained in:
parent
2e68314e01
commit
ccae3cc1c9
|
@ -238,6 +238,7 @@
|
||||||
<Compile Include="NEStools\SpriteViewer.cs">
|
<Compile Include="NEStools\SpriteViewer.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="NullGame.cs" />
|
||||||
<Compile Include="PlayMovie.cs">
|
<Compile Include="PlayMovie.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace BizHawk.MultiClient
|
||||||
public MainForm(string[] args)
|
public MainForm(string[] args)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Global.Game = new NullGame();
|
||||||
if (Global.Config.ShowLogWindow)
|
if (Global.Config.ShowLogWindow)
|
||||||
{
|
{
|
||||||
LogConsole.ShowConsole();
|
LogConsole.ShowConsole();
|
||||||
|
@ -804,6 +805,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public bool LoadRom(string path)
|
public bool LoadRom(string path)
|
||||||
{
|
{
|
||||||
|
if (path == null) return false;
|
||||||
using (var file = new HawkFile())
|
using (var file = new HawkFile())
|
||||||
{
|
{
|
||||||
string[] romExtensions = new string[] { "SMS", "PCE", "SGX", "GG", "SG", "BIN", "SMD", "GB", "NES", "ROM" };
|
string[] romExtensions = new string[] { "SMS", "PCE", "SGX", "GG", "SG", "BIN", "SMD", "GB", "NES", "ROM" };
|
||||||
|
@ -2013,7 +2015,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
CloseGame();
|
CloseGame();
|
||||||
Global.Emulator = new NullEmulator();
|
Global.Emulator = new NullEmulator();
|
||||||
Global.Game = null;
|
Global.Game = new NullGame();
|
||||||
RamSearch1.Restart();
|
RamSearch1.Restart();
|
||||||
RamWatch1.Restart();
|
RamWatch1.Restart();
|
||||||
HexEditor1.Restart();
|
HexEditor1.Restart();
|
||||||
|
|
|
@ -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<string> 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<String>();
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -86,7 +86,7 @@ namespace BizHawk.MultiClient
|
||||||
MovieToRecord.Header.Comments.Add(str);
|
MovieToRecord.Header.Comments.Add(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.MainForm.StartNewMovie(MovieToRecord, true);
|
Global.MainForm.StartNewMovie(MovieToRecord, true);
|
||||||
|
@ -112,7 +112,7 @@ namespace BizHawk.MultiClient
|
||||||
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
|
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, "");
|
||||||
sfd.DefaultExt = ".tas";
|
sfd.DefaultExt = ".tas";
|
||||||
sfd.FileName = Global.Game.FilesystemSafeName;
|
sfd.FileName = Global.Game.FilesystemSafeName;
|
||||||
sfd.Filter = "Movie files (*.tas)|*.TAS";
|
sfd.Filter = "Movie files (*.tas)|*.tas";
|
||||||
|
|
||||||
Global.Sound.StopSound();
|
Global.Sound.StopSound();
|
||||||
var result = sfd.ShowDialog();
|
var result = sfd.ShowDialog();
|
||||||
|
|
Loading…
Reference in New Issue