From defed955ea788a7ea11afae3cc2c412b39c3319f Mon Sep 17 00:00:00 2001 From: Piotrekol Date: Thu, 7 Nov 2019 09:19:14 +0100 Subject: [PATCH] Fix: loading of osu!.db after newest osu! update --- .../Modules/FileIO/OsuDb/OsuDatabaseReader.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CollectionManagerDll/Modules/FileIO/OsuDb/OsuDatabaseReader.cs b/CollectionManagerDll/Modules/FileIO/OsuDb/OsuDatabaseReader.cs index 07feb09..2d9431f 100644 --- a/CollectionManagerDll/Modules/FileIO/OsuDb/OsuDatabaseReader.cs +++ b/CollectionManagerDll/Modules/FileIO/OsuDb/OsuDatabaseReader.cs @@ -107,12 +107,12 @@ private void ReadMapMetaData(Beatmap beatmap) beatmap.DisableSkin = _binaryReader.ReadBoolean(); beatmap.DisableSb = _binaryReader.ReadBoolean(); _binaryReader.ReadBoolean(); - beatmap.BgDim = _binaryReader.ReadInt16(); + _binaryReader.ReadBoolean(); + if(FileDate < 20140609) + beatmap.BgDim = (short)_binaryReader.ReadInt16(); //bytes not analysed. - if (FileDate <= 20160403) - _binaryReader.BaseStream.Seek(4, SeekOrigin.Current); - else - _binaryReader.BaseStream.Seek(8, SeekOrigin.Current); + _binaryReader.ReadInt32(); + _binaryReader.ReadByte(); } private class TimingPoint @@ -373,8 +373,7 @@ private bool DatabaseContainsData() _binaryReader.BaseStream.Seek(1, SeekOrigin.Current); Username = _binaryReader.ReadString(); ExpectedNumOfBeatmaps = _binaryReader.ReadInt32(); - if (FileDate > 20160403) - _binaryReader.BaseStream.Seek(4, SeekOrigin.Current); + _logger?.Log(string.Format("Expected number of beatmaps: {0}", ExpectedNumOfBeatmaps)); if (ExpectedNumOfBeatmaps < 0)