A compatibility library for Beat Saber PC mods
This originally started out inside ScoreSaber's PC Mod and we decided to extract it into a re-usable library as we may need it for future projects or others may also stand to benefit. For us Legato keeps most game version differences out of the mod itself helping us focus on what's important
dotnet tool install --global LegatoBS.Tool
legato install src/MyMod.csproj \
--source-version 1.29.0 \
--target-version 1.44.1Something like ScoreSaber uses the latest game as its source version then changes the target version for each build
The project path can be left out when the repo has one C# project. Versions can also be read from GameVersion or a manifest.json beside the project
Use --source <path-or-url> for a local package feed or --no-restore when the game references aren't on the current machine
The same setup can be added by hand:
<PropertyGroup>
<LegatoSourceVersion>1.29.0</LegatoSourceVersion>
<LegatoTargetVersion>1.44.1</LegatoTargetVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LegatoBS" Version="0.1.1" PrivateAssets="all" />
</ItemGroup>| Profile | Game versions |
|---|---|
1.29.0 |
1.29.0-1.29.1 |
1.37.1 |
1.37.1-1.37.2 |
1.38.0 |
1.38.0-1.39.1 |
1.40.0 |
1.40.0-1.40.8 |
1.42.0 |
1.42.0-1.44.1 |
Legato compiles its source into the mod, it picks files from the source version, target version and the project's game or mod references. Support for BSML, LeaderboardCore, SiraUtil, SongCore and other mods is included when their references exist
The project needs C# 10 or later. The library reference lists the adapters available to mod code
For a mod such as SongBrowser for example which was written for 1.29.0 and hypothetically being updated to 1.44.1:
- Run
legato installwith1.29.0as the source and1.44.1as the target - Update the game references, mod dependencies and manifest
- Build the existing source and fix anything Legato doesn't cover
- Test the build against the target