https://github.com/divadretlaw/lskit
Tools for manipulating Baldur's Gate 3 files
https://github.com/divadretlaw/lskit
baldurs-gate baldurs-gate-3 larian lsx modding modding-tools pak swift-package-manager
Last synced: 10 months ago
JSON representation
Tools for manipulating Baldur's Gate 3 files
- Host: GitHub
- URL: https://github.com/divadretlaw/lskit
- Owner: divadretlaw
- License: eupl-1.2
- Created: 2024-07-28T10:44:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-05T13:22:20.000Z (over 1 year ago)
- Last Synced: 2025-07-11T23:21:37.388Z (11 months ago)
- Topics: baldurs-gate, baldurs-gate-3, larian, lsx, modding, modding-tools, pak, swift-package-manager
- Language: Swift
- Homepage:
- Size: 103 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LSKit
[](https://swiftpackageindex.com/divadretlaw/LSKit) [](https://swiftpackageindex.com/divadretlaw/LSKit)
Tools for manipulating Baldur's Gate 3 files
## Examples
### Load information from a mod
```swift
let bg3 = URL.homeDirectory.appending(path: "Library/Application Support/Baldur's Gate 3/")
let url = bg3.appending(path: "Mods/.pak")
let pak = try ModLSPK(url: url)
guard let moduleInfo = pak.meta.moduleInfo else {
return // File does not contain a meta.lsx with ModuleInfo
}
guard let moduleInfo = moduleInfo.publishVersion else {
return // ModuleInfo does not contain publish version info
}
// Access desired information e.g.
print(moduleInfo.uuid) // UUID
print(moduleInfo.name) // Name
print(moduleInfo.folder) // Folder
```
### Load mod settings
```swift
let bg3 = URL.homeDirectory.appending(path: "Library/Application Support/Baldur's Gate 3/")
let url = bg3.appending(path: "PlayerProfiles/Public/modsettings.lsx")
guard let lsx = LSX(url: url) else {
return // Unable to read or parse given LSX file
}
guard let moduleSettings = LSX.ModuleSettings(lsx: lsx) else {
return // LSX is not in the correct format
}
// Access desired information e.g.
print(moduleSettings.modOrder) // Mod Order
print(moduleSettings.mods) // Mods
```
## Acknowledgment
This is package couldn't exist without [Norbyte](https://github.com/Norbyte)'s [LSLib](https://github.com/Norbyte/lslib).
This package aims to provide a small subset of LSLib's features, re-implemented in Swift to make them available on Apple platforms.
## License
See [LICENSE](LICENSE)