Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MapWizard.CLI/MapWizard.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MapWizard.BeatmapParser" Version="1.0.5" />
<PackageReference Include="MapWizard.BeatmapParser" Version="1.0.6" />
</ItemGroup>

<PropertyGroup>
Expand Down
18 changes: 6 additions & 12 deletions MapWizard.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,9 @@ static void Main(string[] args)
var options = new MapCleanerOptions
{
SnapDivisors = ParseCsv(snapsRaw),
AnalyzeSamples = !args.ArgumentExists("--skip-analysis"),
ResnapObjects = !args.ArgumentExists("--no-resnap-objects"),
ResnapSliderEnds = !args.ArgumentExists("--no-resnap-slider-ends"),
ResnapGreenLines = !args.ArgumentExists("--no-resnap-greenlines"),
ResnapBookmarks = args.ArgumentExists("--resnap-bookmarks"),
RemoveUnusedInheritedTimingPoints = !args.ArgumentExists("--keep-inherited"),
RemoveHitSounds = args.ArgumentExists("--remove-hitsounds"),
RemoveUnusedSamples = args.ArgumentExists("--remove-unused-samples"),
ResnapEverything = !args.ArgumentExists("--no-resnap"),
RemoveMuting = args.ArgumentExists("--remove-muting"),
MuteUnclickableHitsounds = args.ArgumentExists("--mute-unclickable-hitsounds")
RemoveUnusedGreenlines = args.ArgumentExists("--remove-unused-greenlines")
};

RunMapCleaner(targetPaths, options);
Expand All @@ -106,9 +99,10 @@ private static void RunMapCleaner(string[] targetPaths, MapCleanerOptions option
{
Console.WriteLine(
$"Map cleaner finished. Cleaned {result.ProcessedBeatmaps} beatmap(s): " +
$"{result.ObjectsResnapped} objects resnapped, " +
$"{result.GreenLinesResnapped} greenlines resnapped, " +
$"{result.InheritedTimingPointsRemoved} greenlines removed.");
$"{result.TimingPointsResnapped} timing points resnapped, " +
$"{result.ObjectsResnapped} object starts resnapped, " +
$"{result.SliderEndsResnapped} slider ends resnapped, " +
$"{result.GreenLinesRemoved} greenlines removed.");
return;
}

Expand Down
12 changes: 6 additions & 6 deletions MapWizard.Desktop/MapWizard.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.12" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.12" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.9" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="DialogHost.Avalonia" Version="0.10.4" />
<PackageReference Include="JAJ.Packages.MiniAudioEx" Version="3.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
<PackageReference Include="DialogHost.Avalonia" Version="0.11.0" />
<PackageReference Include="JAJ.Packages.MiniAudioEx" Version="3.2.1" />
<PackageReference Include="ManagedBass" Version="4.0.2" />
<PackageReference Include="MapWizard.BeatmapParser" Version="1.0.5" />
<PackageReference Include="MapWizard.BeatmapParser" Version="1.0.6" />
<PackageReference Include="Material.Icons.Avalonia" Version="3.0.0" />
<PackageReference Include="MessageBox.Avalonia" Version="3.3.1.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3" />
<PackageReference Include="OsuMemoryDataProvider" Version="0.11.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
<PackageReference Include="OsuMemoryDataProvider" Version="0.12.0" />
<PackageReference Include="OsuWineMemReader" Version="1.0.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.2" />
<PackageReference Include="SukiUI" Version="6.0.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ namespace MapWizard.Desktop.Services.MapCleanerService;

public interface IMapCleanerService
{
public bool TryAnalyzeMap(string beatmapPath, out MapCleanerAnalysis analysis);
public bool CleanMaps(string[] targetPaths, MapCleanerOptions options, out MapCleanerBatchResult result);
}
25 changes: 0 additions & 25 deletions MapWizard.Desktop/Services/MapCleanerService/MapCleanerService.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
using System;
using System.IO;
using BeatmapParser;
using MapWizard.Tools.MapCleaner;

namespace MapWizard.Desktop.Services.MapCleanerService;

