Skip to content

Commit 8275bd1

Browse files
authored
Merge pull request #560 from LumpBloom7/fix-input-crash
Fix receptor input causing a crash
2 parents dc1d6c2 + 78b22d8 commit 8275bd1

File tree

4 files changed

+13
-29
lines changed

4 files changed

+13
-29
lines changed

osu.Game.Rulesets.Sentakki/Mods/SentakkiModRelax.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class SentakkiModRelax : Mod, IApplicableAfterBeatmapConversion
1616
public override string Name => "Relax";
1717

1818
public override string Acronym => "RX";
19+
public override ModType Type => ModType.DifficultyReduction;
1920

2021
public override LocalisableString Description => "All notes are EX notes, you've got nothing to prove!";
2122

osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableHold.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ public void OnReleased(KeyBindingReleaseEvent<SentakkiAction> e)
250250
return;
251251

252252
// We only release the hold once ALL inputs are released
253-
if (--pressedCount == 0)
254-
endHold();
253+
if (--pressedCount != 0)
254+
return;
255+
256+
endHold();
255257

256258
if (!AllJudged)
257259
NoteBody.FadeColour(Color4.Gray, 100);

osu.Game.Rulesets.Sentakki/SentakkiInputManager.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System.Collections.Generic;
2-
using osu.Framework.Extensions.ListExtensions;
3-
using osu.Framework.Graphics;
41
using osu.Framework.Input.Bindings;
52
using osu.Framework.Input.Events;
6-
using osu.Framework.Input.States;
73
using osu.Framework.Lists;
84
using osu.Framework.Localisation;
95
using osu.Game.Rulesets.Sentakki.Localisation;
@@ -38,27 +34,6 @@ protected override bool Handle(UIEvent e)
3834

3935
return base.Handle(e);
4036
}
41-
42-
// We want the press behavior of SimultaneousBindingMode.All, but we want the release behavior of SimultaneousBindingMode.Unique
43-
// As long as there are more than one input source triggering the action, we manually remove the action from the list once, without propogating the release
44-
// When the final source is released, we let the original handling take over, which would also propogate the release event
45-
// This is so that multiple sources (virtual input/key) can trigger a press, but not release until the last key is released
46-
protected override void PropagateReleased(IEnumerable<Drawable> drawables, InputState state, SentakkiAction released)
47-
{
48-
int actionCount = 0;
49-
var pressed = PressedActions;
50-
51-
for (int i = 0; i < pressed.Count; ++i)
52-
{
53-
if (pressed[i] == released && ++actionCount > 1)
54-
break;
55-
}
56-
57-
if (actionCount > 1)
58-
pressed.Remove(released);
59-
else
60-
base.PropagateReleased(drawables, state, released);
61-
}
6237
}
6338

6439
public SlimReadOnlyListWrapper<SentakkiAction> PressedActions => KeyBindingContainer.PressedActions;

osu.Game.Rulesets.Sentakki/UI/Lane.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,16 @@ private void updateInputState()
131131
private void handleKeyPress(ValueChangedEvent<int> keys)
132132
{
133133
if (keys.NewValue < keys.OldValue)
134-
SentakkiActionInputManager.TriggerReleased(SentakkiAction.Key1 + LaneNumber);
134+
for (int i = 0; i < keys.OldValue - keys.NewValue; ++i)
135+
{
136+
SentakkiActionInputManager.TriggerReleased(SentakkiAction.Key1 + LaneNumber);
137+
}
135138

136139
if (keys.NewValue > keys.OldValue)
137-
SentakkiActionInputManager.TriggerPressed(SentakkiAction.Key1 + LaneNumber);
140+
for (int i = 0; i < keys.NewValue - keys.OldValue; ++i)
141+
{
142+
SentakkiActionInputManager.TriggerPressed(SentakkiAction.Key1 + LaneNumber);
143+
}
138144
}
139145

140146
public bool OnPressed(KeyBindingPressEvent<SentakkiAction> e)

0 commit comments

Comments
 (0)