@@ -1065,25 +1065,11 @@ class ChartEditorDialogHandler
10651065 {
10661066 case ' legacy' : ' FNF Legacy' ;
10671067 case ' stepmania' : ' StepMania' ;
1068- case ' osumania' : ' Osu !Mania' ;
1068+ case ' osumania' : ' osu !Mania' ;
10691069 default : ' Unknown' ;
10701070 }
10711071
1072- var fileFilter = switch (format )
1073- {
1074- case ' legacy' :
1075- [
1076- {label : ' JSON Data File (.json)' , extension : ' json' }];
1077- case ' stepmania' :
1078- [
1079- {label : ' StepMania File (.sm)' , extension : ' sm' }];
1080- case ' osumania' :
1081- [
1082- {label : ' OSU! Beatmap File (.osu)' , extension : ' osu' }];
1083- default : null ;
1084- }
1085-
1086- var fileExt = switch (format )
1072+ var fileExt : String = switch (format )
10871073 {
10881074 case ' osumania' :
10891075 " osu" ;
@@ -1092,6 +1078,18 @@ class ChartEditorDialogHandler
10921078 default : " json" ;
10931079 }
10941080
1081+ var fileFilterLabel : String = switch (fileExt )
1082+ {
1083+ case ' json' :
1084+ ' JSON Data File' ;
1085+ case ' sm' :
1086+ ' StepMania File' ;
1087+ case ' osu' :
1088+ ' osu! Beatmap File' ;
1089+ default : " Unknown File Type" ;
1090+ };
1091+ fileFilterLabel + = ' (. $fileExt )' ;
1092+
10951093 dialog .title = ' Import Chart - ${prettyFormat }' ;
10961094
10971095 var buttonCancel : Null <Button > = dialog .findComponent (' dialogCancel' , Button );
@@ -1166,8 +1164,6 @@ class ChartEditorDialogHandler
11661164 return ;
11671165 }
11681166
1169- trace (' Parsed StepMania data for ' + stepmaniaData. Metadata . Title );
1170-
11711167 songMetadata = StepManiaImporter .migrateChartMetadata (stepmaniaData );
11721168 songChartData = StepManiaImporter .migrateChartData (stepmaniaData );
11731169
@@ -1178,7 +1174,14 @@ class ChartEditorDialogHandler
11781174
11791175 if (osuManiaData == null )
11801176 {
1181- state .error (' Failure' , ' Failed to parse Osu!Mania beatmap file ( ${path .file }. ${path .ext })' );
1177+ state .error (' Failure' , ' Failed to parse osu!Mania beatmap file ( ${path .file }. ${path .ext })' );
1178+ return ;
1179+ }
1180+ else if (osuManiaData. General . Mode != 3 )
1181+ {
1182+ var modes = [" osu!" , " osu!taiko" , " osu!catch" ];
1183+ state .error (' Failure' ,
1184+ ' Not a osu!mania beatmap!\n Given beatmap seems to be a ${modes [osuManiaData. General . Mode ]} beatmap ( ${path .file }. ${path .ext })' );
11821185 return ;
11831186 }
11841187
@@ -1199,9 +1202,11 @@ class ChartEditorDialogHandler
11991202 state .success (' Success' , ' $loadedText ( ${path .file }. ${path .ext })' );
12001203 };
12011204
1205+ // TODO / BUG: File filtering not working on mac finder dialog, so we don't use it for now
1206+ var fileTypes = #if !mac [
1207+ {label : fileFilterLabel , extension : fileExt }] #else [] #end;
12021208 importBox .onClick = function (_ ) {
1203- // TODO / BUG: File filtering not working on mac finder dialog, so we don't use it for now
1204- Dialogs .openBinaryFile (' Import Chart - ${prettyFormat }' , #if !mac fileFilter ?? [] #else [] #end, function (selectedFile : SelectedFileInfo ) {
1209+ Dialogs .openBinaryFile (' Import Chart - ${prettyFormat }' , fileTypes , function (selectedFile : SelectedFileInfo ) {
12051210 if (selectedFile != null && selectedFile .bytes != null )
12061211 {
12071212 @:nullSafety (Off )
0 commit comments