@@ -83,6 +83,9 @@ private static string Add1Bar(string maidata, float bpm)
8383
8484 [ GeneratedRegex ( @"(\d)qx(\d)" ) ]
8585 private static partial Regex SimaiError5 ( ) ;
86+
87+ [ GeneratedRegex ( @"(\[[\d\.#:]+\])([bxfh]+)" ) ]
88+ private static partial Regex SimaiError6 ( ) ; // 类似1h[2:1]bx这种写法是不标准的,需要改为1hbx[2:1]
8689
8790 private static string FixChartSimaiSharp ( string chart )
8891 {
@@ -92,6 +95,8 @@ private static string FixChartSimaiSharp(string chart)
9295 chart = SimaiError2 ( ) . Replace ( chart , "[$1:$2]" ) ;
9396 chart = SimaiError4 ( ) . Replace ( chart , ",," ) ;
9497 chart = SimaiError5 ( ) . Replace ( chart , "$1xq$2" ) ;
98+ chart = SimaiError6 ( ) . Replace ( chart , "$2$1" ) ;
99+ chart = chart . Replace ( "-?" , "?-" ) ; // 不飞的星星
95100 return chart ;
96101 }
97102
@@ -147,9 +152,10 @@ public MaiChart TryParseChartSimaiSharp(string chartText, int level, List<Import
147152
148153 try
149154 {
150- var normalizedText = SimaiCommentRegex ( ) . Replace ( chartText , "" ) ;
151- normalizedText = SimaiCommentRegex2 ( ) . Replace ( normalizedText , "" ) ;
152- return new SimaiParser ( ) . ChartOfToken ( new SimaiTokenizer ( ) . TokensFromText ( normalizedText ) ) ;
155+ // 移除注释
156+ chartText = SimaiCommentRegex ( ) . Replace ( chartText , "" ) ;
157+ chartText = SimaiCommentRegex2 ( ) . Replace ( chartText , "" ) ;
158+ return new SimaiParser ( ) . ChartOfToken ( new SimaiTokenizer ( ) . TokensFromText ( chartText ) ) ;
153159 }
154160 catch ( Exception )
155161 {
@@ -158,21 +164,8 @@ public MaiChart TryParseChartSimaiSharp(string chartText, int level, List<Import
158164
159165 try
160166 {
161- var normalizedText = FixChartSimaiSharp ( chartText )
162- // 不飞的星星
163- . Replace ( "-?" , "?-" ) ;
164- // 移除注释
165- normalizedText = SimaiCommentRegex ( ) . Replace ( normalizedText , "" ) ;
166- normalizedText = SimaiCommentRegex2 ( ) . Replace ( normalizedText , "" ) ;
167+ var normalizedText = FixChartSimaiSharp ( chartText ) ;
167168 var tokens = new SimaiTokenizer ( ) . TokensFromText ( normalizedText ) ;
168- for ( var i = 0 ; i < tokens . Length ; i ++ )
169- {
170- if ( tokens [ i ] . Contains ( "]b" ) )
171- {
172- tokens [ i ] = tokens [ i ] . Replace ( "]b" , "]" ) . Replace ( "[" , "b[" ) ;
173- }
174- }
175-
176169 var maiLibChart = new SimaiParser ( ) . ChartOfToken ( tokens ) ;
177170 errors . Add ( new ImportChartMessage ( string . Format ( Locale . ChartFixedMinorErrors , level ) , MessageLevel . Info ) ) ;
178171 return maiLibChart ;
@@ -333,19 +326,15 @@ public ImportChartResult ImportMaidata(
333326 }
334327
335328 var allCharts = new Dictionary < int , AllChartsEntry > ( ) ;
336- for ( var i = 2 ; i < 9 ; i ++ )
329+ for ( var i = 0 ; i < 9 ; i ++ )
337330 {
331+ if ( i == 1 ) continue ;
338332 if ( ! string . IsNullOrWhiteSpace ( maiData . GetValueOrDefault ( $ "inote_{ i } ") ) )
339333 {
340334 allCharts . Add ( i , new AllChartsEntry ( maiData [ $ "inote_{ i } "] , TryParseChartSimaiSharp ( maiData [ $ "inote_{ i } "] , i , errors ) ) ) ;
341335 }
342336 }
343337
344- if ( ! string . IsNullOrWhiteSpace ( maiData . GetValueOrDefault ( "inote_0" ) ) )
345- {
346- allCharts . Add ( 0 , new AllChartsEntry ( maiData [ "inote_0" ] , TryParseChartSimaiSharp ( maiData [ "inote_0" ] , 0 , errors ) ) ) ;
347- }
348-
349338 float . TryParse ( maiData . GetValueOrDefault ( "first" ) , out var first ) ;
350339
351340 var chartPaddingDict = CalcChartPadding ( allCharts . Values . Select ( entry => entry . simaiSharpChart ) . ToList ( ) , out var addBarBpm ) ;
@@ -380,6 +369,7 @@ public ImportChartResult ImportMaidata(
380369
381370 if ( ! targetLevelMap . TryGetValue ( level , out var targetLevel ) ) continue ; // 字典里没查到、说明这个难度是“被忽略的难度”
382371 if ( isUtage ) targetLevel = 0 ;
372+ bool touchSizeBig = ! isUtage && level is 2 or 3 ; // 对绿谱和黄谱,设置为大的 touchSize
383373
384374 var targetChart = music . Charts [ targetLevel ] ;
385375 targetChart . Path = $ "{ id : 000000} _0{ targetLevel } .ma2";
@@ -410,6 +400,14 @@ public ImportChartResult ImportMaidata(
410400 return new ImportChartResult ( errors , true ) ;
411401 }
412402
403+ if ( touchSizeBig )
404+ {
405+ foreach ( var note in maiLibChart . Notes )
406+ {
407+ if ( note . NoteType is NoteEnum . NoteType . TTP or NoteEnum . NoteType . THO ) note . TouchSize = "L1" ;
408+ }
409+ }
410+
413411 var originalConverted = maiLibChart . Compose ( ChartEnum . ChartVersion . Ma2_104 ) ;
414412
415413 if ( debug )
0 commit comments