For the patching we rely on the D2.Detours project, which is included as a git submodule. (use the git submodule update --init command, or clone this project with git clone --recursive)
You will also need to install the CMake build system and Visual C++ (or any C++ compiler that can generate .DLLs on Windows) which are freely available.
The recommended way is to use CMake presets.
You can generate a VS solution (in out/build/VS20XX) using the command-line:
# Configure the CMake project
cmake --preset DefaultGenerator
# Build the release config
cmake --build --preset DefaultGenerator --config Release
# Install
cmake --build --preset DefaultGenerator --config Release --target installand/or using the CMake GUI to configure and modify compilation options:

Of course you can replace DefaultGenerator by VS2022 if you are using Visual Studio 2022.
Note: The
ninjapreset requires to run thecmakeconfiguration step to be ran from the x86 Native Command Prompt.
If you do not wish to use the presets:
# Configure the CMake project
cmake -A Win32 -B YOU_BUILD_DIR
# Build the release config
cmake --build YOU_BUILD_DIR --config Release
# Install
cmake --install YOU_BUILD_DIR --config Release --prefix YOUR_INSTALL_FOLDERIt is also possible to use Visual Studio "Open folder" feature or Visual Studio Code, however you will need to configure Launch.vs.json manually, which is not practical nor recommended .
If you are using a default Diablo2 install and generated .sln through CMake, you are good to go!
Otherwise (for example if you need to configure your installation folder) have a look at the Debugging documentation.
Launch Diablo2 (or D2SE) by using the command D2.DetoursLauncher [Path to Game.exe or D2SE.exe].
- If the
Game.exe/D2SE.exeexecutable is omitted,D2.DetoursLauncherwill look for executables using the registry, working directory andPATH. - You can pass the executable parameters by using the
--parameter.
For example:D2.DetoursLauncher [Game.exe] -- -direct -txt -w. - The detours .dll expects patch
.dlls to be under the./patchfolder of the current working directory. This can be overriden using theDIABLO2_PATCHenvironment variable. CMake will set this variable by default for debugging.