06 ‐ How to compile your own FSMP - DaymareOn/hdtSMP64 GitHub Wiki
Excepted if you’d wish to develop your own evolutions, why would you want to do this?
Because you want to build a version specific to your GPU generation, it might save you some FPS. Until 2.5.1 I built 5 (skyrim versions) x 4 (AVX versions) x 2 (cuda or not) x 2 (release and debug) = 80 versions, I was not able to multiply this by a dozen of GPU generations.
I know of no other reason. If you find one, please tell me.
From version 3.0.0, FSMP is under the GPL 3.0 licence.
-
CMake Add this to your
PATH - PowerShell
-
Vcpkg Add the environment variable
VCPKG_ROOTwith the value as the path to the folder containing vcpkg - Visual Studio Community 2019 Desktop development with C++
-
CommonLibSSENG Add this as as an environment variable
CommonLibSSEPath - CUDA Toolkit 11.6
- Open
x64 Native Tools Command Prompt
cmake
- Close the cmd window
git clone -b dev https://github.com/DaymareOn/hdtSMP64.git
cd hdtSMP64
git submodule update --init --recursive
cmake --preset vs2022-windows-avx2
cmake --build build --config Release
- vs2022-windows
- vs2022-windows-avx
- vs2022-windows-avx2
- vs2022-windows-avx512
Until version 2.5.1, FSMP is under the MIT licence.
You will need to download and install:
- Visual Studio 2019 or 2022 (I use now 2022) (any edition, the free community edition is ok)
- Git
- CMake
- .NET Framework 4.8 Developer Pack too
- 8.1 SDK, not provided with VS2019: https://go.microsoft.com/fwlink/p/?LinkId=323507
- Visual build tools 2015 update 3: https://my.visualstudio.com/Downloads?q=visual%20studio%202015\&wt.mc\_id=o\~msft\~vscom\~older-downloads, take the dvd version and install it
Open a VS2019/VS2022 command prompt (just push the windows key, and begin to type "x64 Native Tools Command Prompt for VS2019" (or 2022)).
Download and build Detours:
The directory we will work in is called C:\Games\Faster HDT-SMP, you can call it as you wish. Do not put it in Program Files.
You can choose another one, but you will have more config steps.
The included bullet code was the same version as aers used when compiling, 2.89, and not the latest 3.00+, where how physics is handled may have been changed.
This has changed since 1.49.0, we now use bullet 3.24. This allowed for multi-threaded calls to bullet.
cd C:\ mkdir Games cd Games mkdir "Faster HDT-SMP" cd "Faster HDT-SMP" git clone https://github.com/microsoft/Detours.git cd Detours nmake
- For the Special Edition, download skse64_2_00_20.7z from https://skse.silverlock.org and unpack into C:\Games\Faster HDT-SMP\ (source code is included in the official distribution).
- For the Steam Anniversary Edition, take the last preliminary AE build (currently 2_02_06). (NB: This guide hasn't been updated for the specific 2_02_03 version).
- For the GOG Anniversary Edition, take the GOG build (currently 2_02_06). (NB: This guide hasn't been updated for the specific 2_02_03 version).
- For the VR edition, take the last VR build (currently 2_00_12).
Get the HDT-SMP source:
cd C:\Games\"Faster HDT-SMP"\skse64_2_00_20\src\skse64 git init git remote add origin https://github.com/DaymareOn/hdtSMP64/ git fetch git checkout master
For VR, "skse64" is replaced by "sksevr", this is true for following instructions too.
NB: in the 2_02_06_gog version, there is no ‘skse64’ and ‘common’ folders!
The arborescence must be like this:
skse64_2_00_20\ skse64_2_00_20\Data skse64_2_00_20\src skse64_2_00_20\src\common (and not common\common) skse64_2_00_20\src\skse64
So:
- Create the move the content of src in a newly created src\skse64 folder
- Copy the ‘common’ folder that is present in the steam 2_02_06 skse archive (\skse64_2_02_06\src\common\common) in the \skse64_2_02_06_gog\ folder.
Change the folders so that src/common/common becomes src/common. No need to do this for VR.
Open C:\Games\Faster HDT-SMP\skse64_2_00_20\src\skse64\hdtSMP64.sln in Visual Studio.
When asked to retarget projects, retarget to the latest, with update to 142 (or 143 if on VS2022).
Make the following changes to the SKSE code:
In NiObjects.h, at line 81 for SE/VR (79 for AE), delete:
virtual void* Unk_05(void);
and replace it with:
virtual BSFadeNode* GetAsBSFadeNode(void);
At line 88 for SE/VR (86 for AE), delete:
virtual void* Unk_0C(void);
and replace it with:
virtual BSDynamicTriShape* GetAsBSDynamicTriShape(void);
In the same file, at line 36 for SE/VR (34 for AE) (the end of the list of class declarations), add:
class BSDynamicTriShape;
class BSFadeNode;
And at line 174 for SE/VR (172 for AE) (inside the enum definition), add:
kNone =0,
In GameEvents.h, at line 667 for SE/AE, 605 for VR, delete:
EventDispatcher<void>unk840;// 840 - sink offset 0C8
and replace it with:
EventDispatcher<TESMoveAttachDetachEvent>unk840;// 840 - sink offset 0C8
In GameMenus.h, before line 1105 for SE, 1056 for VR, 1098 for AE (just before the GetSingleton declaration), add:
bool IsGamePaused() { return numPauseGame > 0; }
In GameData.h, comment out the block of static asserts line 167 (159, 726 and 881 in VR; 171, 172, 173 for AE; same + 720, 875 for 1.6.659).
In skse_version.h line 63, at least for 1.6.1179, replace the line by:
#define CURRENT_RELEASE_RUNTIME RUNTIME_VERSION_1_6_1179_GOG
For 2.2.4, 2.2.5, (2.2.6 ?) in NiRTTI.cpp, replace the content of the file with the content at this address:
https://raw.githubusercontent.com/ianpatt/skse64/master/skse64/NiRTTI.cpp
Close Visual Studio.
For SKSE64 2.1.5 (errors in the provided source code):
- open skse64.sln with a text editor, look for "common\common" and replace it by "common".
For SKSE64 2.2.2, 2.2.4, 2.2.5 and 2.2.6, do this for
-
skse64/skse64.vcxproj,
-
skse64_common/skse64_common.vcxproj,
-
skse64_loader_common/skse64_loader_common.vcxproj,
-
skse64_steam_loader/skse64_steam_loader.vcxproj too.
- open sheets/Runtime.props: look for such a line, and replace the code by the one here:
<PreprocessorDefinitions>RUNTIME_VERSION=0x01061610;%(PreprocessorDefinitions)</PreprocessorDefinitions>
The number must be:
-
0x01050610 for 1.5.97
-
0x01061610 for 1.6.353
-
0x01062800 for 1.6.640
-
0x01062930 for 1.6.659
-
0x010646A0 for 1.6.1130
-
0x01064920 for 1.6.1170
-
0x010649B0 for 1.6.1179
Open C:\Games\Faster HDT-SMP\skse64_2_00_20\src\skse64\skse64.sln in Visual Studio.
Do not retarget. (For VR, retarget to v142).
Select Release and x64.
Open the properties for the different projects (Alt+F7), and for those with an Post-build event (skse64, skse64_loader, skse64_steam_loader), disable it by setting Yes to No.
Then generate the solution.
For AE, ignore the errors concerning the projects with "loader" in their name.
Close Visual Studio.
Reopen the hdtSMP64.sln file.
Open properties (Alt+F7 when the project is selected in the left panel) for the skse64 project.
Select all configurations.
Select General, and change Configuration Type from "Dynamic Library (.dll)" to "Static Library (.lib)".
Depending on your edition, CPU and GPU, select your configuration (ex: AE_CUDA_AVX), x64.
If you choose a CUDA version, and wish max performance, you can configure the CUDA build for your own GPU: in hdtSMP64 properties, CUDA C/C++ -> Device -> Code Generation: only keep the "compute_XX,sm_XX;" which corresponds to your GPU architecture ( https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html\#gpu-feature-list ).
Then 'F7'.