Skip to content

Fix unresolvable RequestedOrientation cref + sanity-check fixes (oboe teardown race, vulkan unchecked returns, ClicksPerSecond rewind correctness) - #244

Merged
winnerspiros merged 4 commits into
masterfrom
copilot/fix-xml-comment-cref-issue
Apr 22, 2026
Merged

Fix unresolvable RequestedOrientation cref + sanity-check fixes (oboe teardown race, vulkan unchecked returns, ClicksPerSecond rewind correctness)#244
winnerspiros merged 4 commits into
masterfrom
copilot/fix-xml-comment-cref-issue

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown

Fixes the Build Android APK warning at osu.Android/OsuGameAndroid.cs:93 (XML comment has cref attribute 'RequestedOrientation' that could not be resolved) and follows up with a full sanity-check pass over the Android stack and fork-introduced changes.

Primary fix

  • RequestedOrientation is inherited from Android.App.Activity; the C# compiler will not resolve it on the derived OsuGameActivity inside a cref. Qualified to the declaring base type:
/// Last value passed to <see cref="global::Android.App.Activity.RequestedOrientation"/> by ...

Repo hygiene

  • Deleted archive.zip (5.1 MB realm/db dump) and native_crash.log (4.2 KB device log) accidentally committed at the repo root.

Latent issues found and fixed during the sanity check

  • Native/oboe_bridge.{h,cpp} — added a disposing_ atomic set by stop() and re-checked at the entry of onErrorAfterClose and inside reopenAndRestart (both pre- and post-streamLock_). Closes the window where Oboe's internal error-callback thread could reopen the stream while .NET is destroying the bridge, leaving requestStart() running inside a freed object.
  • Native/vulkan_bridge.cppvkEnumeratePhysicalDevices and vkEnumerateDeviceExtensionProperties return values are now checked; zero-count branches return early before allocating result vectors.
  • CrashDiagnostics.InstallNativeHandler — replaced trailing dead Interlocked.Exchange(ref initialised, 1) with an early-return idempotency guard at function entry, matching the docstring.
  • ClicksPerSecondController.Update — the existing perf rewrite assumed timestamps is monotonically sorted, but OnPressed appends at clock.CurrentTime which can decrease on rewind/seek, so the suffix-only trim and the < earliestTimeValid → break short-circuit can both under-count the window. Replaced with an O(n) in-place compaction trim and a full-scan window count — same big-O as the intended optimization, correct under non-monotonic insertions. TestInputsDiscardedOnRewind (monotonic inputs) is unaffected.

Re-verified (no change needed)

  • OsuGameActivity is internally consistent: ScreenOrientation.Landscape in the [Activity] attribute and no runtime RequestedOrientation write in OnCreate for phones is the deliberate fix from 4c2868a46e to avoid SurfaceView recreate during Vulkan-init. The older "SensorLandscape" stored memory was stale.

Audit coverage (no further changes)

Android native + managed (input handlers, AndroidImportTask, AndroidHighPerformanceSessionManager, OboeAudioBridge, VulkanProbe, AndroidNativeBridgeManager); build/packaging (osu.Android.{csproj,props}, mono.env, AndroidManifest.xml, CMakeLists.txt, build/PatchElfPageSize.targets — unused but harmless, local-packages/, NuGet.Config); fork changes in OsuGame.cs, OsuGameBase.cs, WebSocketServer.cs, OsuWebSocketProvider.cs, gameplay hot-path LINQ→loop conversions in HitObjectContainer / GameplaySampleTriggerSource / ColourHitErrorMeter; CI workflows (keystore secrets are properly ::add-mask::'d before being placed into $GITHUB_OUTPUT); GH advisory DB check on bumped deps (AutoMapper 16, Humanizer 3, SharpCompress 0.47.3, Sentry 6.2.0, …) clean.

Copilot AI and others added 4 commits April 22, 2026 20:56
…crash.log)

Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/8111c8d2-c4b8-44dd-8781-2101b8565806

Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
… returns, dead init flag)

Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/723b0a22-1e22-46b1-8a18-b6ec5a94f645

Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
…f path

Agent-Logs-Url: https://github.com/winnerspiros/osu/sessions/723b0a22-1e22-46b1-8a18-b6ec5a94f645

Co-authored-by: winnerspiros <1675249+winnerspiros@users.noreply.github.com>
@winnerspiros
winnerspiros marked this pull request as ready for review April 22, 2026 21:26
Copilot AI review requested due to automatic review settings April 22, 2026 21:26
@winnerspiros
winnerspiros merged commit 68cb6ea into master Apr 22, 2026
14 of 16 checks passed
@gitar-bot

gitar-bot Bot commented Apr 22, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Android build hygiene and stability/correctness improvements across the Android native/managed stack, plus a rewind-correctness fix for the clicks-per-second HUD controller.

Changes:

  • Fixes an unresolvable XML doc cref in OsuGameAndroid by qualifying RequestedOrientation to Android.App.Activity.
  • Hardens Android native bridges: adds teardown guards to Oboe recovery paths and checks Vulkan probe API return codes / zero-count branches.
  • Fixes ClicksPerSecond counting correctness under gameplay rewind/seek by removing assumptions about monotonic timestamps.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
osu.Game/Screens/Play/HUD/ClicksPerSecond/ClicksPerSecondController.cs Updates timestamp trimming/counting to be correct with out-of-order timestamps caused by rewind/seek.
osu.Android/OsuGameAndroid.cs Fixes XML doc cref resolution for RequestedOrientation.
osu.Android/Native/vulkan_bridge.cpp Adds return-code checks and early-outs for Vulkan probing enumeration calls.
osu.Android/Native/oboe_bridge.h Introduces an atomic disposing_ flag for teardown coordination.
osu.Android/Native/oboe_bridge.cpp Uses disposing_ to prevent error-callback recovery from racing with teardown.
osu.Android/CrashDiagnostics.cs Makes InstallNativeHandler() idempotent via an early Interlocked guard; removes trailing dead exchange.
native_crash.log Removes an accidentally-committed runtime log from repo root.
archive.zip Removes an accidentally-committed archive from repo root.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +39 to +43
// Timestamps are appended at clock.CurrentTime which is *usually* monotonic, but
// gameplay rewinds (and replay seeks) can append a smaller value after a larger
// one — so the list is not strictly sorted. We still scan from the end (where
// newly-appended entries live) to match the access pattern of the previous
// implementation, but we cannot stop early on either bound because an older

std::vector<VkPhysicalDevice> devices(deviceCount);
if (vkEnumeratePhysicalDevices(instance_, &deviceCount, devices.data()) != VK_SUCCESS) return false;
if (deviceCount == 0) return false;
Comment on lines +52 to +56
{
double t = timestamps[read];

if (t > latestValidTime)
continue;
Comment on lines +41 to +48
// one — so the list is not strictly sorted. We still scan from the end (where
// newly-appended entries live) to match the access pattern of the previous
// implementation, but we cannot stop early on either bound because an older
// out-of-order entry may live anywhere in the list.

// First pass: drop any timestamps now in the future (caused by rewinding).
// Walk backwards and shift surviving entries down in-place; this is O(n) and
// avoids the O(n²) RemoveAt-in-loop pattern of the original code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants