Coder Social home page Coder Social logo

hkx2library's Introduction

HKX2Library

A standalone customized version of Katalash's HKX2 library for Havok packfile deserialization and serialization used in DSMapStudio.

This fork modified classes for Skyrim SE hkx file.

Differences

  • Serialize and Deserialize .hkx file. (include behaviors, skeleton and aniamtions)
  • Export to XML.
  • XML to HKX use figment/hkxcmd, nexus
  • Supports Breath of the Wild packfiles used on Wii U and Switch (might support other games that use the same classes). (Skyrim SE only)
  • Supports conversion of packfiles between those two platforms. (SE only)

Known issues

  • Ragdoll files (.hkrg) differ from vanilla files because of different fixup ordering. This issue shouldn't affect functionality.
  • can't deserialize some old FNIS generated hkx files due to malformed(?) __classname__ or virtualFixup section or wrong assigned member (hkbBlendingTransitionEffec assign to hkbStateMachineTransitionInfoArray)

Usage

git submodule add https://github.com/ret2end/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 = HKXHeader.SkyrimSE();

            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))
                {   
                    // to hkx
                    var bw = new BinaryWriterEx(ws);
                    var s = new PackFileSerializer();

                    s.Serialize(root, bw, header);
                    
                    // or to xml
                    var xs = new XmlSerializer();
                    xs.Serialize(root, header, ws);
                }
            }
        }
    }
}

Technical details

  • ./HKX2/Autogen/ contains Havok classes generated from dumped skyrim classes by SKSE plugin.
  • ./HKX2/Manual/ also contains generated classes with small adjustment.
  • Differences in class structure between games and platforms is dependent on Havok version used and platform's header information (pointer size, endian, padding option). no

TODO

  • Unit test
  • xml to 64bit hkx?
  • export animation?

Credits

  • katalash - The original HKX2 library included in DSMapStudio
  • JKAnderson - BinaryReaderEx and BinaryWriterEx included in SoulsFormats
  • krenyy - HKX2 library by krenyy
  • Dexesttp with hkx research documentary
  • SkyrimSE RE and SkyrimGuild community with valuable skse plugin, hkx, animation, behavior information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.