public class MapCleanerService : IMapCleanerService
{
public bool TryAnalyzeMap(string beatmapPath, out MapCleanerAnalysis analysis)
{
analysis = new MapCleanerAnalysis();

try
{
if (string.IsNullOrWhiteSpace(beatmapPath) || !File.Exists(beatmapPath))
{
return false;
}

var beatmap = Beatmap.Decode(File.ReadAllText(beatmapPath));
analysis = MapCleaner.AnalyzeBeatmap(beatmap);
return true;
}
catch (Exception ex)
{
MapWizard.Tools.HelperExtensions.MapWizardLogger.LogException(ex);
Console.WriteLine(ex.Message);
return false;
}
}

public bool CleanMaps(string[] targetPaths, MapCleanerOptions options, out MapCleanerBatchResult result)
{
result = new MapCleanerBatchResult();
Expand Down
24 changes: 5 additions & 19 deletions MapWizard.Desktop/ViewModels/MapCleanerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,9 @@ public partial class MapCleanerViewModel(
{
[ObservableProperty] private SelectedMap _originBeatmap = new();

[ObservableProperty] private bool _analyzeSamples = true;
[ObservableProperty] private bool _resnapObjects = true;
[ObservableProperty] private bool _resnapSliderEnds = true;
[ObservableProperty] private bool _resnapGreenLines = true;
[ObservableProperty] private bool _resnapBookmarks;
[ObservableProperty] private bool _removeHitSounds;
[ObservableProperty] private bool _removeUnusedSamples;
[ObservableProperty] private bool _resnapEverything = true;
[ObservableProperty] private bool _removeMuting;
[ObservableProperty] private bool _muteUnclickableHitsounds;
[ObservableProperty] private bool _removeUnusedInheritedTimingPoints = true;
[ObservableProperty] private bool _removeUnusedGreenlines;

[ObservableProperty] private string _customSnapInput = string.Empty;

Expand Down Expand Up @@ -224,16 +217,9 @@ private void CleanMaps()

var options = new MapCleanerOptions
{
AnalyzeSamples = AnalyzeSamples,
ResnapObjects = ResnapObjects,
ResnapSliderEnds = ResnapSliderEnds,
ResnapGreenLines = ResnapGreenLines,
ResnapBookmarks = ResnapBookmarks,
RemoveUnusedInheritedTimingPoints = RemoveUnusedInheritedTimingPoints,
RemoveHitSounds = RemoveHitSounds,
RemoveUnusedSamples = RemoveUnusedSamples,
ResnapEverything = ResnapEverything,
RemoveMuting = RemoveMuting,
MuteUnclickableHitsounds = MuteUnclickableHitsounds,
RemoveUnusedGreenlines = RemoveUnusedGreenlines,
SnapDivisors = ActiveSnapDivisors.ToList()
};

Expand All @@ -244,7 +230,7 @@ private void CleanMaps()
toastManager.ShowToast(
NotificationType.Success,
"Map Cleaner",
$"Done. Resnapped {result.ObjectsResnapped} objects, {result.SliderEndsResnapped} slider ends, and {result.GreenLinesResnapped} greenlines; removed {result.InheritedTimingPointsRemoved} greenlines.");
$"Done. Resnapped {result.TimingPointsResnapped} timing points, {result.ObjectsResnapped} object starts, {result.SliderEndsResnapped} slider ends, {result.BookmarksResnapped} bookmarks, and {result.PreviewTimeResnapped} preview points; removed {result.GreenLinesRemoved} greenlines.");

LoadOriginBeatmapHeader();
return;
Expand Down
36 changes: 4 additions & 32 deletions MapWizard.Desktop/Views/MapCleaner/MapCleanerView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,44 +181,16 @@
<Separator />

<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Analyze samples" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding AnalyzeSamples}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Resnap objects" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding ResnapObjects}" />
</Grid>
<Grid ColumnDefinitions="*,Auto" IsVisible="{Binding ResnapObjects}">
<TextBlock Text="Resnap slider ends (recalculate length)" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding ResnapSliderEnds}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Resnap greenlines" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding ResnapGreenLines}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Resnap bookmarks" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding ResnapBookmarks}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Remove hitsounds" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding RemoveHitSounds}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Remove unused samples" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding RemoveUnusedSamples}" />
<TextBlock Text="Resnap everything" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding ResnapEverything}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Remove muting" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding RemoveMuting}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Mute unclickable hitsounds" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding MuteUnclickableHitsounds}" />
</Grid>
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Remove unused inherited timing points" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding RemoveUnusedInheritedTimingPoints}" />
<TextBlock Text="Remove unused greenlines" />
<ToggleSwitch Grid.Column="1" IsChecked="{Binding RemoveUnusedGreenlines}" />
</Grid>
</StackPanel>
</suki:GlassCard>
Expand Down
Loading
Loading