Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
- name: InspectCode
uses: JetBrains/ReSharper-InspectCode@v0.12
with:
tool-version: 2026.1.0.1
# this is WTF tier but if you don't specify *both* of these the defaults assume `build: true`
build: false
no-build: true
Expand Down
15 changes: 15 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<GenerateAssemblyInfo Condition="'$(Configuration)'=='Debug'">false</GenerateAssemblyInfo>
<!-- Required due to the above -->
<NoWarn Condition="'$(Configuration)'=='Debug'">$(NoWarn);CA1416</NoWarn>
<!-- NU1605: Suppress package downgrade error for ppy.Veldrid.SPIRV.
We intentionally override the framework's 1.0.15-gfbb03d21c2 with the fork's
1.0.15-gb268bf39ea. NuGet considers this a "downgrade" because 'b' < 'f' in
prerelease suffix comparison, but it's actually a newer fork build. -->
<NoWarn>$(NoWarn);NU1605</NoWarn>
Comment on lines +10 to +14
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>$(MSBuildThisFileDirectory)app.manifest</ApplicationManifest>
Expand All @@ -19,6 +24,16 @@
<ItemGroup Label="Resources">
<EmbeddedResource Include="Resources\**\*.*" />
</ItemGroup>
<!-- Override ppy.Veldrid.SPIRV with winnerspiros/veldrid-spirv fork for ALL projects.
The fork (1.0.15-gb268bf39ea) is API-compatible and includes:
- 16KB ELF-aligned Android .so (no PatchElfPageSize workaround needed)
- Modern runtimes/android-arm64/native/ NuGet layout (no MonoAndroid10 workarounds)
- CompileCompute interop bug fix, debug flag passthrough, error diagnostics
The .nupkg is in local-packages/ (see NuGet.Config).
This overrides the framework's transitive reference to 1.0.15-gfbb03d21c2. -->
<ItemGroup Label="Veldrid.SPIRV Override">
<PackageReference Include="ppy.Veldrid.SPIRV" Version="1.0.15-gb268bf39ea" />
Comment on lines +33 to +35
</ItemGroup>
<ItemGroup Label="Code Analysis">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" />
Expand Down
10 changes: 10 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<!-- winnerspiros/veldrid-spirv fork NuGet package (included in local-packages/).
Source: https://github.com/winnerspiros/veldrid-spirv/releases -->
<add key="local-packages" value="local-packages" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
3 changes: 3 additions & 0 deletions local-packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Override the root .gitignore to allow checked-in NuGet packages.
# These are fork-built packages not available on nuget.org.
!*.nupkg
Binary file not shown.
49 changes: 7 additions & 42 deletions osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,9 @@
unmanaged function pointers, reflection-based handle discovery).
The default runtime-generated trampolines are slower but proven reliable. -->
<AndroidEnableMarshalMethods>false</AndroidEnableMarshalMethods>
<!-- Suppress XA0141 page-size warnings. ELF patching is disabled for all configurations
(see PatchElfPageSizeEnabled below) to prevent APK signature corruption.
The XA0141 warning is therefore expected and harmless.
AndroidPageSize16KBCompatibilityCheck=false should suppress the check, but Android SDK
36.1.53 still emits XA0141 in some build orderings, so we also add it to NoWarn. -->
<AndroidPageSize16KBCompatibilityCheck>false</AndroidPageSize16KBCompatibilityCheck>
<NoWarn>$(NoWarn);XA0141;NU1608;XA4301</NoWarn>
<!-- Disable ELF alignment patching for ALL configurations.
The custom PatchElfPageSize task can run concurrently with the Android packaging step
because MSBuild's BeforeTargets="Build" fires for every ABI sub-build, which often
overlaps with the main APK assembly pass. Patching .so files in the NuGet cache while
they are being read and packed into the APK can corrupt the ZIP/signing structures,
producing an APK with a null certificate array (INSTALL_PARSE_FAILED_NO_CERTIFICATES).
TODO: Re-enable once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries so no
patching is needed at all, or once the build targets are re-sequenced so
patching always completes before packaging starts. -->
<PatchElfPageSizeEnabled>false</PatchElfPageSizeEnabled>
<NoWarn>$(NoWarn);NU1608;XA4301</NoWarn>
</PropertyGroup>

<!-- Patch NuGet-provided .so files that ship with 4 KB ELF alignment to 16 KB.
See build/PatchElfPageSize.targets for details.
TODO: Remove once ppy.Veldrid.SPIRV ships 16 KB-aligned native libraries. -->
<Import Project="$(MSBuildThisFileDirectory)build\PatchElfPageSize.targets" />

