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.
Read before proceeding¶
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 doing basic actions with terminals, such as opening one in specific directories, look up a tutorial online.
In addition, refer to these warnings depending on the platform you are compiling for:
Warning
Make sure to use Command Prompt when typing commands instead of PowerShell, as PowerShell is known to cause issues.
Notice for Steam Deck users
Due to how SteamOS handles packages, building the decompilation on the Steam Deck is highly difficult and not recommended. Instead, consider building it on another Arch Linux device and using that build on the Steam Deck.
TODO
TODO
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.
Warning
An installation of Visual Studio with the Desktop development with C++
workload uses around 8 GB of storage space. Make sure you have the necessary space on your drive before proceeding.
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 avoid potential file path issues.
Run the following command in the vcpkg repository:
Then, add vcpkg to your environment variables by running the following commands in the vcpkg repository:
Run the following command in the terminal:
Set up devKitPro, then run the following command:
Download and install Android Studio.
Download the ZIP archives for libogg and libtheora from xiph.org, then extract and place the libogg-X.X.X
and libtheora-X.X.X
folders into Sonic-Mania-Decompilation/dependencies/RSDKv5/dependencies/android
. Rename the folders libogg
and libtheora
, respectively.
Navigate to Sonic-Mania-Decompilation/dependencies/RSDKv5/android/app/jni
and create the symbolic links in the following table in that directory:
Download the ZIP archives for libogg and libtheora from xiph.org, then extract and place the libogg-X.X.X
and libtheora-X.X.X
folders into RSDKv5-Decompilation/dependencies/android
. Rename the folders libogg
and libtheora
, respectively.
Navigate to RSDKv5-Decompilation/android/app/jni
and create the symbolic links in the following table in that directory:
Symlink Name | Path |
---|---|
RSDKv5 |
Path to RSDKv5-Decompilation (or Sonic-Mania-Decompilation/dependencies/RSDKv5 ) |
Game |
Path to Sonic-Mania-Decompilation (or any other game you'd like to build) |
Name of any mod(s) you'd like to add | Path to the directory for the mod's code containing a CMakeLists.txt file |
How do I make a symbolic link?
You can create a symlink using the appropriate command:
- Windows:
mklink /d "[symlink-name]" "[path]"
(or use Link Shell Extension) - Linux:
ln -s "[path]" "[symlink-name]"
Compiling¶
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. If you built RSDKv5 and Sonic Mania together, Sonic Mania (Game.dll
) will be found in build
while RSDKv5 (RSDKv5(U).exe
) will be found in build/dependencies/RSDKv5
.
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. If you built RSDKv5 and Sonic Mania together, Sonic Mania (libGame.so
) will be found in build
while RSDKv5 (RSDKv5(U)
) will be found in build/dependencies/RSDKv5
.
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: Be more descriptive
Open Sonic-Mania-Decompilation/dependencies/RSDKv5/android/
in Android Studio, install the NDK and everything else that it asks for, and build.
Open RSDKv5-Decompilation/android/
in Android Studio, install the NDK and everything else that it asks for, and build.
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 Linux, 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) |