Skip to content

Commit 5004440

Browse files
committed
V2.3.0 Newly added tool that enables creating new maps directly in-game via hotkey
1 parent a25cfc8 commit 5004440

21 files changed

+1161
-32
lines changed

MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:krrTools"
77
mc:Ignorable="d"
8-
Title="krrcream's Toolkit V2.2.1" Height="400" Width="300"
8+
Title="krrcream's Toolkit V2.3.0" Height="400" Width="300"
99
ResizeMode="NoResize"
1010
WindowStartupLocation="CenterScreen">
1111

img/LI.png

2.55 MB
Loading

krrTools.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
<ItemGroup>
1717
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.0" />
18+
<PackageReference Include="OsuMemoryDataProvider" Version="0.11.1" />
1819
<PackageReference Include="zzzzv.OsuParsers" Version="1.7.2" />
1920
</ItemGroup>
2021

readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
<b>A collection of tools for osumania beatmap</b>
66
</p>
77

8+
<p align="center">
9+
These tools allows creating new maps by either dragging batch files into the window or pressing hotkeys directly in-game.
10+
</p>
11+
12+
13+
814
## 📥 Download
915

1016
- [GitHub Release Page](https://github.com/krrcream/krrcream-Toolkit/releases) 🚀 *(Recommended)*
@@ -34,6 +40,7 @@ Automatically rates beatmaps based on KRR LV.
3440
## 📸 Screenshots
3541

3642
### krr AnyKeys Converter / YLS LN Transformer / DP Tool
43+
![img_LI.png](img/LI.png)
3744
![img_1.png](img/1.png)
3845
![img_S.png](img/S.png)
3946
### .osu File Manager

tools/DPtool/DP.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class DP
2323
/// 处理.osu文件的DP操作
2424
/// </summary>
2525
/// <param name="filePath">需要处理的.osu文件路径</param>
26-
public void ProcessFile(string filePath)
26+
public string ProcessFile(string filePath)
2727
{
2828
// 检查文件是否存在
2929
if (!File.Exists(filePath))
@@ -53,28 +53,34 @@ public void ProcessFile(string filePath)
5353
OPorg.TargetKeys = Options.SingleSideKeyCount;
5454
OPorg.TransformSpeed = 4;
5555
Conv.options = OPorg;
56+
var ANA = new OsuAnalyzer();
57+
double BPM = double.Parse(ANA.GetBPM(beatmap).Split('(')[0]);
58+
double beatLength = 60000 / BPM * 4;
59+
double convertTime = Math.Max(1, OPorg.TransformSpeed * beatLength - 10);
60+
var (matrix, timeAxis) = Conv.BuildMatrix(beatmap);
5661

5762
if (Options.ModifySingleSideKeyCount && Options.SingleSideKeyCount > beatmap.DifficultySection.CircleSize)
5863
{
5964

6065
int targetKeys = Options.SingleSideKeyCount;
61-
var ANA = new OsuAnalyzer();
62-
double BPM = double.Parse(ANA.GetBPM(beatmap).Split('(')[0]);
63-
double beatLength = 60000 / BPM * 4;
6466
// 变换时间
65-
double convertTime = Math.Max(1, OPorg.TransformSpeed * beatLength - 10);
6667

67-
68-
69-
var (matrix, timeAxis) = Conv.BuildMatrix(beatmap);
7068
var (oldMTX, insertMTX) = Conv.convertMTX(targetKeys-CS, timeAxis, convertTime, CS, random);
7169
int[,] newMatrix = Conv.convert(matrix, oldMTX, insertMTX, timeAxis, targetKeys,beatLength,random);
7270
orgMTX = newMatrix;
7371
}
72+
else if (Options.ModifySingleSideKeyCount &&
73+
Options.SingleSideKeyCount < beatmap.DifficultySection.CircleSize)
74+
{
75+
int targetKeys = Options.SingleSideKeyCount;
76+
var newMatrix = Conv.SmartReduceColumns(matrix, timeAxis, CS - targetKeys, convertTime,beatLength);
77+
orgMTX = newMatrix;
78+
}
7479
else
7580
{
76-
(orgMTX,var timeAxis) = Conv.BuildMatrix(beatmap);
81+
(orgMTX,timeAxis) = Conv.BuildMatrix(beatmap);
7782
}
83+
7884
//克隆两个矩阵分别叫做orgL和orgR
7985
int[,] orgL = (int[,])orgMTX.Clone();
8086
int[,] orgR = (int[,])orgMTX.Clone();
@@ -105,10 +111,10 @@ public void ProcessFile(string filePath)
105111
int[,] result = ConcatenateMatrices(orgL, orgR);
106112
// 合成新HitObjects
107113
newHitObjects(beatmap, result);
108-
BeatmapSave();
114+
return BeatmapSave();
109115

110116

111-
void BeatmapSave()
117+
string BeatmapSave()
112118
{
113119

114120
beatmap.MetadataSection.Creator = "Krr DP. & " + beatmap.MetadataSection.Creator;
@@ -139,6 +145,7 @@ void BeatmapSave()
139145

140146
beatmap.Save(fullPath);
141147
beatmap = null;
148+
return fullPath;
142149
}
143150

144151
}

tools/DPtool/DPToolViewModel.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Collections.Generic;
44
using System.IO;
55
using System.Threading.Tasks;
6+
using System.Windows;
7+
using krrTools.tools.Listener;
68

79
namespace krrTools.tools.DPtool
810
{
@@ -46,5 +48,14 @@ public DPToolOptions Options
4648
get => _options;
4749
set => SetProperty(ref _options, value);
4850
}
51+
52+
/// <summary>
53+
/// 打开osu!监听器窗口
54+
/// </summary>
55+
public void OpenOsuListener()
56+
{
57+
var listenerWindow = new ListenerView();
58+
listenerWindow.Show();
59+
}
4960
}
5061
}

