Building the RSDKv5 & Sonic Mania Decompilations
The RSDKv5 and Sonic Mania decompilations use CMake, a versatile building system that supports many different compilers and platforms.
Note
This guide requires basic knowledge of how to use the appropriate terminal for your OS, such as Command Prompt for Windows. If you aren't familiar with opening terminals in specific directories, look up a tutorial online.
Get the source code
In order to clone the repository, you need to install Git, which you can get here.
Clone the repo recursively, using:
If you've already cloned the repo, run these commands inside of the repository to ensure the clone is up-to-date:
Getting dependencies
Install CMake. Make sure to enable the feature to add CMake to the system PATH during the installation.
To handle dependencies, you'll need to install Visual Studio Community with the Desktop development with C++
workload. If you already have Visual Studio installed, you can manage your installed workloads by opening Visual Studio Installer from the Start Menu and clicking the Modify
button next to your Visual Studio installation.
You will also need to set up vcpkg. You only need to follow 1 - Set up vcpkg
in the guide.
Tip
It's recommended to clone vcpkg into a short path such as C:/src
to keep future commands from getting too long.
Run the following command in the vcpkg repository in Command Prompt:
Run the following command in the terminal:
Set up devKitPro, then run the following command:
TODO
Compiling
Enter the following commands in the RSDKv5/Mania decompilation repository directory:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
cmake --build build --config release
Important!
[vcpkg root]
should be replaced with the path to the vcpkg repository. For example, if the repository is located in C:/src/vcpkg
, the first command to enter would be:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static
C:/github repos/vcpkg
, the first command to enter would be:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows-static -A Win32
cmake --build build --config release
Important!
[vcpkg root]
should be replaced with the path to the vcpkg repository. For example, if the repository is located in C:/src/vcpkg
, the first command to enter would be:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:/src/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x86-windows-static -A Win32
C:/github repos/vcpkg
, the first command to enter would be:
The resulting build(s) will be located somewhere in build/
depending on your system.
You can set build flags by adding -D[flag-name]=[value]
to the end of the first command. For example, to build with RETRO_DISABLE_PLUS
set to on, add -DRETRO_DISABLE_PLUS=on
to the command.
Enter the following commands in the RSDKv5/Mania decompilation repository directory:
The resulting build(s) will be located somewhere in build/
depending on your system.
You can set build flags by adding -D[flag-name]=[value]
to the end of the first command. For example, to build with RETRO_DISABLE_PLUS
set to on, add -DRETRO_DISABLE_PLUS=on
to the command.
Enter the following commands in the RSDKv5/Mania decompilation repository directory:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
cmake --build build --config release
The resulting build will be located somewhere in build/
depending on your system.
You can set build flags by adding -D[flag-name]=[value]
to the end of the first command. For example, to build with RETRO_DISABLE_PLUS
set to on, add -DRETRO_DISABLE_PLUS=on
to the command.
TODO
Build Flags
Warning
These build flags modify certain aspects of the decomps; only use these if you know what you're doing!
RSDKv5
Flag | Description | Value Type | Default Value |
---|---|---|---|
RETRO_REVISION | The RSDKv5 revision to compile. Datapacks for certain versions of Sonic Mania only work on older revisions. Set to 3 to build RSDKv5U. |
Integer (See Revisions) | 3 |
RETRO_DISABLE_PLUS | Disables access to content from Sonic Mania and Sonic Origins' Plus DLC. Any publicly distributed builds must have this flag enabled. | Boolean | off |
RETRO_MOD_LOADER | Enables the ability the load mods and certain features related to them. | Boolean | on |
RETRO_MOD_LOADER_VER | The revision of the mod loader to build. | Integer (1 or 2 ) |
2 |
RETRO_SUBSYSTEM | The backend used to handle rendering, controller inputs, etc. | String (See Subsystems) | DX9 on Windows, OGL on other platforms |
Revisions
Flag Value | Revision |
---|---|
1 | REV01 (Sonic Mania Pre-Plus) |
2 | REV02 (Sonic Mania Plus) |
3 | REV0U (RSDKv5U) |
Subsystems
Flag Value | Subsystem |
---|---|
DX9 | DirectX 9 (Windows Only) |
DX11 | DirectX 11 (Windows Only) |
OGL | OpenGL |
SDL2 | SDL2 |
VK | Vulkan |
Sonic Mania
Flag | Description | Value Type | Default Value |
---|---|---|---|
WITH_RSDK | Builds RSDKv5 alongside Sonic Mania. | Boolean | on |
GAME_STATIC | Builds both RSDKv5 and Sonic Mania into one executable. Has no effect if WITH_RSDK is disabled. |
Boolean | off on Windows or Unix-based platforms, on on other platforms |
MANIA_FIRST_RELEASE | Builds the initial console release of Sonic Mania. | Boolean | off |
MANIA_PRE_PLUS | Builds the last release of Sonic Mania before the Plus update. | Boolean | off |
GAME_INCLUDE_EDITOR | Includes code for use in editors such as RetroED. | Boolean | on |
GAME_VERSION | The version of the game to build. Has no effect if MANIA_FIRST_RELEASE or MANIA_PRE_PLUS are enabled. |
Integer (See Game Versions) | 6 |
Game Versions
Flag Value | Game Version |
---|---|
0 | 1.00 - 1.02 (Initial console release) |
3 | 1.03 (Initial Steam release, last Pre-Plus release) |
5 | 1.04 / 1.05 (Mania Plus release) |
6 | 1.06 (Latest Steam release) |
7 | 1.07 (EGS/Origin release) |