A standalone customized version of Katalash's HKX2 library for Havok packfile deserialization and serialization used in DSMapStudio.
- Supports Breath of the Wild packfiles used on Wii U and Switch (might support other games that use the same classes).
- Supports conversion of packfiles between those two platforms.
- Padding improvements which allow for perfectly matching Navmesh (.hknm2) files.
- Ragdoll files (.hkrg) differ from vanilla files because of different fixup ordering. This issue shouldn't affect functionality.
git submodule add https://gitlab.com/HKX2/HKX2Library <your-repo-dir>/some/path/HKX2Library
Then reference it in your solution and project.
using HKX2;
namespace PlatformConverter
{
internal static class Program
{
private static void Main(string[] args)
{
string inFile = args[0];
string outFile = args[1];
string outPlatform = args[2];
HKXHeader header = outPlatform switch
{
"wiiu" => HKXHeader.BotwWiiu(),
"nx" => HKXHeader.BotwNx(),
_ => throw new ArgumentException("Invalid platform!")
};
using (FileStream rs = File.OpenRead(inFile))
{
var br = new BinaryReaderEx(rs);
var des = new PackFileDeserializer();
var root = (hkRootLevelContainer) des.Deserialize(br);
using (FileStream ws = File.Create(outFile))
{
var bw = new BinaryWriterEx(ws);
var s = new PackFileSerializer();
s.Serialize(root, bw, header);
}
}
}
}
}
./HKX2/Autogen/
contains Havok classes generated from Breath of the Wild reflection information dump../HKX2/Manual/
also contains generated classes, but edited to the best of my patience and capabilities to match both Wii U and Switch files.- Differences in class structure between games and platforms is dependent on Havok version used and platform's header information (pointer size, endian, padding option).
- katalash - The original HKX2 library included in DSMapStudio
- JKAnderson - BinaryReaderEx and BinaryWriterEx included in SoulsFormats