straighten out handling of missing archive files
This commit is contained in:
parent
36cc8ba307
commit
f1dd4c625a
|
@ -14,12 +14,7 @@ namespace BizHawk.MultiClient
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// returns whether a bound file exists. if there is no bound file, it can't exist
|
/// returns whether a bound file exists. if there is no bound file, it can't exist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Exists { get { if (!rootExists) return false; return boundStream != null; } }
|
public bool Exists { get { return exists; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// returns whether the root exists (the actual physical file)
|
|
||||||
/// </summary>
|
|
||||||
public bool RootExists { get { return rootExists; } }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// gets the directory containing the root
|
/// gets the directory containing the root
|
||||||
|
@ -32,7 +27,7 @@ namespace BizHawk.MultiClient
|
||||||
public Stream GetStream()
|
public Stream GetStream()
|
||||||
{
|
{
|
||||||
if (boundStream == null)
|
if (boundStream == null)
|
||||||
throw new InvalidOperationException("HawkFil: Can't call GetStream() before youve successfully bound something!");
|
throw new InvalidOperationException("HawkFile: Can't call GetStream() before youve successfully bound something!");
|
||||||
return boundStream;
|
return boundStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,11 +56,6 @@ namespace BizHawk.MultiClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsArchive { get { return extractor != null; } }
|
public bool IsArchive { get { return extractor != null; } }
|
||||||
|
|
||||||
public static bool PathExists(string path)
|
|
||||||
{
|
|
||||||
using (var hf = new HawkFile(path))
|
|
||||||
return hf.Exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ArchiveItem
|
public class ArchiveItem
|
||||||
{
|
{
|
||||||
|
@ -84,6 +74,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
//---
|
//---
|
||||||
|
bool exists;
|
||||||
bool rootExists;
|
bool rootExists;
|
||||||
string rootPath;
|
string rootPath;
|
||||||
string memberPath;
|
string memberPath;
|
||||||
|
@ -108,6 +99,7 @@ namespace BizHawk.MultiClient
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rootPath = path;
|
rootPath = path;
|
||||||
|
exists = true;
|
||||||
|
|
||||||
AnalyzeArchive(path);
|
AnalyzeArchive(path);
|
||||||
if (extractor == null)
|
if (extractor == null)
|
||||||
|
@ -128,6 +120,8 @@ namespace BizHawk.MultiClient
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exists = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.hexEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.hexEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.luaConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.luaConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.nESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.NESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.pPUViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.pPUViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.nameTableViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.nameTableViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.gameGenieCodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.gameGenieCodesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
this.viewToolStripMenuItem,
|
this.viewToolStripMenuItem,
|
||||||
this.configToolStripMenuItem,
|
this.configToolStripMenuItem,
|
||||||
this.toolsToolStripMenuItem,
|
this.toolsToolStripMenuItem,
|
||||||
this.nESToolStripMenuItem,
|
this.NESToolStripMenuItem,
|
||||||
this.helpToolStripMenuItem});
|
this.helpToolStripMenuItem});
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
|
@ -1178,13 +1178,13 @@
|
||||||
//
|
//
|
||||||
// nESToolStripMenuItem
|
// nESToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.nESToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.NESToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.pPUViewerToolStripMenuItem,
|
this.pPUViewerToolStripMenuItem,
|
||||||
this.nameTableViewerToolStripMenuItem,
|
this.nameTableViewerToolStripMenuItem,
|
||||||
this.gameGenieCodesToolStripMenuItem});
|
this.gameGenieCodesToolStripMenuItem});
|
||||||
this.nESToolStripMenuItem.Name = "nESToolStripMenuItem";
|
this.NESToolStripMenuItem.Name = "nESToolStripMenuItem";
|
||||||
this.nESToolStripMenuItem.Size = new System.Drawing.Size(38, 20);
|
this.NESToolStripMenuItem.Size = new System.Drawing.Size(38, 20);
|
||||||
this.nESToolStripMenuItem.Text = "&NES";
|
this.NESToolStripMenuItem.Text = "&NES";
|
||||||
//
|
//
|
||||||
// pPUViewerToolStripMenuItem
|
// pPUViewerToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
@ -1381,7 +1381,7 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveConfigToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem saveConfigToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem loadConfigToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem loadConfigToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem replayInputLogToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem replayInputLogToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem nESToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem NESToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem pPUViewerToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem pPUViewerToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem nameTableViewerToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem nameTableViewerToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem gameGenieCodesToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem gameGenieCodesToolStripMenuItem;
|
||||||
|
|
|
@ -381,10 +381,10 @@ namespace BizHawk.MultiClient
|
||||||
switch (system)
|
switch (system)
|
||||||
{
|
{
|
||||||
case "NES":
|
case "NES":
|
||||||
nESToolStripMenuItem.Visible = true;
|
NESToolStripMenuItem.Visible = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nESToolStripMenuItem.Visible = false;
|
NESToolStripMenuItem.Visible = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ namespace BizHawk.MultiClient
|
||||||
using (var file = new HawkFile(path))
|
using (var file = new HawkFile(path))
|
||||||
{
|
{
|
||||||
//if the provided file doesnt even exist, give up!
|
//if the provided file doesnt even exist, give up!
|
||||||
if (!file.RootExists) return false;
|
if (!file.Exists) return false;
|
||||||
|
|
||||||
//try binding normal rom extensions first
|
//try binding normal rom extensions first
|
||||||
if (!file.IsBound)
|
if (!file.IsBound)
|
||||||
|
@ -1097,7 +1097,7 @@ namespace BizHawk.MultiClient
|
||||||
private void MainForm_Load(object sender, EventArgs e)
|
private void MainForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//Hide platform specific menus until an appropriate ROM is loaded
|
//Hide platform specific menus until an appropriate ROM is loaded
|
||||||
nESToolStripMenuItem.Visible = false;
|
NESToolStripMenuItem.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frameSkipToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
private void frameSkipToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace BizHawk.MultiClient
|
||||||
using (var patchFile = new HawkFile(patch))
|
using (var patchFile = new HawkFile(patch))
|
||||||
{
|
{
|
||||||
patchFile.BindFirstOf("IPS");
|
patchFile.BindFirstOf("IPS");
|
||||||
if(patchFile.Exists)
|
if(patchFile.IsBound)
|
||||||
IPS.Patch(RomData, patchFile.GetStream());
|
IPS.Patch(RomData, patchFile.GetStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue