This repo has been moved to: https://github.com/BFrizzleFoShizzle/KenshiLib
KenshiLib is a library that reconstructs Kenshi's structures, exporting a version-independent API for accessing variables and calling and hooking methods.
KenshiLib is released under the GPLv3, please be aware that this generally means KenshiLib plugins must also be released under the GPLv3. KenshiLib also contains 3rd-party components with additional licenses.
Example KenshiLib plugins can be found here.
The easiest way to set up standard plugin dependencies is to use the KenshiLib_Examples dependencies repo, which comes with all required KenshiLib includes + precompiled libs for KenshiLib/Ogre/Boost/Etc.
The steps for setting up a new KenshiLib plugin:
Set the compiler toolchain to Visual Studio 2010.
Add KenshiLib's Include dir to your includes.
Add Boost 1.60.0 includes.
Add KenshiLib + OgreMain .lib files to the linker input (OgreMain .lib is in the KenshiLib repo, KenshiLib .lib is included in KenshiLib releases).
DO use KenshiLib's built-in function hooking system, it is designed to handle multiple plugins hooking the same function.
DON'T use 3rd-party function hooking/detouring libraries as these can cause issues when multiple plugins hook the same function using different libraries.
DON'T access the UI from non-UI threads. Most MyGUI functions are NOT thread-safe, this will cause race conditions that will intermittently crash the game.
If you are exporting functions for other plugins to use, it is wise to make your plugin a Preload Plugin (doccumentation coming) so that it is loaded before other plugins.
Requires Visual Studio 2019 or newer and the Visual C++ 2010 x64 compilers. KenshiLib MUST be compiled using the Visual Studio 2010 compiler. Copies of Visual Studio 2010 can be found on the Wayback Machine.
Also requires boost 1.60.0 and the multihook version of MinHook.
Open the project and compile in RELEASE mode. DEBUG is currently broken.
This repository now includes CMake files so the project can be configured/built from Linux tooling (for example Arch Linux + MinGW-w64 cross toolchain) without depending on .vcxproj directly.
Install required packages on Arch:
sudo pacman -S --needed cmake ninja mingw-w64-gcc git wgetDownload project dependencies (Boost 1.60.0 + MinHook multihook):
./scripts/fetch_deps.shConfigure and build:
BOOST_INCLUDE_PATH=$PWD/third_party/boost_1_60_0 cmake --preset linux-mingw-release
BOOST_INCLUDE_PATH=$PWD/third_party/boost_1_60_0 cmake --build --preset linux-mingw-release -jNotes:
- This CMake path is intended to unblock Linux-based workflows and CI.
- ABI compatibility with the original Kenshi binary is still constrained by the exposed C++ API surface.
- The STL/Boost signature inventory is generated at
docs/ABI_STL_BOOST_AUDIT.md.