<!-- Release-only optimisations: AOT for low-latency gameplay, trimming for smaller APK.
Suppress trim analysis warnings because the project uses reflection extensively
(Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder). -->
Expand Down Expand Up @@ -81,6 +60,12 @@
<!-- linker's input set; adding this reference ensures it is included. -->
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" NoWarn="NU1510" />
<TrimmerRootAssembly Include="Microsoft.CSharp" RootMode="all" />
<!-- Preserve ppy.Veldrid.SPIRV from trimming. The trimmer does not trace the
CrossCompileTarget enum usage in osu.Framework's VeldridShader/GLShader correctly
(the reference crosses assembly boundaries via a ProjectReference chain), causing
TypeLoadException: 'Could not resolve type Veldrid.SPIRV.CrossCompileTarget' at
startup when the renderer tries to compile shaders. -->
<TrimmerRootAssembly Include="ppy.Veldrid.SPIRV" RootMode="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -98,17 +83,6 @@
ExcludeAssets="native" prevents NuGet from contributing any .so files;
the correct Android-built libraries are supplied by AndroidNativeLibrary below. -->
<PackageReference Include="ppy.osu.Framework.NativeLibs" Version="2025.806.0-nativelibs" ExcludeAssets="native" PrivateAssets="all" />

<!-- ppy.Veldrid.SPIRV ships its Android native library (libveldrid-spirv.so) via a build
targets file under build/MonoAndroid10/. net10.0-android does NOT import MonoAndroid10
build targets — the old Xamarin TFM is not in the NuGet TFM compatibility fallback chain
for modern .NET for Android. The result: the .so never reaches the APK, causing
DllNotFoundException: libveldrid-spirv at shader compilation (startup crash).
ExcludeAssets="buildTransitive;build" prevents NuGet from trying (and failing) to import
the stale targets. GeneratePathProperty gives us $(Pkgppy_Veldrid_SPIRV) to reference
the package content directly. The correct arm64-v8a .so is supplied as
AndroidNativeLibrary below. -->
<PackageReference Include="ppy.Veldrid.SPIRV" Version="1.0.15-gfbb03d21c2" ExcludeAssets="buildTransitive;build" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>

<!-- Include framework native libraries (BASS audio, FFmpeg, etc.) from the submodule.
Expand All @@ -121,22 +95,13 @@
<AndroidNativeLibrary Include="$(MSBuildThisFileDirectory)submodules/osu-framework/osu.Framework.Android/arm64-v8a/*.so" Abi="arm64-v8a" />
</ItemGroup>

<!-- Include Veldrid SPIR-V cross-compiler native library from the NuGet package.
This is the Android arm64-v8a build of libveldrid-spirv that compiles GLSL→SPIR-V
at runtime for Vulkan/OpenGL ES shader loading. -->
<ItemGroup>
<AndroidNativeLibrary Include="$(Pkgppy_Veldrid_SPIRV)/build/MonoAndroid10/native/arm64-v8a/libveldrid-spirv.so" Abi="arm64-v8a" />
</ItemGroup>

<!-- Fail the build early if critical native libraries are missing.
A missing .so means the app will crash on startup with DllNotFoundException.
This catches silent glob failures (e.g. uninitialised submodule, wrong path)
and NuGet restore failures for Veldrid.SPIRV. -->
<Target Name="ValidateFrameworkNativeLibraries" BeforeTargets="Build">
<Error Condition="!Exists('$(MSBuildThisFileDirectory)submodules/osu-framework/osu.Framework.Android/arm64-v8a/libbass.so')"
Text="libbass.so not found in submodules/osu-framework/osu.Framework.Android/arm64-v8a/. Ensure the osu-framework submodule is initialised: git submodule update --init --recursive" />
<Error Condition="!Exists('$(Pkgppy_Veldrid_SPIRV)/build/MonoAndroid10/native/arm64-v8a/libveldrid-spirv.so')"
Text="libveldrid-spirv.so not found in ppy.Veldrid.SPIRV NuGet package. Ensure NuGet packages are restored: dotnet restore" />
</Target>

<PropertyGroup>
Expand Down
4 changes: 4 additions & 0 deletions osu.iOS.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
(Newtonsoft.Json, Realm, AutoMapper, RuntimeBinder) that cannot be statically analysed.
SuppressTrimAnalysisWarnings only suppresses ILLink tool warnings, not the Roslyn analyzer. -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<!-- iOS test projects define an explicit Program.Main entry point (UIApplication.Main).
Microsoft.NET.Test.Sdk v18+ auto-generates MicrosoftTestingPlatformEntryPoint.Main()
which conflicts with the explicit one, producing CS7022 warnings. Disable it. -->
<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<!-- On debug configurations, we use Mono interpreter for faster compilation. -->
Expand Down
Loading