| .cargo | ||
| .github | ||
| crates | ||
| docs | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| bethkit.code-workspace | ||
| Cargo.lock | ||
| Cargo.toml | ||
| cbindgen.toml | ||
| LICENSE | ||
| README.md | ||
| rustfmt.toml | ||
bethkit
⚠️ Beta — APIs may change before the first stable release.
A fast, zero-copy Rust library for reading and writing Bethesda game plugin and archive files. Callable from any language via a stable C ABI (bethkit-ffi).
What it does
- Zero-copy plugin parsing — plugins are memory-mapped; records borrow bytes directly from the mapping without extra allocations
- Record schema —
SchemaRegistry::sse()covers all 126 SSE record types;SchemaRegistry::fo4()covers all 137 FO4 types.RecordViewdecodes subrecords into typedFieldValuevariants: integers, floats, FormIDs, enums with resolved names, bit-flags, structs, and arrays. All schema data is&'static— zero heap allocation at runtime. Placement records (REFR, ACHR) are not schema-covered; complex multi-variant fields fall back to a raw byte slice. - BSA / BA2 archives — read and extract all major formats (BSA TES3/TES4/FO3/SSE, BA2 GNRL/DX10); write new archives with parallel compression
- Streaming record replace —
PluginPatcherrewrites arbitrary records in-place; cost is O(edits), not O(plugin size) - Writer — build new plugins from scratch; eslify existing plugins; set the
LOCALIZEDflag - Localized strings — read, edit, and write
.STRINGS/.DLSTRINGS/.ILSTRINGSfiles; apply translation patches without touching the plugin binary - Load-order utilities —
LoadOrder,GlobalFormId,PluginCachefor winning-override lookups and EditorID search across multiple plugins - C ABI —
bethkit-ffiexposes ~110extern "C"functions with a pre-generatedbethkit.hincluded in the repository
Crates
bethkit-io— memory-mapped I/O,SliceCursor, zlib/LZ4 decompressionbethkit-core— ESP/ESL/ESM parser, writer, patcher, string tables, record schemabethkit-bsa— BSA and BA2 archive reader and writerbethkit-ffi— C ABI wrapper andbethkit.hheader
Supported games
The parser, writer, and patcher work for all TES4-era games. The current focus is completing full schema coverage for Skyrim SE (126 types) and Fallout 4 (137 types). Schemas for other games (Oblivion, Fallout 3/NV, Starfield, Morrowind) are planned for later milestones.
Documentation
- Quick Start
- Reading Plugins
- Writing & Patching Plugins
- BSA / BA2 Archives
- Record Schema
- Localized Strings
- Load Order & FormID Resolution
- C ABI / Language Bindings
- Architecture
Compared to alternatives
| bethkit | sse-plugin-interface | xEdit | Mutagen | |
|---|---|---|---|---|
| Language | Rust + C ABI | Python | Delphi | C# |
| License | Apache-2.0 | MIT | MPL 2.0 | GPL-3.0 |
| Embeddable library | ✅ | ✅ | ❌ GUI/CLI | ✅ |
| Schema-typed record access | ✅ runtime | ❌ | ✅ full | ✅ compile-time |
| BSA / BA2 write | ✅ | ❌ | ✅ | read only |
| Streaming record replace | ✅ | ❌ | ✅ | ❌ |
| Conflict detection | ❌ | ❌ | ✅ | ❌ |
| C ABI for cross-language use | ✅ | ❌ | ❌ | ❌ |
bethkit's niche is a fast, embeddable, language-agnostic library for direct binary access. xEdit is the authoritative reference tool with full conflict detection, a GUI, and schema definitions for every field across every game. Mutagen offers compile-time-typed record schemas for C# patcher authors, with the Synthesis framework on top; its GPL-3.0 licence restricts embedding in proprietary tools. sse-plugin-interface is minimal by design — purpose-built for SSE-Auto-Translator.
Status
| Milestone | Status |
|---|---|
| Parser + writer + tests (SSE) | ✅ |
| String tables | ✅ |
Streaming rewrite (PluginPatcher) |
✅ |
| BSA / BA2 reader + writer | ✅ |
PluginCache (winning override, EditorID lookup) |
✅ |
| Record schema — SSE (126 types registered, deep coverage WIP) | ⚠️ WIP |
| Record schema — FO4 (137 types registered, deep coverage WIP) | ⚠️ WIP |
C ABI (bethkit-ffi) |
✅ |
| Python bindings — bethkit.py | ✅ |
| Record schema — other games | 🗓️ Planned |
License
Apache-2.0