Project Setup (Creating a Mod)¶
A DttR mod is a 32-bit Windows DLL that includes dttr_sdk.h, exports mod lifecycle symbols, and links against a build of the DttR SDK.
The easiest starting point is the C template from the latest release:
Starting from the project template¶
Download and extract the template. It includes the CMake project, MinGW toolchain file, SDK linking scripts, container build, and a minimal mod source file.
The starter mod is intentionally small:
#include <dttr_sdk.h>
DTTR_MODS_INFO("minimal", "0.1.0", "DttR")
static const DTTR_Mods_Context *mod_ctx;
DTTR_MODS_INIT {
mod_ctx = ctx;
DTTR_MODS_LOG_INFO(ctx, "Hello world!");
return true;
}
DTTR_MODS_CLEANUP {
DTTR_MODS_LOG_INFO(mod_ctx, "Goodbye world o/");
}
Building the mod DLL¶
Choose the tab for the system you are building on. Each tab includes the full setup, SDK fetch, and build flow for that system.
Set up the build environment
On Linux, macOS, or WSL with Nix, enter the template development shell:
Fetch the DttR SDK
The template downloads a build of the release SDK that matches dttr-version.txt:
Compile the mod DLL
Set up the build environment
On APT-based Linux distributions:
Fetch the DttR SDK
The template downloads a build of the release SDK that matches dttr-version.txt:
Compile the mod DLL
Set up the build environment
On DNF-based Linux distributions:
Fetch the DttR SDK
The template downloads a build of the release SDK that matches dttr-version.txt:
Compile the mod DLL
Set up the build environment
On macOS with Homebrew:
Fetch the DttR SDK
The template downloads a build of the release SDK that matches dttr-version.txt:
Compile the mod DLL
Open an MSYS2 MINGW32 shell before installing or building. If you only see a MINGW64 shortcut, or no MINGW32 shortcut at all, open C:\msys64\mingw32.exe directly.
If you want other shells and applications to find the installed MINGW32 tools, add these entries to your Windows Path user variable:
C:\msys64\mingw32\binC:\msys64\usr\bin
Set up the build environment
Install MSYS2 if needed:
Install the build tools:
Fetch the DttR SDK
In MSYS2:
or in PowerShell:
Compile the mod DLL
In the MSYS2 MINGW32 shell, or a new Windows terminal after configuring Path for MINGW32:
Set up the build environment
Install your containerization software of choice.
Fetch the DttR SDK
You can skip this step when using the default container build because it fetches the SDK for you.
If you pass --build-arg DTTR_FETCH_SDK=0, fetch the SDK first so the local SDK files exist in the build context:
Compile the mod DLL
Build the template into a local container image, then copy the compiled DLL out of the artifact image:
# Build the template into a local container image.
podman build -t dttr-minimal-mod -f Containerfile .
# Create a container from that image so we can copy files out of it.
container_id=$(podman create dttr-minimal-mod)
# Copy the built DLL from the container into the same output path as local builds.
mkdir -p build/debug
podman cp "$container_id:/build/debug/minimal-mod.dll" build/debug/minimal-mod.dll
# Remove the temporary container.
podman rm "$container_id"
The built mod should be here: