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
54 changes: 54 additions & 0 deletions optimize_slider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import re

file_path = 'osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs'

with open(file_path, 'r') as f:
content = f.read()

# Replace anyHit logic
old_any_hit = """ bool anyHit = false;

for (int i = 0; i < hitObject.NestedHitObjects.Count; i++)
{
if (hitObject.NestedHitObjects[i].Result.IsHit)
{
anyHit = true;
break;
}
}"""

new_any_hit = """ bool anyHit = false;

foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.Result.IsHit)
{
anyHit = true;
break;
}
}"""

# Wait, the code already uses a for loop in CheckForResult for anyHit.
# Let's check the other one: hitTicks calculation.

old_hit_ticks = """ int totalTicks = hitObject.NestedHitObjects.Count;
int hitTicks = 0;

for (int i = 0; i < totalTicks; i++)
{
if (hitObject.NestedHitObjects[i].IsHit)
hitTicks++;
}"""

new_hit_ticks = """ int hitTicks = 0;

foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.IsHit)
hitTicks++;
}"""

content = content.replace(old_hit_ticks, new_hit_ticks)

with open(file_path, 'w') as f:
f.write(content)
34 changes: 34 additions & 0 deletions optimize_slider_v2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import re

file_path = 'osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs'

with open(file_path, 'r') as f:
content = f.read()

# Replace anyHit logic
old_any_hit = """ bool anyHit = false;

for (int i = 0; i < hitObject.NestedHitObjects.Count; i++)
{
if (hitObject.NestedHitObjects[i].Result.IsHit)
{
anyHit = true;
break;
}
}"""

new_any_hit = """ bool anyHit = false;

foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.Result.IsHit)
{
anyHit = true;
break;
}
}"""

content = content.replace(old_any_hit, new_any_hit)

with open(file_path, 'w') as f:
f.write(content)
33 changes: 33 additions & 0 deletions optimize_slider_v3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import re

file_path = 'osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs'

with open(file_path, 'r') as f:
content = f.read()

# Fix totalTicks to be after nested hit object count check or just use count
old_ticks_logic = """ int hitTicks = 0;

foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.IsHit)
hitTicks++;
}

if (hitTicks == totalTicks)"""

new_ticks_logic = """ int totalTicks = hitObject.NestedHitObjects.Count;
int hitTicks = 0;

foreach (var nested in hitObject.NestedHitObjects)
{
if (nested.IsHit)
hitTicks++;
}

if (hitTicks == totalTicks)"""

content = content.replace(old_ticks_logic, new_ticks_logic)

with open(file_path, 'w') as f:
f.write(content)
3 changes: 1 addition & 2 deletions osu.Android/OsuGameAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public OsuGameAndroid(OsuGameActivity activity)
: base(null)
{
gameActivity = activity;
startVulkanProbe();
}

public override string Version
Expand Down Expand Up @@ -144,8 +145,6 @@ private void load()
LocalConfig.BindWith(OsuSetting.AndroidVulkanProbe, vulkanProbeEnabled);
LocalConfig.BindWith(OsuSetting.AudioOffset, audioOffset);

// Start Vulkan probe as early as possible so it's ready for RendererSettings.
if (vulkanProbeEnabled.Value)
startVulkanProbe();

audioRedirector = new OboeAudioRedirector(Audio);
Expand Down
8 changes: 4 additions & 4 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
int totalTicks = hitObject.NestedHitObjects.Count;
int hitTicks = 0;

for (int i = 0; i < totalTicks; i++)
foreach (var nested in hitObject.NestedHitObjects)
{
if (hitObject.NestedHitObjects[i].IsHit)
if (nested.IsHit)
hitTicks++;
}

Expand All @@ -330,9 +330,9 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
{
bool anyHit = false;

for (int i = 0; i < hitObject.NestedHitObjects.Count; i++)
foreach (var nested in hitObject.NestedHitObjects)
{
if (hitObject.NestedHitObjects[i].Result.IsHit)
if (nested.Result.IsHit)
{
anyHit = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Skinning/SnakingSliderBody.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
if (lastUpdateTime > 0 && Clock.CurrentTime - lastUpdateTime < 16)
{
double delta = Math.Max(Math.Abs(p0 - (SnakedStart ?? 0)), Math.Abs(p1 - (SnakedEnd ?? 0)));
if (delta < 0.005) return;
if (delta < 0.0001) return;
}
lastUpdateTime = Clock.CurrentTime;
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ public virtual void StopAllSamples()

protected override void Update()
{
if (RuntimeInfo.OS == RuntimeInfo.Platform.Android && (Time.Current < LifetimeStart - 1000 || Time.Current > LifetimeEnd))
if (RuntimeInfo.OS == RuntimeInfo.Platform.Android && (Time.Current < LifetimeStart - 5000 || Time.Current > LifetimeEnd))
return;

// We use a flag here to load samples only when they are required to be played.
Expand Down
16 changes: 16 additions & 0 deletions vulkan_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<<<<<<< SEARCH
public OsuGameAndroid(OsuGameActivity activity)
: base(null)
{
gameActivity = activity;
}
=======
public OsuGameAndroid(OsuGameActivity activity)
: base(null)
{
gameActivity = activity;

// Start Vulkan probe as early as possible so it's ready for SetHost.
startVulkanProbe();
}
>>>>>>> REPLACE
Loading