Norbyte / lslib

Tools for manipulating Divinity Original Sin and Baldur's Gate 3 files
MIT License
746 stars 138 forks source link

PAK extraction does not generate new metadata #4

Open fireundubh opened 7 years ago

fireundubh commented 7 years ago

So, one of the reasons for extracting a PAK file is to load the PAK data into the editor.

To do that for mods, you have to jump through some hoops. It would be helpful if extracting a PAK would generate a new Projects\[mod]\meta.lsx file with a new UUID attribute value. There could be a "Generate Project Metadata" checkbox toggle somewhere on the PAK tab.

The Projects\[mod]\meta.lsx file look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<save>
    <header version="2" time="1506290960" />
    <version major="3" minor="1" revision="3" build="1" />
    <region id="MetaData">
        <node id="root">
            <attribute id="Module" value="b9a1a072-731f-4ae3-9fba-967b324a5a85" type="23" />
            <attribute id="Name" value="Crafting_Overhaul" type="23" />
            <attribute id="Type" value="Add-on" type="23" />
            <attribute id="UUID" value="25ffd9db-db44-4dde-87e5-4a1857cd98c4" type="23" />
        </node>
    </region>
</save>

The UUID attribute just needs to be a unique UUID. I've been using this Version 4 UUID Generator.

I might implement this if I can find some time.

That checkbox I mentioned could be "Generate Project Data" if the TXT to STAT converter is implemented. ;)

Norbyte commented 7 years ago

Yeah, that is reasonable. The checkbox should only be checkable though if the package you're extracting is actually a mod (i.e. not a savegame or game data package). For GUID generation System.Guid.NewGuid() will probably be fine.