Skip to content

Erano01/KenshiLib

 
 

Repository files navigation

MOVED

This repo has been moved to: https://github.com/BFrizzleFoShizzle/KenshiLib


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.

Developing RE_Kenshi/KenshiLib plugins

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).

Plugin Best-practices

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.

Compiling

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.

Image

Also requires boost 1.60.0 and the multihook version of MinHook.

Open the project and compile in RELEASE mode. DEBUG is currently broken.

CMake (Linux/Arch setup)

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 wget

Download project dependencies (Boost 1.60.0 + MinHook multihook):

./scripts/fetch_deps.sh

Configure 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 -j

Notes:

  • 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.

About

Reconstruction of game structures and methods for Kenshi. Cross-platform fork of KenshiLib, adding a C-compatible API layer to enable plugin development on Linux via open toolchains.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 79.0%
  • Assembly 19.4%
  • C 1.6%