decompressedStream.Position = 0; var xmlDoc = new XmlDocument(); xmlDoc.Load(decompressedStream);
var magic = reader.ReadInt32(); // "LSPK" var version = reader.ReadInt32(); // Read file table, compression flags, etc.
| Format | Extension | Purpose | |--------|-----------|---------| | LSX / LSJ / LSB | .lsx , .lsj , .lsb | Larian’s XML/JSON/binary serialization (stats, skills, items, dialogues) | | PAK (Divine Engine) | .pak | Packed game assets (textures, models, audio) | | Save files | .lsv | Compressed LSX containers | | Story scripts | .loca , .osiris | Lua-based story logic |
var json = File.ReadAllText(path); return JsonDocument.Parse(json);
Here’s a structured, practical guide for integrating modding or game data handling with .NET Core (modern .NET, e.g., .NET 6/8). This is useful for building tools like save editors, mod managers, or data extractors. Divinity: Original Sin 2 & .NET Core – Developer Guide 1. Understanding the Game’s Data Structure DOS2 stores data in several key formats:
using K4os.Compression.LZ4; using K4os.Compression.LZ4.Streams; public static byte[] DecompressLsv(byte[] input)
using System.Xml; using K4os.Compression.LZ4.Streams; var saveBytes = File.ReadAllBytes("PlayerProfile.lsv"); using var compressedStream = new MemoryStream(saveBytes); using var decompressedStream = new MemoryStream(); using (var lz4 = LZ4Stream.Decode(compressedStream)) lz4.CopyTo(decompressedStream);
var goldNode = xmlDoc.SelectSingleNode("//attribute[@id='Gold']"); if (goldNode != null) goldNode.Attributes["value"].Value = "99999";



