mirror of
https://github.com/ppy/osu
synced 2025-03-20 01:49:41 +00:00
Merge branch 'master' into leaderboard-toggle
This commit is contained in:
commit
a0543d97bd
@ -10,7 +10,7 @@
|
|||||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.801.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.812.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Desktop.LegacyIpc
|
|||||||
case LegacyIpcDifficultyCalculationRequest req:
|
case LegacyIpcDifficultyCalculationRequest req:
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WorkingBeatmap beatmap = new FlatFileWorkingBeatmap(req.BeatmapFile);
|
WorkingBeatmap beatmap = new FlatWorkingBeatmap(req.BeatmapFile);
|
||||||
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
var ruleset = beatmap.BeatmapInfo.Ruleset.CreateInstance();
|
||||||
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
Mod[] mods = ruleset.ConvertFromLegacyMods((LegacyMods)req.Mods).ToArray();
|
||||||
|
|
||||||
|
@ -12,25 +12,26 @@ using osu.Game.Skinning;
|
|||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="WorkingBeatmap"/> which can be constructed directly from a .osu file, providing an implementation for
|
/// A <see cref="WorkingBeatmap"/> which can be constructed directly from an .osu file (via <see cref="FlatWorkingBeatmap(string, int?)"/>)
|
||||||
|
/// or an <see cref="IBeatmap"/> instance (via <see cref="FlatWorkingBeatmap(IBeatmap)"/>,
|
||||||
|
/// providing an implementation for
|
||||||
/// <see cref="WorkingBeatmap.GetPlayableBeatmap(osu.Game.Rulesets.IRulesetInfo,System.Collections.Generic.IReadOnlyList{osu.Game.Rulesets.Mods.Mod})"/>.
|
/// <see cref="WorkingBeatmap.GetPlayableBeatmap(osu.Game.Rulesets.IRulesetInfo,System.Collections.Generic.IReadOnlyList{osu.Game.Rulesets.Mods.Mod})"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FlatFileWorkingBeatmap : WorkingBeatmap
|
public class FlatWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
private readonly Beatmap beatmap;
|
private readonly IBeatmap beatmap;
|
||||||
|
|
||||||
public FlatFileWorkingBeatmap(string file, int? beatmapId = null)
|
public FlatWorkingBeatmap(string file, int? beatmapId = null)
|
||||||
: this(readFromFile(file), beatmapId)
|
: this(readFromFile(file))
|
||||||
{
|
{
|
||||||
|
if (beatmapId.HasValue)
|
||||||
|
beatmap.BeatmapInfo.OnlineID = beatmapId.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private FlatFileWorkingBeatmap(Beatmap beatmap, int? beatmapId = null)
|
public FlatWorkingBeatmap(IBeatmap beatmap)
|
||||||
: base(beatmap.BeatmapInfo, null)
|
: base(beatmap.BeatmapInfo, null)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
if (beatmapId.HasValue)
|
|
||||||
beatmap.BeatmapInfo.OnlineID = beatmapId.Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Beatmap readFromFile(string filename)
|
private static Beatmap readFromFile(string filename)
|
@ -29,9 +29,9 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
protected override Stream? GetFileContents(BeatmapSetInfo model, INamedFileUsage file)
|
protected override Stream? GetFileContents(BeatmapSetInfo model, INamedFileUsage file)
|
||||||
{
|
{
|
||||||
bool isBeatmap = model.Beatmaps.Any(o => o.Hash == file.File.Hash);
|
var beatmapInfo = model.Beatmaps.SingleOrDefault(o => o.Hash == file.File.Hash);
|
||||||
|
|
||||||
if (!isBeatmap)
|
if (beatmapInfo == null)
|
||||||
return base.GetFileContents(model, file);
|
return base.GetFileContents(model, file);
|
||||||
|
|
||||||
// Read the beatmap contents and skin
|
// Read the beatmap contents and skin
|
||||||
@ -43,6 +43,9 @@ namespace osu.Game.Database
|
|||||||
using var contentStreamReader = new LineBufferedReader(contentStream);
|
using var contentStreamReader = new LineBufferedReader(contentStream);
|
||||||
var beatmapContent = new LegacyBeatmapDecoder().Decode(contentStreamReader);
|
var beatmapContent = new LegacyBeatmapDecoder().Decode(contentStreamReader);
|
||||||
|
|
||||||
|
var workingBeatmap = new FlatWorkingBeatmap(beatmapContent);
|
||||||
|
var playableBeatmap = workingBeatmap.GetPlayableBeatmap(beatmapInfo.Ruleset);
|
||||||
|
|
||||||
using var skinStream = base.GetFileContents(model, file);
|
using var skinStream = base.GetFileContents(model, file);
|
||||||
|
|
||||||
if (skinStream == null)
|
if (skinStream == null)
|
||||||
@ -56,10 +59,10 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
// Convert beatmap elements to be compatible with legacy format
|
// Convert beatmap elements to be compatible with legacy format
|
||||||
// So we truncate time and position values to integers, and convert paths with multiple segments to bezier curves
|
// So we truncate time and position values to integers, and convert paths with multiple segments to bezier curves
|
||||||
foreach (var controlPoint in beatmapContent.ControlPointInfo.AllControlPoints)
|
foreach (var controlPoint in playableBeatmap.ControlPointInfo.AllControlPoints)
|
||||||
controlPoint.Time = Math.Floor(controlPoint.Time);
|
controlPoint.Time = Math.Floor(controlPoint.Time);
|
||||||
|
|
||||||
foreach (var hitObject in beatmapContent.HitObjects)
|
foreach (var hitObject in playableBeatmap.HitObjects)
|
||||||
{
|
{
|
||||||
// Truncate end time before truncating start time because end time is dependent on start time
|
// Truncate end time before truncating start time because end time is dependent on start time
|
||||||
if (hitObject is IHasDuration hasDuration && hitObject is not IHasPath)
|
if (hitObject is IHasDuration hasDuration && hitObject is not IHasPath)
|
||||||
@ -86,7 +89,7 @@ namespace osu.Game.Database
|
|||||||
// Encode to legacy format
|
// Encode to legacy format
|
||||||
var stream = new MemoryStream();
|
var stream = new MemoryStream();
|
||||||
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
|
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
|
||||||
new LegacyBeatmapEncoder(beatmapContent, beatmapSkin).Encode(sw);
|
new LegacyBeatmapEncoder(playableBeatmap, beatmapSkin).Encode(sw);
|
||||||
|
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.1.2" />
|
<PackageReference Include="Realm" Version="11.1.2" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2023.801.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2023.812.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.719.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.719.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.28.1" />
|
<PackageReference Include="Sentry" Version="3.28.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.801.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.812.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user