XMLGame: fix reboot core in the case of hawkfile embedded assets
This commit is contained in:
parent
086c8bcad2
commit
b0cbe204a9
|
@ -84,6 +84,13 @@ namespace BizHawk.MultiClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsArchive { get { return extractor != null; } }
|
public bool IsArchive { get { return extractor != null; } }
|
||||||
|
|
||||||
|
int? BoundIndex = null;
|
||||||
|
|
||||||
|
public int? GetBoundIndex()
|
||||||
|
{
|
||||||
|
return BoundIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ArchiveItem
|
public class ArchiveItem
|
||||||
{
|
{
|
||||||
|
@ -246,7 +253,7 @@ namespace BizHawk.MultiClient
|
||||||
boundStream.Position = 0;
|
boundStream.Position = 0;
|
||||||
memberPath = FixArchiveFilename(extractor.ArchiveFileNames[archiveIndex]); //TODO - maybe go through our own list of names? maybe not, its indexes dont match..
|
memberPath = FixArchiveFilename(extractor.ArchiveFileNames[archiveIndex]); //TODO - maybe go through our own list of names? maybe not, its indexes dont match..
|
||||||
Console.WriteLine("HawkFile bound " + CanonicalFullPath);
|
Console.WriteLine("HawkFile bound " + CanonicalFullPath);
|
||||||
|
BoundIndex = archiveIndex;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +265,7 @@ namespace BizHawk.MultiClient
|
||||||
if (boundStream != null && boundStream != rootStream) boundStream.Close();
|
if (boundStream != null && boundStream != rootStream) boundStream.Close();
|
||||||
boundStream = null;
|
boundStream = null;
|
||||||
memberPath = null;
|
memberPath = null;
|
||||||
|
BoundIndex = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -34,6 +34,8 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
MemoryStream HashStream = new MemoryStream();
|
MemoryStream HashStream = new MemoryStream();
|
||||||
|
|
||||||
|
int? OriginalIndex = null;
|
||||||
|
|
||||||
foreach (XmlNode a in n.ChildNodes)
|
foreach (XmlNode a in n.ChildNodes)
|
||||||
{
|
{
|
||||||
string name = a.Name;
|
string name = a.Name;
|
||||||
|
@ -45,6 +47,8 @@ namespace BizHawk.MultiClient
|
||||||
var ai = f.FindArchiveMember(filename.Substring(1));
|
var ai = f.FindArchiveMember(filename.Substring(1));
|
||||||
if (ai != null)
|
if (ai != null)
|
||||||
{
|
{
|
||||||
|
if (OriginalIndex == null)
|
||||||
|
OriginalIndex = f.GetBoundIndex();
|
||||||
f.Unbind();
|
f.Unbind();
|
||||||
f.BindArchiveMember(ai);
|
f.BindArchiveMember(ai);
|
||||||
data = Util.ReadAllBytes(f.GetStream());
|
data = Util.ReadAllBytes(f.GetStream());
|
||||||
|
@ -78,6 +82,11 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
ret.GI.Hash = Util.Hash_SHA1(HashStream.GetBuffer(), 0, (int)HashStream.Length);
|
ret.GI.Hash = Util.Hash_SHA1(HashStream.GetBuffer(), 0, (int)HashStream.Length);
|
||||||
HashStream.Close();
|
HashStream.Close();
|
||||||
|
if (OriginalIndex != null)
|
||||||
|
{
|
||||||
|
f.Unbind();
|
||||||
|
f.BindArchiveMember((int)OriginalIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue