Skip to content

This is an experimental reverse engineered library for Skyrim VR (ported from CommonLibSSE). There are two main branches (vr) which is based on po3's using ifdefs, and (ng) which is an updated NG build. NG is the default branch.

License

Notifications You must be signed in to change notification settings

alandtse/CommonLibVR

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3,196 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CommonLibSSE NG

C++23 Platform Latest Release Main CI

CommonLibSSE NG is a fork of CharmedBaryon's CommonLibSSE-NG, itself a fork of CommonLibSSE, which tracks upstream updates but adds a number of enhancements. It supports Skyrim Special Edition (SE), Skyrim Anniversary Edition (AE), and Skyrim Virtual Reality (VR).

Usage

To develop a C++ project that uses CommonLibSSE, you'll want to have this code available for discovery, and included as a build dependency by your build manager. Below are examples using the xmake or cmake managers.

Getting the code: Git SubModule

Assuming you have a folder with your mod material, this can be converted to a git repository, for which this repo can be added as a submodule, allowing git to manage updates, paths, names, versions... To do this:

Use the folder to initialize a git repository:

PS E:\Git\foo-bar> git init
Initialized empty Git repository in E:/Git/foo-bar/.git/

Add this CommonLibSSE repo as a git submodule, specifying the ng branch, and storing it in lib/commonlibsse-ng folder:

PS E:\Git\foo-bar> git submodule add -b ng https://github.com/alandtse/CommonLibVR.git lib/commonlibsse-ng
Cloning into 'E:/Git/foo-bar/lib/commonlibsse-ng'...
remote: Enumerating objects: 66210, done.
remote: Counting objects: 100% (2526/2526), done.
remote: Compressing objects: 100% (197/197), done.
remote: Total 66210 (delta 2397), reused 2335 (delta 2329), pack-reused 63684 (from 1)
Receiving objects: 100% (66210/66210), 18.99 MiB | 19.58 MiB/s, done.
Resolving deltas: 100% (51252/51252), done.
PS E:\Git\foo-bar

Tip

If your submodule ended up in a location where the rest of the code can't find it, you can remove & re-add submodules, see https://stackoverflow.com/a/1260982

At this point, git is tracking changes to your code in your machine. You can add a cloud-based remote for backup, distribution, or collaboration; instructions are here for GitHub or CodeBerg.

To update your project's submodules you can use:

PS E:\Git\foo-bar> git submodule update --init --recursive

Build Dependency: Xmake

If using the Xmake build system, you can add a build dependency and a custom rule suitable for SKSE plugins by adding this to your DLL target recipe:

target("my_plugin")
   set_kind("shared")                         --specifies this is a DLL
   add_deps("commonlibsse-ng")                --adds the dependency

   add_rules("commonlibsse-ng.plugin", {      --adds a custom build rule, whose details are in CommonLibSSE
      name = "my_plugin",
      author = "Dovahkiin",
      description = "SKSE64 plugin using CommonLibSSE-NG"
   })

Build Dependency: CMake

If using the CMake build system, you can add the following in CMakeLists.txt to compile and link successfully:

find_package(CommonLibSSE REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC CommonLibSSE::CommonLibSSE)

New Features

Multiple Runtime Targets

stability

CommonLibSSE NG has support for Skyrim SE, AE, and VR, and is able to create builds for any combination of these runtimes, including all three. This makes it possible to create SKSE plugins with a single DLL that works in any Skyrim runtime, improving developer productivity (only one build and CMake preset necessary) and improving the end-user experience (no need to make a choice of multiple download options or select the right DLL from a FOMOD). For Skyrim AE, both versions before 1.6.629 and those after are supported in a single DLL (both struct layouts are supported).

Builds that target multiple ABI-incompatible runtimes provide the necessary (but minimal) abstractions needed to work transparently regardless of the Skyrim edition in use. All functionality and classes from all runtimes is always available for potential use, with the necessary support for probing the features available. This allows single plugins that dynamic alter their behavior to take advantage of the specific features of a single Skyrim edition (e.g. VR features) when that runtime is present.

Read about multi-targeting, and how you can take advantage in your project.

Simplified Plugin Declaration

stability

Historically, plugins needed to define SKSEPlugin_Version or SKSEPlugin_Query to be detected as SKSE plugins. To simplify code and ensure both functions are generated for correct cross-runtime compatibility, this is made code-free in CommonLibSSE NG. Just replace add_library with add_commonlibsse_plugin in CMakeLists.txt and CMake will create your shared library target, configure CommonLibSSE linkage, and auto-generate this content and inject it into the plugin.

find_package(CommonLibSSE REQUIRED)

add_commonlibsse_plugin(${PROJECT_NAME}
    SOURCES ${headers} ${sources})

Read more on the project wiki.

Clang Support

stability-beta

Clang 13.x and newer are supported when built for MSVC ABI compatibility (versions built natively for Windows). It is even hypothetically possible, with the proper setup, to cross-compile with Clang from a Linux host (testing and instructions for this are pending). Note that currently linking must still be done with the Microsoft linker, pending fixes to SKSE itself.

Read more on the project wiki.

Unit Testing Enhancements

stability-stable

Improvements have been made to the way in which the Skyrim executable module is accessed for the sake of memory relocation and handling of Address Library IDs. This makes it easier to run CommonLibSSE-based plugin code outside of the context of a Skyrim process so that unit testing is possible. It is even possible to handle a minimal level of functionality from the engine by loading in a Skyrim executable module programmatically during testing, allowing, for example, tests to be run within a single test suite that vary between SE, AE, and VR executables.

Read more on the project wiki.

Older Releases via Vcpkg and Conan

Warning

These are not part of this repository and are not currently maintained.

Older versions of CommonLibSSE, specifically CharmedByron's, are (were) available as a vcpkg port and as a Conan package. These are not maintained as part of this project.

See how to use CommonLibSSE NG in your project.

Ninja Builds

stability-stable

CommonLibSSE NG migrates the build system to Ninja, resulting in faster parallel builds than NMake.

Other Changes

  • Ability to define offsets and address IDs for objects which can exist in only a subset of runtimes, while being able dynamically test for feature support before using those offsets.
  • Completely regenerated RTTI and vtable offsets, now with consistent naming and access across all runtimes.
  • Updated GitHub Actions CI workflows to build for all likely target runtime combinations.
  • Fully extensible native function binding traits (enables custom script object bindings in Fully Dynamic Game Engine).
  • Better support for the CLion IDE.

Build Dependencies

Dependencies are managed via vcpkg. See vcpkg.json for the complete list.

Core Dependencies:

Build Tools:

End User Dependencies

Development

Notes

  • CommonLib is incompatible with SKSE and is intended to replace it as a static dependency. However, you will still need the runtime component.

About

This is an experimental reverse engineered library for Skyrim VR (ported from CommonLibSSE). There are two main branches (vr) which is based on po3's using ifdefs, and (ng) which is an updated NG build. NG is the default branch.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 92.4%
  • ActionScript 5.1%
  • CMake 1.1%
  • C 1.0%
  • Python 0.1%
  • Xmake 0.1%
  • Other 0.2%