mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add bare minimum sanity checking of beatmap input values to make broken maps load
Resolves ppy/osu#1988.
This commit is contained in:
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -120,14 +119,16 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
private void createTicks()
|
private void createTicks()
|
||||||
{
|
{
|
||||||
if (TickDistance == 0) return;
|
|
||||||
|
|
||||||
var length = Curve.Distance;
|
var length = Curve.Distance;
|
||||||
var tickDistance = Math.Min(TickDistance, length);
|
var tickDistance = MathHelper.Clamp(TickDistance, 0, length);
|
||||||
|
|
||||||
|
if (tickDistance == 0) return;
|
||||||
|
|
||||||
var minDistanceFromEnd = Velocity * 0.01;
|
var minDistanceFromEnd = Velocity * 0.01;
|
||||||
|
|
||||||
for (var span = 0; span < this.SpanCount(); span++)
|
var spanCount = this.SpanCount();
|
||||||
|
|
||||||
|
for (var span = 0; span < spanCount; span++)
|
||||||
{
|
{
|
||||||
var spanStartTime = StartTime + span * SpanDuration;
|
var spanStartTime = StartTime + span * SpanDuration;
|
||||||
var reversed = span % 2 == 1;
|
var reversed = span % 2 == 1;
|
||||||
|
@ -8,6 +8,7 @@ using OpenTK.Graphics;
|
|||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
@ -319,7 +320,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint
|
beatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint
|
||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
BeatLength = beatLength,
|
BeatLength = MathHelper.Clamp(beatLength, 100, 60000),
|
||||||
TimeSignature = timeSignature
|
TimeSignature = timeSignature
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -29,7 +30,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
|||||||
Position = position,
|
Position = position,
|
||||||
NewCombo = newCombo,
|
NewCombo = newCombo,
|
||||||
ControlPoints = controlPoints,
|
ControlPoints = controlPoints,
|
||||||
Distance = length,
|
Distance = Math.Max(0, length),
|
||||||
CurveType = curveType,
|
CurveType = curveType,
|
||||||
RepeatSamples = repeatSamples,
|
RepeatSamples = repeatSamples,
|
||||||
RepeatCount = repeatCount
|
RepeatCount = repeatCount
|
||||||
|
Reference in New Issue
Block a user