mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 03:02:56 +08:00
Temporarily disable WorkingBeatmapCache
and fix multiple invalid data flows
This commit is contained in:
parent
0793b0f0ab
commit
33060990b7
@ -12,7 +12,6 @@ using osu.Framework.IO.Stores;
|
|||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Statistics;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -86,24 +85,12 @@ namespace osu.Game.Beatmaps
|
|||||||
if (beatmapInfo?.BeatmapSet == null)
|
if (beatmapInfo?.BeatmapSet == null)
|
||||||
return DefaultBeatmap;
|
return DefaultBeatmap;
|
||||||
|
|
||||||
lock (workingCache)
|
WorkingBeatmap working = null;
|
||||||
{
|
|
||||||
var working = workingCache.FirstOrDefault(w => beatmapInfo.Equals(w.BeatmapInfo));
|
|
||||||
|
|
||||||
if (working != null)
|
working = new BeatmapManagerWorkingBeatmap(beatmapInfo, this);
|
||||||
return working;
|
|
||||||
|
|
||||||
// TODO: is this still required..?
|
|
||||||
//beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;
|
|
||||||
|
|
||||||
workingCache.Add(working = new BeatmapManagerWorkingBeatmap(beatmapInfo, this));
|
|
||||||
|
|
||||||
// best effort; may be higher than expected.
|
|
||||||
GlobalStatistics.Get<int>(nameof(Beatmaps), $"Cached {nameof(WorkingBeatmap)}s").Value = workingCache.Count();
|
|
||||||
|
|
||||||
return working;
|
return working;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#region IResourceStorageProvider
|
#region IResourceStorageProvider
|
||||||
|
|
||||||
|
@ -71,33 +71,37 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RealmContextFactory realmFactory { get; set; }
|
private RealmContextFactory realmFactory { get; set; }
|
||||||
|
|
||||||
protected override void LoadComplete()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
beatmapSubscription = realmFactory.Context.All<BeatmapSetInfo>().QueryAsyncWithNotifications(beatmapsChanged);
|
|
||||||
|
|
||||||
// Todo: These binds really shouldn't be here, but are unlikely to cause any issues for now.
|
// Todo: These binds really shouldn't be here, but are unlikely to cause any issues for now.
|
||||||
// They are placed here for now since some tests rely on setting the beatmap _and_ their hierarchies inside their load(), which runs before the MusicController's load().
|
// They are placed here for now since some tests rely on setting the beatmap _and_ their hierarchies inside their load(), which runs before the MusicController's load().
|
||||||
beatmap.BindValueChanged(beatmapChanged, true);
|
beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// ensure we're ready before completing async load.
|
||||||
|
// probably not a good way of handling this (as there is a period we aren't watching for changes until the realm subscription finishes up.
|
||||||
|
foreach (var s in realmFactory.Context.All<BeatmapSetInfo>())
|
||||||
|
beatmapSets.Add(s);
|
||||||
|
|
||||||
|
beatmapSubscription = realmFactory.Context.All<BeatmapSetInfo>().QueryAsyncWithNotifications(beatmapsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
private void beatmapsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet changes, Exception error)
|
private void beatmapsChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet changes, Exception error)
|
||||||
{
|
{
|
||||||
if (changes == null)
|
if (changes == null)
|
||||||
{
|
return;
|
||||||
beatmapSets.AddRange(sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
// beatmaps.ItemUpdated += set => Schedule(() =>
|
foreach (int i in changes.InsertedIndices)
|
||||||
// {
|
beatmapSets.Insert(i, sender[i]);
|
||||||
// beatmapSets.Remove(set);
|
|
||||||
// beatmapSets.Add(set);
|
foreach (int i in changes.DeletedIndices.OrderByDescending(i => i))
|
||||||
// });
|
beatmapSets.RemoveAt(i);
|
||||||
// beatmaps.ItemRemoved += set => Schedule(() => beatmapSets.RemoveAll(s => s.ID == set.ID));
|
|
||||||
//
|
|
||||||
// beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal, true).OrderBy(_ => RNG.Next()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -81,8 +81,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
this.createNextScreen = createNextScreen;
|
this.createNextScreen = createNextScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game, RealmContextFactory realmContextFactory)
|
private void load(OsuConfigManager config, SkinManager skinManager, Framework.Game game, RealmContextFactory realmContextFactory)
|
||||||
{
|
{
|
||||||
// prevent user from changing beatmap while the intro is still running.
|
// prevent user from changing beatmap while the intro is still running.
|
||||||
beatmap = Beatmap.BeginLease(false);
|
beatmap = Beatmap.BeginLease(false);
|
||||||
@ -101,7 +104,13 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (sets.Count > 0)
|
if (sets.Count > 0)
|
||||||
{
|
{
|
||||||
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
|
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
|
||||||
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo?.PerformRead(s => s.Beatmaps[0].ToLive(realmContextFactory)));
|
setInfo?.PerformRead(s =>
|
||||||
|
{
|
||||||
|
if (s.Beatmaps.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
initialBeatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps[0].ToLive(realmContextFactory));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,12 +140,29 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (setInfo == null)
|
if (setInfo == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.PerformRead(s => s.Beatmaps[0].ToLive(realmContextFactory)));
|
setInfo.PerformRead(s =>
|
||||||
|
{
|
||||||
|
if (s.Beatmaps.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
initialBeatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps[0].ToLive(realmContextFactory));
|
||||||
|
});
|
||||||
|
|
||||||
return UsingThemedIntro = initialBeatmap != null;
|
return UsingThemedIntro = initialBeatmap != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
// TODO: This is temporary to get the setInfo on the update thread, to make things work "better" without using ILive everywhere.
|
||||||
|
var setInfo = beatmaps.QueryBeatmapSets(b => b.Hash == BeatmapHash).FirstOrDefault();
|
||||||
|
|
||||||
|
if (setInfo?.Value.Beatmaps.Count > 0)
|
||||||
|
initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Value.Beatmaps.First());
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
this.FadeIn(300);
|
this.FadeIn(300);
|
||||||
|
@ -126,17 +126,6 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
TopScore = null;
|
TopScore = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scoreStoreChanged(ScoreInfo score)
|
|
||||||
{
|
|
||||||
if (Scope != BeatmapLeaderboardScope.Local)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (BeatmapInfo?.ID != score.BeatmapInfoID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
RefreshScores();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
||||||
|
|
||||||
private CancellationTokenSource loadCancellationSource;
|
private CancellationTokenSource loadCancellationSource;
|
||||||
|
@ -12,8 +12,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
if (Beatmap.Value.TrackLoaded && Beatmap.Value.Track != null) // null check... wasn't required until now?
|
||||||
|
{
|
||||||
// note that this will override any mod rate application
|
// note that this will override any mod rate application
|
||||||
Beatmap.Value.Track.Tempo.Value = Clock.Rate;
|
Beatmap.Value.Track.Tempo.Value = Clock.Rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user