Skyrim Special Edition
0 of 0

File information

Last updated

Original upload

Created by

ryobg

Uploaded by

ryobg

Virus scan

Safe to use

About this mod

Framework for hooking upon the Skyrim process functions. Supports shared storage between users.

Requirements
Permissions and credits
Translations
Mirrors
Changelogs
Motivation
I have seen many times patch mods breaking due to SSE / SKSE upgrade and me, and others, waiting for somebody to rebuild them with the proper "magic" numbers so they can be used again. There were cases when the numbers are even known, but due to the closed source nature of the project or its complexity to build/fix it was left to dust.

So I came up with my own solution, which is shared here, with the idea that somebody may use it too. The concept is simple: provide common base for hooking upon functions or variables in the memory. Sometimes these can be automatically found, sometimes these have to be fixed manually. In order to avoid rebuilding the binary, a file which maps name to an address can be used. When a binary wants to patch given function it will just read that file and see the number inside and go on. If the runtime change, update the file and thats all.

Features
  • Support JSON based file which maps unique names to address (runtime updates can be done too).
  • Overpatching the same function using user profiles.
  • Independant of SKSE version
  • Flexible manipulation of the internal JSON database, allowing custom settings and updates
  • Believe it is convenient enough to be used from other languages other than C/C++ and even for other application other than Skyrim.
  • Automatic merging of JSON patches

There is more full-featured documentation and API specification on the source repo:
https://github.com/ryobg/sse-hooks

Remarks
With version 1.1, an automatic patch mechanism was added. On startup, all `Data\SKSE\Plugins\sse-hooks\*.json` patches will be enumerated, sorted alphabetically and applied. This basically allows any plugin relying on the SSE Hooks to just drop there files with the needed addresses (or other JSON storage tunings) and consider it done. An example:

A mod wants to keep the player location address in SSE Hooks. On load it should set some default value for it (maybe based on the current runtime) and then call `sseh.find_target ("Player.Location", &address)`. At some point when the runtime changes, that pointer is relocated somewhere else. What needs to be done is somebody/whoever to put, or update, the json file in that folder with the content of: [{ "op":"add", "path":"/map/Player.Location/target", "value":"0x400200" }] - that's all. No need to recompile, release again the mod or something.

Developing code for that plugin should use the C/C++ header files available on GitHub.

Thanks
The mighty MinHook library which is used a lot around.
The lightweight JSON library from nlohmann.