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 VS2019
# Build the release config
cmake --build --preset VS2019 --config Release
# Install
cmake --build --preset VS2019 --config Release --target install
and/or using the CMake GUI to configure and modify compilation options:
Of course you can replace VS2019
by VS2022
if you are using Visual Studio 2022.
Note: The
ninja
preset requires to run thecmake
configuration 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_FOLDER
It 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.exe
executable is omitted,D2.DetoursLauncher
will 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
.dll
s to be under the./patch
folder of the current working directory. This can be overriden using theDIABLO2_PATCH
environment variable. CMake will set this variable by default for debugging.