Skip to content
19 changes: 15 additions & 4 deletions osu.Android/Native/VulkanRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace osu.Android.Native
public class VulkanRenderer : IDisposable
{
private long nativePtr;
private readonly object disposeLock = new object();

public VulkanRenderer()
{
Expand All @@ -18,7 +19,14 @@ public VulkanRenderer()

public void Initialize(IntPtr surface) => nVulkanInit(nativePtr, surface);

public void Render() => nVulkanRender(nativePtr);
public void Render()
{
lock (disposeLock)
{
if (nativePtr != 0)
nVulkanRender(nativePtr);
}
}

public void Dispose()
{
Expand All @@ -28,10 +36,13 @@ public void Dispose()

protected virtual void Dispose(bool disposing)
{
if (nativePtr != 0)
lock (disposeLock)
{
nVulkanDestroy(nativePtr);
nativePtr = 0;
if (nativePtr != 0)
{
nVulkanDestroy(nativePtr);
nativePtr = 0;
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions osu.Android/Native/oboe_audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ extern "C" {
nOboeStart((long)audioPtr);
}

JNIEXPORT void JNICALL Java_osu_Android_Native_OboeAudio_nOboeStop(JNIEnv* env, jobject obj, jlong audioPtr) {
nOboeStop((long)audioPtr);
}

JNIEXPORT jdouble JNICALL Java_osu_Android_Native_OboeAudio_nOboeGetTimestamp(JNIEnv* env, jobject obj, jlong audioPtr) {
return (jdouble)nGetTimestamp((long)audioPtr);
}
Expand Down
2 changes: 2 additions & 0 deletions osu.Android/OsuGameActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ protected override void OnCreate(global::Android.OS.Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);

global::Java.Lang.JavaSystem.LoadLibrary("osu.Android.Native");

// OnNewIntent() only fires for an activity if it's *re-launched* while it's on top of the activity stack.
// on first launch we still have to fire manually.
// reference: https://developer.android.com/reference/android/app/Activity#onNewIntent(android.content.Intent)
Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void TestSelectionDismissedOnUndo()
InputManager.Click(MouseButton.Left);
});

AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 2170);
AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value?.Time == 2170);
AddUntilStep("Ensure seeked to correct time", () => EditorClock.CurrentTimeAccurate == 2170);

AddStep("Adjust offset", () =>
Expand All @@ -97,7 +97,7 @@ public void TestSelectionDismissedOnUndo()

AddUntilStep("wait for offset changed", () =>
{
return timingScreen.SelectedGroup.Value.ControlPoints.Any(c => c is TimingControlPoint) && timingScreen.SelectedGroup.Value.Time > 2170;
return timingScreen.SelectedGroup.Value.ControlPoints.Any(c => c is TimingControlPoint) && timingScreen.SelectedGroup.Value?.Time > 2170;
});

AddStep("undo", () => changeHandler?.RestoreState(-1));
Expand All @@ -114,7 +114,7 @@ public void TestSelectionDismissedOnUndo()
// InputManager.Click(MouseButton.Left);
// });
//
// AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 2170);
// AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value?.Time == 2170);
// AddUntilStep("Ensure seeked to correct time", () => EditorClock.CurrentTimeAccurate == 2170);
//
// AddStep("Adjust offset", () =>
Expand All @@ -125,14 +125,14 @@ public void TestSelectionDismissedOnUndo()
//
// AddUntilStep("wait for offset changed", () =>
// {
// return timingScreen.SelectedGroup.Value.ControlPoints.Any(c => c is TimingControlPoint) && timingScreen.SelectedGroup.Value.Time > 2170;
// return timingScreen.SelectedGroup.Value.ControlPoints.Any(c => c is TimingControlPoint) && timingScreen.SelectedGroup.Value?.Time > 2170;
// });
//
// AddStep("undo", () => changeHandler?.RestoreState(-1));
//
// AddUntilStep("selection retained", () =>
// {
// return timingScreen.SelectedGroup.Value.ControlPoints.Any(c => c is TimingControlPoint) && timingScreen.SelectedGroup.Value.Time > 2170;
// return timingScreen.SelectedGroup.Value.ControlPoints.Any(c => c is TimingControlPoint) && timingScreen.SelectedGroup.Value?.Time > 2170;
// });
//
// AddAssert("check group count", () => editorBeatmap.ControlPointInfo.Groups.Count, () => Is.EqualTo(10));
Expand Down
10 changes: 5 additions & 5 deletions osu.Game.Tests/Visual/UserInterface/TestSceneModPresetColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public void TestAddingFlow([Values] bool withSystemModActive)
});

OsuPopover? popover = null;
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault()) != null);
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault())?.IsPresent == true);
AddStep("attempt preset creation", () =>
{
InputManager.MoveMouseTo(popover.ChildrenOfType<ShearedButton>().Single());
Expand Down Expand Up @@ -254,7 +254,7 @@ public void TestAddingFlow([Values] bool withSystemModActive)
InputManager.Click(MouseButton.Left);
});

AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault()) != null);
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault())?.IsPresent == true);
AddStep("clear mods", () => SelectedMods.Value = Array.Empty<Mod>());
AddUntilStep("popover closed", () => !this.ChildrenOfType<OsuPopover>().Any());
}
Expand Down Expand Up @@ -331,7 +331,7 @@ public void TestEditPresetName()
});

OsuPopover? popover = null;
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault()) != null);
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault())?.IsPresent == true);
AddStep("clear preset name", () => popover.ChildrenOfType<LabelledTextBox>().First().Current.Value = "");
AddStep("attempt preset edit", () =>
{
Expand Down Expand Up @@ -380,7 +380,7 @@ public void TestEditPresetMod()
});

OsuPopover? popover = null;
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault()) != null);
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault())?.IsPresent == true);
AddStep("click use current mods", () =>
{
InputManager.MoveMouseTo(popover.ChildrenOfType<ShearedButton>().ElementAt(0));
Expand Down Expand Up @@ -411,7 +411,7 @@ public void TestEditPresetMod()
InputManager.Click(MouseButton.Left);
});

AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault()) != null);
AddUntilStep("wait for popover", () => (popover = this.ChildrenOfType<OsuPopover>().FirstOrDefault())?.IsPresent == true);
AddStep("click use current mods", () =>
{
InputManager.MoveMouseTo(popover.ChildrenOfType<ShearedButton>().ElementAt(0));
Expand Down