Giter VIP home page Giter VIP logo

lslib's Introduction

LSLib

This package provides utilities for manipulating Divinity Original Sin 1, Enhanced Edition, Original Sin 2 and Baldur's Gate 3 EA files:

  • Extracting/creating PAK packages
  • Extracting/creating LSV savegame packages
  • Converting LSB, LSF, LSX, LSJ resource files
  • Importing and exporting meshes and animations (conversion from/to GR2 format)
  • Editing story (OSI) databases

Requirements

To build the tools you'll need to get the following dependencies:

  • Download GPLex 1.2.2 from here and extract it to the External\gplex\ directory
  • Download GPPG 1.5.2 from here and extract it to the External\gppg\ directory
  • Protocol Buffers 3.6.1 compiler from here and extract it to the External\protoc\ directory

lslib's People

Contributors

akintos avatar baaleos avatar dependabot[bot] avatar fireundubh avatar khbsd avatar laughingleader avatar nicoco007 avatar norbyte avatar soleera avatar thunderysteak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lslib's Issues

divine.exe guide

I tried looking through the commits, but maybe I missed it. Is there anywhere that lists a few examples of how to use the divine.exe CLI? What I want to do is set the source for BG3 (e.g. .../Data/Gustav.pak) and the destination (e.g. .../Data/mod/Gustav/) and unpack/repack the file. I plan on setting up an AutoHotKey script to help automate that much of my foray into modding.

While I write C# code for a living, I rarely, if ever, have worked with the CLI (odd, I know, but that's what I inherited) so I'm a bit puzzled without an example.

Command line conversion of LSF to LSX file

I'm having a bit of difficulty converting from an LSF file to LSX from the command line using v1.9.1, downloaded from https://docs.larian.game/Pak_Extractor_Guide (marked as the latest version).

The conversion works fine from ConverterApp.exe:
Image of Yaktocat
and gives me a proper .lsx file in XML format (about 10x as large as the original .lsf)

However, running from the command line as:
.\divine.exe -s "D:\Games\Steam\steamapps\comm on\Divinity Original Sin 2\PAK Extractor\Save\Fishworks Cellar - 59h10m\globals.lsf" -d "D:\Games\Steam\steamapps\common \Divinity Original Sin 2\PAK Extractor\Save\Fishworks Cellar - 59h10m\globals.lsx" -a convert-resource
creates the .lsx as a binary file (unreadable in text editors) of roughly the same size as the original .lsf.

I've also tried adding -i "lsf" -o "lsx", but got the same result.

Am I using the command wrong?

Compile LSLibNative fails

Tried to switch to x64 configuration and compile and get the following error:

Cannot open include file: 'btBulletDynamicsCommon.h': No such file or directory LSLibNative

It compiles fine in 32bit but I need 64bit, otherwise when used from 64bit host you get a bad image format error if native dll is 32bit. Can you tell me how to fix it or provide a 64bit release?

Support for Elder Scrolls Online GR2

Hey Norbyte, could you, please, take a look at the GR2 files from the Elder Scrolls Online and see if LSLib could possibly support converting them?

There seems to be 3 types of GR2 files in this game: one for meshes, one for skeletons and one for animations.

Here are examples of all three types of files - https://www.mediafire.com/file/fh7u6jx4jvp3qth/GR2_examples.rar/file.

Not sure if it will be of any help but here's also the granny2_x64.dll from the game folder - https://www.mediafire.com/file/kfwifp1suh81oe7/granny2_x64.rar/file.

Finally, here's a screenshot of the error message I get trying to import ESO GR2 files into GR2 Converter (LSLib v1.14.1) - https://monosnap.com/file/yM7LNNmKXCS63gsX8meiXUNZtvayyC

ls::TranslatedStringRepository::s_HandleUnknown

I created a new localization file, added a few records, saved, and then converted LSB to LSJ.

Handles contain the string ls::TranslatedStringRepository::s_HandleUnknown instead of the UUID.

{
	"Content": {
		"type": 28,
		"value": "test4324",
		"handle": "ls::TranslatedStringRepository::s_HandleUnknown"
	},
	"ExtraData": {
		"type": 23,
		"value": ""
	},
	"Speaker": {
		"type": 22,
		"value": ""
	},
	"Stub": {
		"type": 19,
		"value": true
	},
	"UUID": {
		"type": 22,
		"value": "test3425"
	}
}

This is not relevant to the new version of the editor, as I'm still using the first release.

Compiling lslib

When triying to compile this program I get the following exception:

C:\Users\...\Desktop\...\Neuer Ordner\lslib-master>external\gppg\binaries\gplex.exe /out:LSLib\LS\Story\Osiris.lex.cs LSLib\LS\Story\Osiris.lex
Source file <Osiris.lex> not found


Unbehandelte Ausnahme: System.ArgumentException: Source file <Osiris.lex> not found

   bei QUT.Gplex.Automaton.TaskState.OpenSource()
   bei QUT.Gplex.Automaton.TaskState.Process(String fileArg)
   bei QUT.Gplex.Program.Main(String[] args)

Unbehandelte Ausnahme: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei QUT.Gplex.Automaton.TaskState.MakeListing()
   bei QUT.Gplex.Program.Main(String[] args)

C:\Users\...\Desktop\...\Neuer Ordner\lslib-master>external\gppg\binaries\gppg.exe /out:LSLib\LS\Story\Osiris.yy.cs LSLib\LS\Story\Osiris.yy
GPPG:error 4:Source file <LSLib\LS\Story\Osiris.yy> not found


C:\Users\...\Desktop\...\Neuer Ordner\lslib-master>pause

And when looking in the folder (on my PC and on Github) there exists no file called Osiris.lex.cs nor any of the other in the error mentioned files.
If there are more information needed please ask.

Duplicate UVs when importing Blender-generated DAE

I'm having problems trying to get DAEs generated by Blender to import with "possible UV reuse" errors being displayed. It may be something I'm doing wrong (certainly wouldn't be a first) as other people don't seem to be having this problem, but I am at a loss and recall something similar being fixed (i.e. removing dups in the UV map) in the early DOS2 days.

The workflow is, import GR2 into lslib, export as DAE (tried both with and without filter UVs, if that makes a difference), import into Blender 2.78/2.79, do nothing, export again and try to import back into lslib at which point the error is displayed.

I've checked the Blender DAE and it does have a lot of UV coordinates, approx six times as many as the lslib. Manually trimming them worked much as expected. :D i.e. it didn't.

Just to satisfy my own curiosity I tried an older version (1.8? Sorry, didn't make a note) and that did import it quite happily, but no UV in game, just bright green. Other than that it worked though.

I'm just using whatever import/export stuff came with Blender when I installed it. I think.

Might anybody have any suggestions (such as where I might find a clue if it's not a bug...?)

error

BG3 save no longer loads

The most recent update to Baldur's Gate 3 broke the tool's ability to load the save files. It gives the following error message:

The specified package is not a valid savegame (globals.lsf not found)

I tested, and is still works on old saves from the previous version.

AccessViolationException

As you may know, Vortex integrates divine.exe to read pak files (primarily to get at the meta.lsx file for BG3 mods).

At least one of our users got the following exception:

System.TypeInitializationException: The type initializer for 'LZ4.LZ4Codec' threw an exception. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at LZ4ps.LZ4Codec.LZ4_uncompress_unknownOutputSize_safe64(Byte[] src, Byte[] dst, Int32 src_0, Int32 dst_0, Int32 src_len, Int32 dst_maxlen)
   at LZ4ps.LZ4Codec.Decode64(Byte[] input, Int32 inputOffset, Int32 inputLength, Byte[] output, Int32 outputOffset, Int32 outputLength, Boolean knownOutputLength)
   at LZ4.LZ4Codec.AutoTest(ILZ4Service service)
   at LZ4.LZ4Codec.TryService[T]()
   at LZ4.LZ4Codec.InitializeLZ4s()
   at LZ4.LZ4Codec.Try(Action method)
   at LZ4.LZ4Codec..cctor()
   --- End of inner exception stack trace ---
   at LZ4.LZ4Codec.Decode(Byte[] input, Int32 inputOffset, Int32 inputLength, Byte[] output, Int32 outputOffset, Int32 outputLength, Boolean knownOutputLength)
   at LSLib.LS.PackageReader.ReadFileListV15(BinaryReader reader, Package package)
   at LSLib.LS.PackageReader.ReadPackageV16(FileStream mainStream, BinaryReader reader)
   at LSLib.LS.PackageReader.Read()
   at LSLib.LS.Packager.UncompressPackage(String packagePath, String outputPath, Func`2 filter)
   at Divine.CLI.CommandLinePackageProcessor.ExtractPackageResource(String file, String folder, Func`2 filter)
   at Divine.Program.Main(String[] args)

and a bit later:

System.TypeInitializationException: The type initializer for 'Alphaleonis.Win32.Filesystem.Path' threw an exception. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Alphaleonis.Win32.Filesystem.Path..cctor()
   --- End of inner exception stack trace ---
   at Alphaleonis.Win32.Filesystem.Path.GetRegularPathCore(String path, GetFullPathOptions options, Boolean allowEmpty)
   at Alphaleonis.Win32.Filesystem.Path.CheckInvalidPathChars(String path, Boolean checkAdditional, Boolean allowEmpty)
   at Alphaleonis.Win32.Filesystem.Path.IsPathRooted(String path, Boolean checkInvalidPathChars)
   at Divine.CLI.CommandLineActions.TryToValidatePath(String path)
   at Divine.CLI.CommandLineActions.SetUpAndValidate(CommandLineArguments args)
   at Divine.Program.Main(String[] args)

I think this was while trying to read the LvlUp.pak file from this mod: https://www.nexusmods.com/baldursgate3/mods/118 but I'm not sure.
The lslib version used was 1.15.4.
Not sure if this may be relevant but the user is probably russian (at least they're using the russian localization in Vortex)

[gr2 to dae]: Inconsistent handling of circumflex character ^ in bone names.

The gr2 file I am using makes use of circumflex character in bone names.
Both _x005E__x005E__x005E_ and ^^^ are written to the dae file.

The animation will get distorted when importing in Blender. Blender reports:
Could not resolve said "Bone_Lip^^^" referenced in skin controller.
Current workaround that works is replacing either _x005E__x005E__x005E_ or ^^^ to make them consistent.

Object name conflict

It appears that some meshes share the same names resulting in a conflict when being exported. Only the first mesh detected sharing the same name of other meshes will be exported. Resulting in missing meshes.

image

Support for other games?

I'm trying to find some way to get models from the game "Evil Genius" into Autodesk Maya. I know this tool is built to work with the files from "Divinity: Original Sin", but I was wondering how difficult it would be to make it work for EG, or if you might have any suggestions of other resources I could look into.

I've tried the converter as it currently is, and gives an error message when attempting to load a model file - "Incorrect header signature (maybe not a Granny .GR2 file?)"

I'm pretty sure it is the Granny format though, because there's a "granny.dll" file in the game directory and in searching for converters I found an interview with one of the developers who mentions Granny.

In case it will help, here's one of the files in question:
Archives_Bookcase_A.zip

Package creation - 1GB size limit

When creating a package from a folder with over 1GB worth of files, LSLib breaks the files up into multiple 1GB PAK files (Models.pak, Models_1.pak, Model_2.pak etc. etc.) instead of just a single PAK file, is there anyway of bypassing this behaviour?

Basically I'm trying to recreate Baldur's Gate III's Models.pak file to bypass quickbms' limitation of only being able to reimport files that are smaller than the original.

The packages LSLib creates are loaded by the game fine but obviously only the files located in Models.pak are being loaded and the subsequent PAKs (Models_1, Models_2 etc.) are ignored.

Would be great if we could create PAK files larger than 1GB.

Thank you.

TXT to STAT XML converter

So, looks like the editor uses .stat XML files in Data\Editor\Mods to load stats data. This probably explains why making changes to the .txt files has no effect on the stats data in the editor.

Without these .stat files, or without these files populated, the stats editor won't show the tables. This is a problem if you're trying to look at a third-party mod, or you've deleted the editor data DLC or reinstalled.

A converter would be useful for not just correcting those issues, but also for editing or generating stats (with another program) in another format, and importing the new .stats files into the editor.

Here's a blank Object.stats file:

<?xml version="1.0" encoding="utf-8"?>
<stats stat_object_definition_id="e078e210-b9ba-48e5-afe3-c5eb91ba8545">
  <stat_objects />
</stats>

Here's part of an ItemCombos.stats file:

<stats stat_object_definition_id="21465eb6-ebaf-4455-9f29-369759e000a9">
  <stat_objects>
    <stat_object index="0">
      <fields>
        <field name="Name" type="NameStatObjectFieldDefinition" value="CON_Herb_Stardust_A_FUR_BoilingPot_A"/>
        <field name="Type 1" type="EnumerationStatObjectFieldDefinition" enumeration_type_name="IngredientType" value="1"/>
        <field name="Object 1" type="StringStatObjectFieldDefinition" value="CON_Herb_Stardust_A"/>
        <field name="Transform 1" type="EnumerationStatObjectFieldDefinition" enumeration_type_name="IngredientTransformType" value="2"/>
        <field name="Type 2" type="EnumerationStatObjectFieldDefinition" enumeration_type_name="IngredientType" value="1"/>
        <field name="Object 2" type="StringStatObjectFieldDefinition" value="FUR_BoilingPot_A"/>
        <field name="Transform 2" type="EnumerationStatObjectFieldDefinition" enumeration_type_name="IngredientTransformType" value="0"/>
        <field name="ResultAmount 1" type="IntegerStatObjectFieldDefinition" value="1"/>
        <field name="Result 1" type="StringStatObjectFieldDefinition" value="CON_Potion_Stardust_Boiled_A"/>
        <field name="PreviewStatsID" type="StringStatObjectFieldDefinition" value="CON_Potion_Stardust_Boiled_A"/>
      </fields>
    </stat_object>
  </stat_objects>
</stats>

Looks like if you write a converter, you'll need to generate UUIDs.

When trying to save an edited .osi file using BG3 mode, there is a crash.

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentNullException: String reference not set to an instance of a String.
Parameter name: s
at System.Text.Encoding.GetBytes(String s)
at LSLib.LS.LSFWriter.WriteStringWithLength(BinaryWriter writer, String s)
at LSLib.LS.LSFWriter.WriteAttributeValue(BinaryWriter writer, NodeAttribute attr)
at LSLib.LS.LSFWriter.WriteNodeAttributesV2(Node node)
at LSLib.LS.LSFWriter.WriteNodeV2(Node node)
at LSLib.LS.LSFWriter.WriteNodeChildren(Node node)
at LSLib.LS.LSFWriter.WriteNodeV2(Node node)
at LSLib.LS.LSFWriter.WriteNodeChildren(Node node)
at LSLib.LS.LSFWriter.WriteNodeV2(Node node)
at LSLib.LS.LSFWriter.WriteRegions(Resource resource)
at LSLib.LS.LSFWriter.Write(Resource resource)
at ConverterApp.OsirisPane.SaveSavegameDatabase()
at ConverterApp.OsirisPane.saveStoryBtn_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

ConverterApp
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/ConverterApp.exe

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4200.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

Newtonsoft.Json
Assembly Version: 12.0.0.0
Win32 Version: 12.0.1.22727
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/Newtonsoft.Json.DLL

LSLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/LSLib.DLL

AlphaFS
Assembly Version: 2.2.0.0
Win32 Version: 2.2.6.0
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/AlphaFS.DLL

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4220.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll

System.Runtime.Serialization
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll

System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4261.0 built by: NET48REL1LAST_B
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll

Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4084.0 built by: NET48REL1
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

LZ4
Assembly Version: 1.0.15.93
Win32 Version: 1.0.15.93
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/LZ4.DLL

LZ4mm
Assembly Version: 1.0.15.93
Win32 Version: 1.0.15.93
CodeBase: file:///C:/Users/Andrew/AppData/Local/Temp/f82a68ada1d833f8838dd859bcb27a61/44b09ced47d1340e4b5af5cc6f2fc8b2.dll

LZ4cc
Assembly Version: 1.0.15.93
Win32 Version: 1.0.15.93
CodeBase: file:///C:/Users/Andrew/AppData/Local/Temp/f82a68ada1d833f8838dd859bcb27a61/bed5714f0a00711677483c138938e914.dll

LZ4pn
Assembly Version: 1.0.15.93
Win32 Version: 1.0.15.93
CodeBase: file:///C:/Users/Andrew/AppData/Local/Temp/f82a68ada1d833f8838dd859bcb27a61/50495300240756128a79c0c0850f98e5.dll

LSLibNative
Assembly Version: 1.0.7585.40294
Win32 Version:
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/LSLibNative.DLL

zlib.net
Assembly Version: 1.0.3.0
Win32 Version: 1.0.3.0
CodeBase: file:///C:/Users/Andrew/Downloads/ExportTool-v1.15.1/zlib.net.DLL

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Trying to unpack an mod

When trying to unpack an mod I will get the following error:
error1
and after activating the named registry entry the error is:
error2
Thank you in advance. Ask if you need any information.

Add help parameter

It would be swell if you added a help feature for displaying the acceptable arguments for each parameter, ie. -h l would display available log arguments ("all", "debug", etc.).

Story tool breaks inventory BG3

I used 1.15.6 and newest BG3 available (4.1.99.3036). I opened a save (right after landing on the beach basically), edited DB_Origins_MaxPartySize, saved, than loaded the savefile. On load game shows up a message about save file being tampered with. Most things look ok, but all of my inventory (things I had equipped are fine) instead of icons shows some negative number, most something like -150920..., some 895626...
Newly picked up items are fine.

I have slightly modded some stats in case that's relevant.

Compiling LSLib

How do I compile LSLib? What are the dependencies?

Build Output:

1>------ Build started: Project: LSLibNative, Configuration: Debug Win32 ------
2>------ Build started: Project: OpenTK, Configuration: Debug Any CPU ------
2>E:\projects\lslib\OpenTK\Math\Vector2.cs(136,21,136,24): warning CS3021: 'Vector2.Add(Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2.cs(146,21,146,24): warning CS3021: 'Vector2.Add(ref Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2.cs(160,21,160,24): warning CS3021: 'Vector2.Sub(Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2.cs(170,21,170,24): warning CS3021: 'Vector2.Sub(ref Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2.cs(350,21,350,26): warning CS3021: 'Vector2.Scale(Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2.cs(360,21,360,26): warning CS3021: 'Vector2.Scale(ref Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2d.cs(119,21,119,24): warning CS3021: 'Vector2d.Add(Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2d.cs(129,21,129,24): warning CS3021: 'Vector2d.Add(ref Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2d.cs(143,21,143,24): warning CS3021: 'Vector2d.Sub(Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2d.cs(153,21,153,24): warning CS3021: 'Vector2d.Sub(ref Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2d.cs(297,21,297,26): warning CS3021: 'Vector2d.Scale(Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2d.cs(307,21,307,26): warning CS3021: 'Vector2d.Scale(ref Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2h.cs(109,16,109,24): warning CS3021: 'Vector2h.Vector2h(Vector2)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2h.cs(121,16,121,24): warning CS3021: 'Vector2h.Vector2h(Vector2, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2h.cs(154,16,154,24): warning CS3021: 'Vector2h.Vector2h(Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2h.cs(166,16,166,24): warning CS3021: 'Vector2h.Vector2h(Vector2d, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2h.cs(178,16,178,24): warning CS3021: 'Vector2h.Vector2h(ref Vector2d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector2h.cs(190,16,190,24): warning CS3021: 'Vector2h.Vector2h(ref Vector2d, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3.cs(148,21,148,24): warning CS3021: 'Vector3.Add(Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3.cs(159,21,159,24): warning CS3021: 'Vector3.Add(ref Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3.cs(174,21,174,24): warning CS3021: 'Vector3.Sub(Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3.cs(185,21,185,24): warning CS3021: 'Vector3.Sub(ref Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3.cs(342,21,342,26): warning CS3021: 'Vector3.Scale(Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3.cs(353,21,353,26): warning CS3021: 'Vector3.Scale(ref Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3d.cs(146,21,146,24): warning CS3021: 'Vector3d.Add(Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3d.cs(157,21,157,24): warning CS3021: 'Vector3d.Add(ref Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3d.cs(172,21,172,24): warning CS3021: 'Vector3d.Sub(Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3d.cs(183,21,183,24): warning CS3021: 'Vector3d.Sub(ref Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3d.cs(341,21,341,26): warning CS3021: 'Vector3d.Scale(Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3d.cs(352,21,352,26): warning CS3021: 'Vector3d.Scale(ref Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(121,16,121,24): warning CS3021: 'Vector3h.Vector3h(Vector3)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(134,16,134,24): warning CS3021: 'Vector3h.Vector3h(Vector3, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(159,16,159,24): warning CS3021: 'Vector3h.Vector3h(ref Vector3, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(171,16,171,24): warning CS3021: 'Vector3h.Vector3h(Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(184,16,184,24): warning CS3021: 'Vector3h.Vector3h(Vector3d, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(197,16,197,24): warning CS3021: 'Vector3h.Vector3h(ref Vector3d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector3h.cs(210,16,210,24): warning CS3021: 'Vector3h.Vector3h(ref Vector3d, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(208,21,208,24): warning CS3021: 'Vector4.Add(Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(220,21,220,24): warning CS3021: 'Vector4.Add(ref Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(236,21,236,24): warning CS3021: 'Vector4.Sub(Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(248,21,248,24): warning CS3021: 'Vector4.Sub(ref Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Quaternion.cs(85,24,85,27): warning CS3021: 'Quaternion.XYZ' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Quaternion.cs(91,24,91,27): warning CS3021: 'Quaternion.Xyz' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(412,21,412,26): warning CS3021: 'Vector4.Scale(Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(424,21,424,26): warning CS3021: 'Vector4.Scale(ref Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Quaterniond.cs(85,25,85,28): warning CS3021: 'Quaterniond.XYZ' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4h.cs(132,16,132,24): warning CS3021: 'Vector4h.Vector4h(Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4h.cs(146,16,146,24): warning CS3021: 'Vector4h.Vector4h(Vector4, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4.cs(1553,48,1553,54): warning CS3021: 'Vector4.explicit operator float*(Vector4)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4h.cs(185,16,185,24): warning CS3021: 'Vector4h.Vector4h(Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4h.cs(199,16,199,24): warning CS3021: 'Vector4h.Vector4h(Vector4d, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4h.cs(213,16,213,24): warning CS3021: 'Vector4h.Vector4h(ref Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4h.cs(227,16,227,24): warning CS3021: 'Vector4h.Vector4h(ref Vector4d, bool)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(206,21,206,24): warning CS3021: 'Vector4d.Add(Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(218,21,218,24): warning CS3021: 'Vector4d.Add(ref Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(234,21,234,24): warning CS3021: 'Vector4d.Sub(Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(246,21,246,24): warning CS3021: 'Vector4d.Sub(ref Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(409,21,409,26): warning CS3021: 'Vector4d.Scale(Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(421,21,421,26): warning CS3021: 'Vector4d.Scale(ref Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>E:\projects\lslib\OpenTK\Math\Vector4d.cs(1556,48,1556,55): warning CS3021: 'Vector4d.explicit operator double*(Vector4d)' does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
2>  OpenTK -> E:\projects\lslib\OpenTK\bin\Debug\OpenTK.dll
1>  AssemblyInfo.cpp
1>  crc32.cpp
1>  granny2wrapper.cpp
1>granny2wrapper.cpp(8): warning C4229: anachronism used: modifiers on data are ignored
1>  lz4wrapper.cpp
1>lz4wrapper.cpp(48): warning C4018: '<': signed/unsigned mismatch
1>lz4wrapper.cpp(116): warning C4018: '<': signed/unsigned mismatch
1>  physics.cpp
1>e:\projects\lslib\lslibnative\physics.h(6): fatal error C1083: Cannot open include file: 'btBulletDynamicsCommon.h': No such file or directory
1>  Generating Code...
3>------ Build started: Project: LSLib, Configuration: Debug Any CPU ------
3>  The system cannot find the path specified.
3>  The system cannot find the path specified.
3>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1250,5): error MSB3073: The command ""E:\projects\lslib\\external\gppg\binaries\GpLex" /out:"E:\projects\lslib\LSLib\\LS\Story\Osiris.lex.cs" "E:\projects\lslib\LSLib\\LS\Story\Osiris.lex"
3>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1250,5): error MSB3073: "E:\projects\lslib\\external\gppg\binaries\Gppg" /out:"E:\projects\lslib\LSLib\\LS\Story\Osiris.yy.cs" "E:\projects\lslib\LSLib\\LS\Story\Osiris.yy"" exited with code 3.
========== Build: 1 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

CRC check failed

Keep getting this error when trying to extract the patch 4 Baldur's Gate 3 textures.pak:

Internal error!
System.IO.InvalidDataException: CRC check failed on file 'Generated/Public/Shared/Assets/Characters/_Models/_Creatures/Myconid/Resources/MYC_Burly_A_PMA.DDS', archive is possibly corrupted. Expected CA3FBC20, got 12672942
at LSLib.LS.PackagedFileIno.MakeStream()
at LSLib.LS.Packager.UncompressPackage(Package package, String outputPath, Func'2 filter)
at LSLib.LS.Packager.UncompressPackage(String packagepath, String outputpath, Func'2 filter)
at ConverterApp.PackagePan.extractPackageBtn_Click(Object sender, EventArgs e)

And this when trying to extract Textures_1:

The specified package (C:\Steam Library\steamapps\common\Baldurs Gate 3\Data\Textures_1.pak) is not an Original Sin package or savegame archive.

I've tried redownloading the game but still get the errors. I have game set to "Baldur's Gate 3 (64-bit)" and have tried version number V13 (which it defaults to) and v15 (which is called Baldurs Gate 3). Any ideas?

Cannot compile StoryCompiler due to missing protobuf tool

1>------ Build started: Project: StoryCompiler, Configuration: Debug Any CPU ------
1>  The system cannot find the path specified.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1332,5): error MSB3073: The command "E:\projects\lslib\\External\x64-windows\tools\protobuf\protoc --proto_path=E:\projects\lslib\StoryCompiler\ --csharp_out=E:\projects\lslib\StoryCompiler\ debuginfo.proto" exited with code 3.
========== Build: 0 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========

[BG3] 1.15.4 - Parts missing/not readable in lsf file

I would like to make changes in the savegame files (Bg3). To do this, I unzip the lsv file and get several files, including the Globals.lsf. As expected, I find the name of my character (ulric303) in this file.

Since this file is still binary, I convert it to an lsx file.
During this conversion I don't get an error message, but in the lsx file my character name is no longer present and also other plaintext information from the Globals.lsf disappears during the conversion (e.g. Bless_LifeCleric).

However, my first guess that parts are forgotten/ignored during the conversion lsf-->lsx seems to be wrong as well. Because I can convert the lsx file back to an identical global.lsf.

Can someone explain to me why my char name doesn't show up in the lsx file anymore? Or can this be fixed?

For both conversions I used the graphical interface of GR2 Converter (LsLib v1.15.4).

I get the same result when I use the "Savegame Debugging" function.

[Divine] ExtractSingleFile can be removed

With the -x argument, you can extract single files as well as multiple files according to glob or RegEx expressions.

divine.exe -a extract-package -s "E:\SteamLibrary\Divinity Original Sin 2\DefEd\Data\Shared.pak" -d "%CD%" -x "Public/Shared/RootTemplates/_merged.lsf"

This would extract the file matching that pattern.

In Python:

class Divine:
    # ... snip ...

    def extract_file(self, game_path: str, pak_file_name: str, file_to_extract: str) -> None:
        pak_file_path: str = os.path.join(game_path, pak_file_name)
        subprocess.run([self.divine_path, '-a', 'extract-package', '-s', pak_file_path, '-d', self.output_path, '-x', file_to_extract])

# ... snip ...

divine.extract_file(GAME_PATH, 'Shared.pak', 'Public/Shared/RootTemplates/_merged.lsf')

The ExtractSingleFile method added in 84a14b2 can be removed. That would include removing the short and long arguments as well as the action.

PAK extraction does not generate new metadata

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. ;)

New release build

Can you update the build available via the AWS link after my latest PR?

Bug: Switching compression algorithm doesn't give up focus correctly

Using the PAK / LSV Tools, under "Create Package", if you change the compression algorithm to an option other than "Zlib Optimal", then click into the Package Path (somewhere not at the end), and press Backspace, it will re-set the compression algorithm to "Zlib Optimal".

Repro steps:

  1. Have the compression set to "Zlib Optional"
  2. Have a path pasted into the "Package Path" field
  3. Click somewhere in the "Package Path" field that isn't the end of the path
  4. Press backspace

Expected:
The selected character is deleted and the compression algorithm is reset

Actual:
The compression algorithm is reset and the cursor position is lost

CLI Feedback Thread

I'm nearly finished with implementing the CLI.

  • TODO: OSI extraction
  • TODO: Argument validation
  • TODO: Argument defaults
  • TODO: Error handling / testing
  • GR2/DAE support does not allow selecting subobjects or customizing resource formats.
  • Fluent doesn't format help nicely, so I'll have to roll my own help.
  • CLI supports extracting multiple PAK/LSV files nonrecursively. (Feature not available in GUI.)
  • ConverterApp can run in either WinForms or Console mode. (AttachConsole(-1) FTW)

I need feedback on the arguments most of all (e.g., short/long arg names, which args don't need to be supported, better descriptions.) Also, I'd personally favor using only long args.

Type Arg Options Default Description
bool help null Print help reference
int loglevel 0, 1, 2, 3, 4 null Print log messages to console
string profile default, [custom] null Use INI configuration
string game_mode dos, dosee, dos2 dos2 Set game mode
string source null Set source file path or directory
string destination null Set destination file path or directory
string input_format gr2, dae, pak, lsv null Set input format for batch operations
string output_format gr2, dae, pak, lsv null Set output format for batch operations
bool xno false [GR2/DAE] Export normals
bool xtb false [GR2/DAE] Export tangents/bitangents
bool xuv false [GR2/DAE] Export UVs
bool dup false [GR2/DAE] Deduplicate vertices
bool flt false [GR2/DAE] Filter UVs
bool rno false [GR2/DAE] Recalculate normals
bool rtb false [GR2/DAE] Recalculate tangents/bitangents
bool iwt false [GR2/DAE] Recalculate inverse world transforms
bool fuv false [GR2/DAE] Flip UVs
bool lvt false [GR2] Force legacy version tag
bool sct false [GR2] Store compact tri-indices
bool bds false [GR2] Build dummy skeleton
bool abt false [GR2] Apply basis transforms
bool cto false [GR2] Conform to original
string ctp null [GR2] Conform to original path
bool c false [PAK/LSV] Create package from source
bool x false [PAK/LSV] Extract package(s) to destination
string package_version v7, v9, v10, v13 v13 [PAK/LSV] Set package version
string compression_method zlib, zlibfast, lz4, lz4hc lz4hc [PAK] Set compression method

Support Metin2 .gr2 animations

Hey Mr Norbyte. The tool successfully converts metin2 .gr2 meshes and .gr2 animations to .dae format.I can succesfuly open .dae mesh inside blender. I see the full skeleton and mesh with weight paint, which is completely perfect.

Now its time to .gr2 animations.I open .dae mesh with notepad++ and copy geometries ,controllers, visual scenes,I am paste into .dae animation.I am import the .dae file i see the mesh and skeleton completely, when i play the animation mesh and skeleton does not matching animation is messed up.

I think skeleton weight paint is good, problem is animation doesnt know which bone to stick it and play it.

Thank you Mr Norbyte.

Metin2.zip

[BG3] 1.15.2 - .gr2/.dae conversion results in distortion/deformities

Converting Baldur's Gate 3 armor files from .gr2 to .dae and back again results in distortions in-game (parts of the model are very displaced -- for example, the legs and torso appear fine, but the arms are deformed and hovering over the head).

Steps to reproduce:

  1. extract Baldur's Gate 3 models.pak

  2. locate an armor from the generated folder that you can see in-game, e.g. HUM_M_ARM_Scalemail_A_0_Body.GR2 (the starting fighter armor)

  3. convert the .gr2 to .dae and then convert the .dae back to .gr2 again. (FYI, if you import the .dae into blender, it looks correct, but it doesn't make any difference).

  4. drop re-converted gr2 into game folder. For example:
    \GOG Galaxy\Games\Baldurs Gate 3\Data\Generated\Public\Shared\Assets\Characters_Models\Humans\Resources\HUM_M_ARM_Scalemail_A_0_Body.GR2

  5. Goto new character screen and select the appropriate character - in this case, human-male-fighter and you will see the distortion.

I used this previously with divinity games - many thanks for the great tool!

[BG3] [LSF] 1.15.2 - Failed to convert resource: String reference not set to an instance of a String

F:\test>divine -g bg3 -s "F:\test\meta.lsx" -d "F:\test\meta.lsf" -a convert-resource -l all
[DEBUG] Using log level: ALL
[DEBUG] Using game: BaldursGate3
[DEBUG] Using path: F:\test\meta.lsx
[DEBUG] Using path: F:\test\meta.lsf
[DEBUG] Using destination extension: LSF
[FATAL] Failed to convert resource: String reference not set to an instance of a String.
Parameter name: s

meta.lsx is from an unpacked save file.

System.ArgumentNullException
  HResult=0x80004003
  Message=String reference not set to an instance of a String.
Parameter name: s
  Source=mscorlib
  StackTrace:
   at System.Text.Encoding.GetBytes(String s)
   at LSLib.LS.LSFWriter.WriteStringWithLength(BinaryWriter writer, String s) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 390
   at LSLib.LS.LSFWriter.WriteAttributeValue(BinaryWriter writer, NodeAttribute attr) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 324
   at LSLib.LS.LSFWriter.WriteNodeAttributesV2(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 153
   at LSLib.LS.LSFWriter.WriteNodeV2(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 232
   at LSLib.LS.LSFWriter.WriteNodeChildren(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 209
   at LSLib.LS.LSFWriter.WriteNodeV2(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 243
   at LSLib.LS.LSFWriter.WriteNodeChildren(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 209
   at LSLib.LS.LSFWriter.WriteNodeV2(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 243
   at LSLib.LS.LSFWriter.WriteNodeChildren(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 209
   at LSLib.LS.LSFWriter.WriteNodeV2(Node node) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 243
   at LSLib.LS.LSFWriter.WriteRegions(Resource resource) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 143
   at LSLib.LS.LSFWriter.Write(Resource resource) in F:\projects\lslib-fireundubh\LSLib\LS\LSFWriter.cs:line 71
   at LSLib.LS.ResourceUtils.SaveResource(Resource resource, String outputPath, ResourceFormat format, FileVersion version) in F:\projects\lslib-fireundubh\LSLib\LS\ResourceUtils.cs:line 128
   at Divine.CLI.CommandLineDataProcessor.ConvertResource(String sourcePath, String destinationPath, FileVersion fileVersion) in F:\projects\lslib-fireundubh\Divine\CLI\CommandLineDataProcessor.cs:line 28
   at Divine.CLI.CommandLineDataProcessor.Convert() in F:\projects\lslib-fireundubh\Divine\CLI\CommandLineDataProcessor.cs:line 11
   at Divine.CLI.CommandLineActions.Process(CommandLineArguments args) in F:\projects\lslib-fireundubh\Divine\CLI\CommandLineActions.cs:line 206
   at Divine.CLI.CommandLineActions.Run(CommandLineArguments args) in F:\projects\lslib-fireundubh\Divine\CLI\CommandLineActions.cs:line 30
   at Divine.Program.Main(String[] args) in F:\projects\lslib-fireundubh\Divine\Program.cs:line 42

  This exception was originally thrown at this call stack:
    [External Code]
    LSLib.LS.LSFWriter.WriteStringWithLength(System.IO.BinaryWriter, string) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteAttributeValue(System.IO.BinaryWriter, LSLib.LS.NodeAttribute) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeAttributesV2(LSLib.LS.Node) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeV2(LSLib.LS.Node) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeChildren(LSLib.LS.Node) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeV2(LSLib.LS.Node) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeChildren(LSLib.LS.Node) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeV2(LSLib.LS.Node) in LSFWriter.cs
    LSLib.LS.LSFWriter.WriteNodeChildren(LSLib.LS.Node) in LSFWriter.cs
    ...
    [Call Stack Truncated]

2020-10-16 18_59_32

						<node id="PartyMetaData">
							<children>
								<node id="CharacterMetaData">
									<attribute id="CharacterIconID" type="FixedString" value="CustomIconSet" />
									<attribute id="CharacterName" type="TranslatedString" handle="ResStr_401400331" version="0" />
								</node>

Support for Baldur Gate III

Hi Norbyte, could you please support Baldur gate III. I tried extract pak files from baldur gate 3, but it failed. It seems they use the similar pak format but not same. Thank you very much!

ConverterApp fork changes

So, I've been refactoring and adding new features to the ConverterApp all Sunday. I haven't committed all my changes to my fork yet, and it'll take me awhile to commit everything properly.

Not sure if you'll want to put in the time to pull anything, but here's a list of some changes:

  • Auto create output paths when the path does not exist (instead of throwing an exception)
  • Store and load user input with Settings for future sessions
  • User error handling with ErrorProviders (in-textbox error icons, errors disable buttons)
  • Status Bar with subscriptions (status bar text fades away, cool!)
  • All instances of MessageBox.Show replaced and messages sent to Status Bar
  • All strings stored in Resources for localization
  • Massive ReSharpening (null checks, null propagation, ternary expressions, object initializers, etc.)
  • Call stack logging to file with NLog
  • Very basic folder restructuring (Controls, Enumerations, Events, Forms)
  • Removed unused directives, redundant calls, and redundant casts

I started out implementing the first two, but my efforts just escalated from there...

Any requests? ๐Ÿ˜„

Export bones / animations of Anno 1404 to dae

I tried exporting some Anno1404 files using the converter. I added granny2.dll from the game. I used the master branch of lslib, updated today.

The animations and meshes are stored in separate .gr2 files.

  • The model and bone names are recognized correctly in the converter.
  • The meshes export fine to DAE.
  • It seems that the bones are not exported to DAE, however
  • The animations are correctly recognized, and converter shows the correct names of the bones for the animation tracks.

Probably because the bones are not exported, the animation does not work when it is imported in 3ds max. Is there something I'm doing wrong? I can provide sample files upon request.

DOS: 2. Converted models GR2 to DAE / DAE to GR2 are corrupted

Hello, Norbyte!
At first: You are genius and I really love your tools. But I'm kinda stupid enough to not be able to convert models properly. Human model in this case. I want to edit model in blender, so I converted GR2 to DAE, then I slightly edited mesh (Armature is intact). After exporting model and converting to GR2 I get a mess after attaching default animations. OK. Now I decided to solve the problem step by step so I began from simple procedure. I converted GR2 -> DAE -> GR2 (two ways: with copy source skeleton and without) via your tools (v1.15.4) and I didn't use blender at all. But in the Divinity Engine after attaching animation it doesn't work properly either.. Picture below demonstrates what I have.
2021-03-03 (2)

And here link to zip archive with 3 files: (original GR2, converted DAE, and converted to GR2 from dae)
Please help if possible...

Models here: https://disk.yandex.ru/d/jsa1hi2jZCbSag

Unpack and repack failure (1.15.5)

I have 1.15.5 (though it shows as 1.15.4 in the bar at the top) and I am:

  • unpacking Shared.pack from BG3 (fully up to date at 4.1.99.3036)
  • packing the just unpacked thing
  • replacing Shared.pack in the game directory with the repacked one

and that causes the game to crash on startup. Is that not supposed to work?

The repacked one is marked as V16 according to hex editor (though in app the dropdown still shows as v15). It is much larger (121,823,873 bytes vs 93,417,658 bytes of the original), but that's probably just compression difference?

divine.exe progress?

Any chance you could add a progress bar to the divine.exe output? Would make my use of it with the multitool a better user experience, and they might stop closing the windows prematurely.

Exception on unpacking .pak file

I'm trying to unpack Chronomancer mod for Divinity 2 DE. I'm getting the following exception:
error

Using the latest release from here (1.11.3).
Other mods unpack fine.

What are handles?

Do you have any idea what are the Localization handles?

{
	"Content": {
		"type": 28,
		"value": "Candle",
		"handle": "h62f95e12g0bcfg41b1g8c0bg6143f1d5ef72"
	},
	"ExtraData": {
		"type": 23,
		"value": ""
	},
	"Speaker": {
		"type": 22,
		"value": ""
	},
	"Stub": {
		"type": 19,
		"value": true
	},
	"UUID": {
		"type": 22,
		"value": "LOOT_Candle_A"
	}
}

I wrote a Python script that generates and bulk modifies Root Templates in JSON. I want to generate localization from non-localized template display names, but I have no idea what to do about handles.

Decompiler output:

    [return: MarshalAs(UnmanagedType.U1)]
    public unsafe bool LoadDefinition(TranslatedString* translatedString)
    {
      this.m_Content = new string(<Module>.ls.STDWString.ToWChar(<Module>.ls.RuntimeStringHandle.GetReferenceString(<Module>.ls.TranslatedString.GetHandle(translatedString))));
      this.m_Handle = new string(<Module>.ls.FixedString.ToChar(<Module>.ls.RuntimeStringHandle.GetHandle(<Module>.ls.TranslatedString.GetHandle(translatedString))));
      return true;
    }

    public unsafe TranslatedString* ToNative([In] TranslatedString* obj0)
    {
      uint num1;
      // ISSUE: fault handler
      try
      {
        num1 = 0U;
        <Module>.ls.TranslatedString.{ctor}(obj0);
        num1 = 1U;
        RuntimeStringHandle runtimeStringHandle;
        <Module>.ls.RuntimeStringHandle.{ctor}(&runtimeStringHandle);
        // ISSUE: fault handler
        try
        {
          MWStringConverter mwStringConverter = new MWStringConverter(this.m_Content);
          STDWString stdwString;
          STDWString* stdwStringPtr = <Module>.ls.STDWString.{ctor}(&stdwString, mwStringConverter.GetWChar());
          // ISSUE: fault handler
          try
          {
            <Module>.ls.RuntimeStringHandle.SetReferenceString(&runtimeStringHandle, stdwStringPtr);
          }
          __fault
          {
            // ISSUE: method pointer
            // ISSUE: cast to a function pointer type
            <Module>.___CxxCallUnwindDtor((__FnPtr<void (void*)>) __methodptr(ls.STDWString.{dtor}), (void*) &stdwString);
          }
          <Module>.ls.STDWString.{dtor}(&stdwString);
          if (!string.IsNullOrWhiteSpace(this.m_Handle))
          {
            MStringConverter mstringConverter = new MStringConverter(this.m_Handle);
            FixedString fixedString;
            FixedString* fixedStringPtr = <Module>.ls.FixedString.Create(&fixedString, mstringConverter.GetChar(), -1);
            // ISSUE: fault handler
            try
            {
              <Module>.ls.RuntimeStringHandle.SetHandle(&runtimeStringHandle, fixedStringPtr);
            }
            __fault
            {
              // ISSUE: method pointer
              // ISSUE: cast to a function pointer type
              <Module>.___CxxCallUnwindDtor((__FnPtr<void (void*)>) __methodptr(ls.FixedString.{dtor}), (void*) &fixedString);
            }
            <Module>.ls.FixedString.{dtor}(&fixedString);
          }
          else
            <Module>.ls.RuntimeStringHandle.SetHandle(&runtimeStringHandle, <Module>.ls.RuntimeStringHandle.GetHandle(<Module>.ls.TranslatedStringRepository.GetHandleUnknown()));
          <Module>.ls.TranslatedString.SetHandle(obj0, &runtimeStringHandle);
        }
        __fault
        {
          // ISSUE: method pointer
          // ISSUE: cast to a function pointer type
          <Module>.___CxxCallUnwindDtor((__FnPtr<void (void*)>) __methodptr(ls.RuntimeStringHandle.{dtor}), (void*) &runtimeStringHandle);
        }
        <Module>.ls.RuntimeStringHandle.{dtor}(&runtimeStringHandle);
        return obj0;
      }
      __fault
      {
        if (((int) num1 & 1) != 0)
        {
          uint num2 = num1 & 4294967294U;
          // ISSUE: method pointer
          // ISSUE: cast to a function pointer type
          <Module>.___CxxCallUnwindDtor((__FnPtr<void (void*)>) __methodptr(ls.TranslatedString.{dtor}), (void*) obj0);
        }
      }
    }

[BG3] UVs are flipped when converting to .dae

GR2 Converter LSLib v1.15.1

When exporting .GR2 model to .dae the UVs are flipped across X axis.
Consequences : Messes up the Textures.
"X-flip meshes" doesn't fix it,
"Conform to original .GR2" doesn't fix it,
"Convert to Y-up" doesn't change anything,
"Flip UVs" only flips vertically.

Model forward facing is World +Y axis when importing .dae in Blender,
but forward in Blender is -Y axis, maybe that's the cause ?

flipUVs_checked
flipUVs_unchecked

Spine_End_Bone seems to cause reoccuring multiple bones error

Hello Norbyte, I am new to DOS2 modding and I have been trying to convert some gr2s into daes for model swapping/editing

however I ran into this error with any gr2s that seem to show Spine_End_Bone under the subobjects in the gr2 converter
I tried multiple other files that have similar Spine_End_Bone subobjects and they all don't work, I also can't seem to untick any subobjects

I read that the "conform to original gr2" option should make them work properly but it doesn't seem to fix the problem even though I have the original gr2 selected and ticked the squares.
https://imgur.com/g9gS2yY

Another error only pops up when attempting to convert some specific dae files back to gr2 after opening them in blender, MayaLT gave me a "Baked into TRS to avoid incompatibility" as well. I've been trying to edit heavy armor models (specifically the human male platemail) and can't seem to get past this error
https://imgur.com/CH0aiyX
I did notice though that if I convert these files to dae and then back to gr2 without opening them in Blender/MayaLT they seem to convert just fine without any errors. So I am assuming the modeling programs change the file?

Support for Diablo 2: Resurrected GR2 (.model)

Hi Mr.Norbyte.

Not sure if I should post it here, but as I have seen you add support for other games's GR2, I would try my luck here.

A new games called Diablo 2: Resurrected also use a kind of GR2 format models, but named as .model, it can be open with Granny Viewer 2.11.8. According to informations in the Granny Viewer, the .model files are exported through Granny Standard exporter, SDK version 2.12.0.5

Here is some example files: https://drive.google.com/file/d/1M70iiRA3A3YOOzbspk6Ixsvq8zOBYboM/view

Is it possible for you to add import/export support of Diablo 2: Resurrected GR2 (.model)? It would greatly promote modding of this game.

Thanks.

Ivenend

[Help] How variables work?

Could you please explain us how variables work in your converted save format and how to edit them?

At the moment I understood these things, correct me if I was wrong:

  • Variables positions are defined in the save "header",
  • Variables are stored globally but also for each character,
  • Variables are divided by type (integers, floats, strings, ...)
  • Each variable manager is a collection of values somehow.
  • Each named variable has to be picked to the manager with its position

Things I do not understand it's if the base64 serialized format can be reverted and edited, and serialized again. (It's my goal)

But I do not understand how bytes are arranged in order to read them and associates values to keys for characters and globals.

I need a real explanation on that matter.
Thanks in advance!

Problems exporting animations of metin2 files

Hello,

I'm trying to export the models of 'metin2' (2004), using your project.
It seems to work well for the meshes, but when I try to export the animations using 'Single File' mode I get an error (see image below).

error_single

I tried to debug the project, and it seems that, it tries to get the number of knots from the curve on the track, but the curve is a null pointer. (see this line)
Do you have any idea why this happens? How could I overcome this problem?
Do you have some kind of guide about the gr2 file structure?

I tried to open both meshes and animations using granny viewer and it works.

Furthermore when I try to use the 'Batch' mode I get this error (see Image below).

error_bash

Attached you find one of the meshes with its animations if you want to replicate the errors

stray_dog.zip

Thanks in advance for your time.

StatParser Issue

When trying to use the statparser there seems to be an issue with the sod path, throwing the error "An item with the same key has already been added". Specifically, it seems to be "Definitions.LoadEnumerations(enumerationsPath);" on line 63 of statchecker.cs.

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.