GFPAK procedural anime config hashes

This commit is contained in:
HelloOO7 2021-01-28 19:19:31 +01:00 committed by KillzXGaming
parent 2c43ccfc3f
commit 1340c1a55f

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -570,22 +570,37 @@ namespace FirstPlugin
hashes.Add(hash);
}
GenerateHashList();
reader.Seek((long)FileInfoOffset, SeekOrigin.Begin);
for (int i = 0; i < FileCount; i++)
{
FileEntry fileEntry = new FileEntry(this);
fileEntry.Read(reader);
string Extension = FindMatch(fileEntry.FileData);
if (Extension.EndsWith("gfbanmcfg"))
{
GFBANMCFG cfg = new GFBANMCFG();
cfg.Load(new MemoryStream(fileEntry.FileData));
GenerateAnmCfgStrings(cfg);
}
files.Add(fileEntry);
}
for (int i = 0; i < FileCount; i++)
{
FileEntry fileEntry = files[i];
for (int f = 0; f < FolderFiles.Count; f++)
if (FolderFiles[f].Index == i)
fileEntry.FolderHash = FolderFiles[f];
var dir = fileEntry.FolderHash.Parent;
fileEntry.Read(reader);
fileEntry.FileName = GetString(hashes[i], fileEntry.FolderHash, fileEntry.FileData);
fileEntry.FilePathHash = hashes[i];
files.Add(fileEntry);
}
}
@ -595,7 +610,6 @@ namespace FirstPlugin
get
{
if (hashList == null) {
hashList = new Dictionary<ulong, string>();
GenerateHashList();
}
return hashList;
@ -604,6 +618,8 @@ namespace FirstPlugin
private void GenerateHashList()
{
hashList = new Dictionary<ulong, string>();
foreach (string hashStr in Properties.Resources.Pkmn.Split('\n'))
{
string HashString = hashStr.TrimEnd();
@ -629,6 +645,14 @@ namespace FirstPlugin
}
}
private void GenerateAnmCfgStrings(GFBANMCFG cfg)
{
foreach (GFBANMCFG.Animation a in cfg.Config.Animations)
{
hashList.Add(FNV64A1.Calculate(a.FileName), a.FileName);
}
}
private void GeneratePokeStrings(string hashStr)
{
//Also check file name just in case