1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 11:47:18 +08:00

Merge pull request #1090 from tgi74/master

Fix replays crashing and not finding their associated beatmap
This commit is contained in:
Dean Herbert 2017-08-22 12:59:49 +09:00 committed by GitHub
commit 3254e16e9c
5 changed files with 16 additions and 4 deletions

View File

@ -49,9 +49,16 @@ namespace osu.Game.Beatmaps
public string Path { get; set; }
[JsonProperty("file_md5")]
[JsonProperty("file_sha2")]
public string Hash { get; set; }
/// <summary>
/// MD5 is kept for legacy support (matching against replays, osu-web-10 etc.).
/// </summary>
[Indexed]
[JsonProperty("file_md5")]
public string MD5Hash { get; set; }
// General
public int AudioLeadIn { get; set; }
public bool Countdown { get; set; }

View File

@ -372,6 +372,7 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.Path = name;
beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();
beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.Metadata = null;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps
/// The current version of this store. Used for migrations (see <see cref="PerformMigration(int, int)"/>).
/// The initial version is 1.
/// </summary>
protected override int StoreVersion => 2;
protected override int StoreVersion => 3;
public BeatmapStore(SQLiteConnection connection)
: base(connection)
@ -77,6 +77,10 @@ namespace osu.Game.Beatmaps
// cannot migrate; breaking underlying changes.
Reset();
break;
case 3:
// Added MD5Hash column to BeatmapInfo
Connection.MigrateTable<BeatmapInfo>();
break;
}
}
}

View File

@ -109,7 +109,7 @@ namespace osu.Game
dependencies.Cache(RulesetStore = new RulesetStore(connection));
dependencies.Cache(FileStore = new FileStore(connection, Host.Storage));
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, FileStore, connection, RulesetStore, Host));
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager));
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, connection, Host, BeatmapManager, RulesetStore));
dependencies.Cache(KeyBindingStore = new KeyBindingStore(connection, RulesetStore));
dependencies.Cache(new OsuColour());

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Scoring
var version = sr.ReadInt32();
/* score.FileChecksum = */
var beatmapHash = sr.ReadString();
score.Beatmap = beatmaps.QueryBeatmap(b => b.Hash == beatmapHash);
score.Beatmap = beatmaps.QueryBeatmap(b => b.MD5Hash == beatmapHash);
/* score.PlayerName = */
sr.ReadString();
/* var localScoreChecksum = */