tools/DPtool/DPToolWindow.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Window x:Class="krrTools.tools.DPtool.DPToolWindow"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Title="DP TOOL" Height="400" Width="500"
4+
Title="DP TOOL" Height="450" Width="500"
55
WindowStartupLocation="CenterScreen"
66
ResizeMode="NoResize">
77
<Window.Resources>
@@ -210,6 +210,10 @@
210210
FontSize="16"
211211
HorizontalAlignment="Center"/>
212212
</StackPanel>
213+
<!-- OSU Listener按钮 -->
214+
<Button Content="OSU Listener"
215+
Click="OpenOsuListenerButton_Click" Style="{StaticResource LightGrayButtonStyle}"
216+
Margin="0,0,0,10"/>
213217
</StackPanel>
214218
</Border>
215219
</Grid>

tools/DPtool/DPToolWindow.xaml.cs

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using System.Threading.Tasks;
66
using System.Windows;
77
using System.Windows.Controls;
8+
using krrTools.tools.Listener;
9+
using krrTools.Tools.OsuParser;
810

911
namespace krrTools.tools.DPtool
1012
{
@@ -22,6 +24,60 @@ public DPToolWindow()
2224
SetupBindings();
2325
}
2426

27+
// 添加处理单个文件的方法
28+
public void ProcessSingleFile(string filePath)
29+
{
30+
try
31+
{
32+
// 检查文件是否存在
33+
if (!File.Exists(filePath))
34+
{
35+
MessageBox.Show($"File not found: {filePath}", "File Not Found",
36+
MessageBoxButton.OK, MessageBoxImage.Warning);
37+
return;
38+
}
39+
40+
// 检查文件扩展名是否为.osu
41+
if (Path.GetExtension(filePath).ToLower() != ".osu")
42+
{
43+
MessageBox.Show("Selected file is not a valid .osu file", "Invalid File",
44+
MessageBoxButton.OK, MessageBoxImage.Warning);
45+
return;
46+
}
47+
48+
// 显示进度条
49+
_viewModel.IsProcessing = true;
50+
_viewModel.ProgressValue = 0;
51+
_viewModel.ProgressMaximum = 1;
52+
_viewModel.ProgressText = "Processing file...";
53+
54+
var dp = new DP();
55+
DP.Options = _viewModel.Options;
56+
string newFilepath = dp.ProcessFile(filePath);
57+
OsuAnalyzer.AddNewBeatmapToSongFolder(newFilepath);
58+
59+
// 处理完成后隐藏进度条
60+
_viewModel.IsProcessing = false;
61+
62+
MessageBox.Show("File processed successfully!", "Success",
63+
MessageBoxButton.OK, MessageBoxImage.Information);
64+
}
65+
catch (Exception ex)
66+
{
67+
// 处理完成后隐藏进度条
68+
_viewModel.IsProcessing = false;
69+
70+
MessageBox.Show($"Error processing file: {ex.Message}", "Processing Error",
71+
MessageBoxButton.OK, MessageBoxImage.Error);
72+
}
73+
}
74+
75+
private void OpenOsuListenerButton_Click(object sender, RoutedEventArgs e)
76+
{
77+
var listenerWindow = new ListenerView(this, 3);
78+
listenerWindow.Show();
79+
}
80+
2581
private void SetupBindings()
2682
{
2783
// 绑定复选框
@@ -250,7 +306,5 @@ private void Border_DragEnter(object sender, DragEventArgs e)
250306
else
251307
e.Effects = DragDropEffects.None;
252308
}
253-
254-
255309
}
256310
}

tools/LNTransformer/LNTransformer.xaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
66
xmlns:local="clr-namespace:krrTools"
77
Title="LNTransformer"
8-
Width="555" Height="555"
8+
Width="555" Height="615"
99
ResizeMode="NoResize"
1010
WindowStartupLocation="CenterScreen"
1111
AllowDrop="True" Drop="Rectangle_Drop">
@@ -174,6 +174,15 @@
174174
</Hyperlink>
175175
</TextBlock>
176176

177+
<!-- OSU Listener按钮 -->
178+
<Button Content="OSU Listener"
179+
Click="OpenOsuListenerButton_Click"
180+
Style="{StaticResource LightGrayButtonStyle}"
181+
Margin="0,10,0,10"
182+
FontSize="16"
183+
Padding="10,5"
184+
HorizontalAlignment="Stretch"/>
185+
177186
<!-- Progress StackPanel -->
178187
<StackPanel x:Name="ProgressStackPanel" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,60">
179188
<ProgressBar x:Name="ConversionProgress" Minimum="0" Maximum="100" Height="20" Width="400" Margin="0,0,0,5" Style="{StaticResource LightGrayProgressBarStyle}"/>

0 commit comments

Comments
 (0)