-
Notifications
You must be signed in to change notification settings - Fork 156
Getting Started
Ryan edited this page Jun 28, 2020
·
9 revisions
- Download and install the latest copy of Visual Studio.
- Download a copy of SKSE64 and extract the folder
skse64_X_XX_XX
. This folder will be our working directory, and all instructions will be made relative to this folder. - Open up
src\skse64\skse64.sln
. This is the the solution we will use to manage and build our own projects. Don't worry if the solution complains about source control; feel free to remove it. The solution may also ask you to upgrade the SDK/toolset. Again, feel free to upgrade them, as the SDK/toolset you use is not really important. - Ensure your solution is configured to build in Debug.
-
Disable SKSE's post-build events by selecting all projects, right click -> Properties -> Configuration Properties -> Build Events -> Post-Build Event -> Use In Build -> No. SKSE's build events are configured for their environment, however ours is different, so we won't be using them.
- Ensure these changes are applying to all configurations.
- Select the SKSE project, click on the Build tab and go ahead and build the project. You may notice some common warnings/errors in your Error List:
-
E0070: This error is commonly thrown by SKSE's
STATIC_ASSERT
macro, and typically indicates that a size, or offset assert failed. Intellisense can fail to evaluate certain templated types properly, and will throw this error as a false positive while browsing, however the error should not be thrown during compilation. Feel free to ignore this error. - LNK4221: This link warning indicates an unused object file, which implies certain code is completely unused by the project. In a reverse-engineered resource such as SKSE, where you won't be using everything, you can feel free to ignore this warning.
-
E0070: This error is commonly thrown by SKSE's
- Copy
src\skse64\x64\Debug\skse64_X_X_XX.dll
to your root game directory (i.e.Skyrim Special Edition\skse64_X_X_XX.dll
). You now have a debug build of SKSE ready for developing SKSE plugins. - Finally, grab a copy of Steamless and use it to strip Steam's anti-debug DRM from your copy of
SkyrimSE.exe
. Now you can attach a debugger to Skyrim and set breakpoints without the program crashing.- Make sure to save the original executable and rename the unpacked one from
SkyrimSE.exe.unpacked.exe
toSkyrim.exe
- Make sure to save the original executable and rename the unpacked one from
- Download the example plugin and extract it to
src\skse64\
. - Add the project to the solution by selecting File -> Add -> Existing Project...
- Change SKSE64 to build as a static lib by right clicking on
skse64
in the Solution Explorer and selecting Properties -> Configuration Properties -> General -> Project Defaults -> Configuration Type -> Static library (.lib) - Finally, select
MyFirstPlugin
from the Solution Explorer and build it.
- Vcpkg is what I use to automatically manage and build all of my dependencies. If you want to manage your dependencies manually, go ahead and skip these steps.
- Download and install Vcpkg.
- Integrate vcpkg with
vcpkg integrate install
- Go to
triplets\community
and duplicate the filex64-windows-static-md.cmake
. Rename it tox64-windows-custom.cmake
. - Install Xbyak with
vcpkg install xbyak:x64-windows-custom
. - Install span-lite with
vcpkg install span-lite:x64-windows-custom
.
- Add Skyrim: Special Edition's path as an environment variable entitled
Skyrim64Path
. This should point to the folder containing the main executable (SkyrimSE.exe
). - Clone a copy of CommonLibSSE to your computer and add its path as an environment variable entitled
CommonLibSSEPath
. This should point to the folder containing the solution file (CommonLibSSE.sln
). - Clone a copy of the example plugin to your computer.
- Open the example plugin's solution file (
MyFirstPlugin.sln
) and build it.
- Move your plugin from
src\skse64\x64\Debug\MyFirstPlugin.dll
toSkyrim Special Edition\Data\SKSE\Plugins\MyFirstPlugin.dll
(the CommonLibSSE example project does this step automatically). - Run
Skyrim Special Edition\skse64_loader.exe
and attach to it by selecting Debug -> Attach to Process... and choosing SkyrimSE.exe from the list of available processes. - That's it! Your plugin is now loaded, and your debugger is attached to the process. Alternatively, you could try setting a break point before attaching the debugger and step through your plugin's code.