XMLGame now populates GameInfo.Hash with a combined hash of the loadassets, so dual gameboy movies have sensible hashes
This commit is contained in:
parent
84b271684b
commit
c998512a45
|
@ -32,10 +32,13 @@ namespace BizHawk.MultiClient
|
||||||
var n = y.SelectSingleNode("./LoadAssets");
|
var n = y.SelectSingleNode("./LoadAssets");
|
||||||
if (n != null)
|
if (n != null)
|
||||||
{
|
{
|
||||||
|
MemoryStream HashStream = new MemoryStream();
|
||||||
|
|
||||||
foreach (XmlNode a in n.ChildNodes)
|
foreach (XmlNode a in n.ChildNodes)
|
||||||
{
|
{
|
||||||
string name = a.Name;
|
string name = a.Name;
|
||||||
string filename = a.Attributes["FileName"].Value;
|
string filename = a.Attributes["FileName"].Value;
|
||||||
|
byte[] data;
|
||||||
if (filename[0] == '|')
|
if (filename[0] == '|')
|
||||||
{
|
{
|
||||||
// in same archive
|
// in same archive
|
||||||
|
@ -43,8 +46,7 @@ namespace BizHawk.MultiClient
|
||||||
if (ai != null)
|
if (ai != null)
|
||||||
{
|
{
|
||||||
f.BindArchiveMember(ai);
|
f.BindArchiveMember(ai);
|
||||||
byte[] data = Util.ReadAllBytes(f.GetStream());
|
data = Util.ReadAllBytes(f.GetStream());
|
||||||
ret.Assets[name] = data;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -58,20 +60,33 @@ namespace BizHawk.MultiClient
|
||||||
fullpath = Path.Combine(fullpath, filename);
|
fullpath = Path.Combine(fullpath, filename);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
byte[] data = File.ReadAllBytes(fullpath);
|
data = File.ReadAllBytes(fullpath);
|
||||||
ret.Assets[name] = data;
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
throw new Exception("Couldn't load XMLGame LoadAsset \"" + name + "\"");
|
throw new Exception("Couldn't load XMLGame LoadAsset \"" + name + "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ret.Assets[name] = data;
|
||||||
|
|
||||||
|
using (var sha1 = System.Security.Cryptography.SHA1.Create())
|
||||||
|
{
|
||||||
|
sha1.TransformFinalBlock(data, 0, data.Length);
|
||||||
|
HashStream.Write(sha1.Hash, 0, sha1.Hash.Length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ret.GI.Hash = Util.Hash_SHA1(HashStream.GetBuffer(), 0, (int)HashStream.Length);
|
||||||
|
HashStream.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.GI.Hash = "0000000000000000000000000000000000000000";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
System.Windows.Forms.MessageBox.Show(e.ToString(), "XMLGame Load Error");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue