XmlGame - support an xml that refers to roms in archives
This commit is contained in:
parent
5f2e2f39b2
commit
bc1115d62d
|
@ -55,7 +55,7 @@ namespace BizHawk.Client.Common
|
||||||
foreach (XmlNode a in n.ChildNodes)
|
foreach (XmlNode a in n.ChildNodes)
|
||||||
{
|
{
|
||||||
string filename = a.Attributes["FileName"].Value;
|
string filename = a.Attributes["FileName"].Value;
|
||||||
byte[] data;
|
byte[] data = new byte[0];
|
||||||
if (filename[0] == '|')
|
if (filename[0] == '|')
|
||||||
{
|
{
|
||||||
// in same archive
|
// in same archive
|
||||||
|
@ -83,7 +83,22 @@ namespace BizHawk.Client.Common
|
||||||
fullpath = Path.Combine(fullpath, filename.Split('|').First());
|
fullpath = Path.Combine(fullpath, filename.Split('|').First());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
data = File.ReadAllBytes(fullpath.Split('|').First());
|
using (var hf = new HawkFile(fullpath))
|
||||||
|
{
|
||||||
|
if (hf.IsArchive)
|
||||||
|
{
|
||||||
|
var archiveItem = hf.ArchiveItems.First(ai => ai.Name == filename.Split('|').Skip(1).First());
|
||||||
|
hf.Unbind();
|
||||||
|
hf.BindArchiveMember(archiveItem);
|
||||||
|
data = hf.GetStream().ReadAllBytes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = File.ReadAllBytes(fullpath.Split('|').First());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue