How charmedbaryon/commonlibsse-ng works
Purpose and Consumption
CommonLibSSE NG is a Windows C++20 static library for building SKSE plugins against reverse-engineered Skyrim engine APIs. Consumers link it through CMake or install it via Vcpkg/Conan; it is not an executable or web application. Primary public entry surfaces are the aggregate game API, SKSE integration, and relocation API: include/RE/Skyrim.h, include/SKSE/SKSE.h, include/REL/REL.h.
Build, Packaging, and Plugin Entry Generation
CMake is the canonical build integration and provides add_commonlibsse_plugin, which generates compatible SKSE plugin declarations and links the library. Package metadata supports Conan and Vcpkg; CI validates target combinations. Key paths: CMakeLists.txt, cmake/CommonLibSSE.cmake, conanfile.py.
Runtime Targeting and Relocation Boundary
The core portability boundary resolves IDs, offsets, module versions, and relocated executable symbols at runtime. It permits one DLL to adapt across Skyrim SE, AE (including ABI/layout differences), and VR, while callers must probe availability before using runtime-specific APIs. This layer bridges compiled plugin code to the loaded Skyrim process and Address Library data: include/REL/Relocation.h, src/REL/Module.cpp, include/RE/Offsets.h.
Reverse-Engineered Engine Model
RE exposes C++ declarations and selected implementations for Skyrim’s in-process object model: forms, actors, world state, effects, quests, inventory, and engine managers. It is organized alphabetically rather than by strict subsystem; headers define ABI-facing layouts/interfaces and source files supply callable wrappers or implementations. Representative roots: include/RE/Skyrim.h, include/RE/T/TESForm.h, include/RE/A/Actor.h.
UI, Input, and Scaleform Interop
The library represents both native UI message/menu machinery and Scaleform/GFx movie APIs. Plugins can interact with engine menus and UI queues, while Flash ActionScript CLIK assets document the UI-side control/delegate contract. The important crossing is native game/SKSE code → UI messages or GFx delegates → Flash movie behavior. Paths: include/RE/U/UIMessageQueue.h, include/RE/G/GFxMovieView.h, Flash/AS2/CLIK/gfx/io/GameDelegate.as.
SKSE Plugin Services
The SKSE layer wraps plugin-facing services: API initialization, event registration, serialization/messaging interfaces, input mapping, logging, translations, IAT hooks, and executable trampolines. It is the supported plugin-to-SKSE boundary; hooks and registration objects ultimately operate inside the Skyrim runtime. Paths: include/SKSE/API.h, include/SKSE/Interfaces.h, src/SKSE/Trampoline.cpp.
Engine Integration Domains
Several engine-facing domains share the relocation/ABI foundation: Papyrus VM and native bindings; rendering/scene graph; Havok physics/behavior; and DirectX/Win32 platform declarations. These are interfaces to game-owned systems, not standalone implementations. Paths: include/RE/S/SkyrimVM.h, include/RE/N/NiAVObject.h, include/RE/H/hkpWorld.h.
Runtimes and External Dependencies
Build/runtime target is x86_64 Windows using MSVC ABI (Clang is supported in compatibility mode); Ninja/CMake drive builds. Runtime deployment requires SKSE64 plus the SE/AE or VR Address Library. Build dependencies include rapidcsv and spdlog, reflected by dependency/build manifests: vcpkg.json, CMakePresets.json, include/SKSE/Logger.h.
Main entry points: Relocation.h Runtime Relocation · Interfaces.h SKSE Services · UIMessageQueue.h Native UI & GFx · CommonLibSSE.cmake CMake Integration
Components 20
Build & Distribution
- CMake Integration · Defines plugin setup and library linkage.
cmake/CommonLibSSE.cmake - CMake Build
CMakeLists.txt - Conan / Vcpkg
conanfile.py
Public Plugin APIs
- CommonLibSSE NG · ABI-facing library for SKSE plugins.
- RE Aggregate API
include/RE/Skyrim.h - SKSE Integration API
include/SKSE/SKSE.h - Relocation API
include/REL/REL.h
Engine Interop
- RE Engine Object Model · Game-owned forms, actors, world state, effects, quests, and managers.
include/RE/T/TESForm.h - Engine Offsets
include/RE/Offsets.h - Native UI & GFx · Native menus and Scaleform movie APIs.
include/RE/U/UIMessageQueue.h - Flash CLIK Contract · UI-side movie control and delegate contract.
Flash/AS2/CLIK/gfx/io/GameDelegate.as - VM, Scene & Physics APIs · Papyrus, rendering, scene graph, and Havok interfaces.
include/RE/S/SkyrimVM.h
Runtime Boundaries
- SKSE Services · Initialization, events, serialization, messaging, hooks, and trampolines.
include/SKSE/Interfaces.h - Executable Trampolines
src/SKSE/Trampoline.cpp - Runtime Relocation · Resolves IDs, offsets, versions, and executable symbols.
include/REL/Relocation.h - Loaded Module Detection · Selects the active Skyrim runtime module.
src/REL/Module.cpp
Other components
- SKSE Plugin Consumer · Consumer plugin links the static library.
- SKSE64 Runtime
- Address Library · SE/AE or VR relocation data.
- Loaded Skyrim Process · SE, AE, or VR executable process.
Connections 22
- CMake Build → CMake Integration: includes
- CMake Integration → CommonLibSSE NG: builds / links
- Conan / Vcpkg → CommonLibSSE NG: distributes
- SKSE Plugin Consumer → CMake Integration: uses
- SKSE Plugin Consumer → CommonLibSSE NG: links
- CommonLibSSE NG → RE Aggregate API: exports
- CommonLibSSE NG → SKSE Integration API: exports
- CommonLibSSE NG → Relocation API: exports
- SKSE Integration API → SKSE Services: provides
- SKSE Services → Executable Trampolines: uses
- SKSE Services → SKSE64 Runtime: integrates with
- Relocation API → Runtime Relocation: provides
- Runtime Relocation → Loaded Module Detection: detects
- Runtime Relocation → Address Library: resolves through
- Runtime Relocation → Engine Offsets: applies
- Runtime Relocation → Loaded Skyrim Process: binds symbols in
- RE Aggregate API → RE Engine Object Model: aggregates
- RE Engine Object Model → Runtime Relocation: requires ABI bindings
- VM, Scene & Physics APIs → Runtime Relocation: uses
- Native UI & GFx → Runtime Relocation: uses
- Native UI & GFx → Flash CLIK Contract: delegates to
- SKSE Services → Native UI & GFx: sends UI work to