@@ -663,13 +663,13 @@ public async Task<int> TexDDSImporter(XivTex xivTex, IItem item, DirectoryInfo d
663
663
return offset ;
664
664
}
665
665
666
- public async Task < int > TexBMPImporter ( XivTex xivTex , IItem item , DirectoryInfo bmpFileDirectory , string source )
666
+ public async Task < int > TexImporter ( XivTex xivTex , IItem item , DirectoryInfo fileDirectory , string source )
667
667
{
668
668
var offset = 0 ;
669
669
670
670
var modding = new Modding ( _gameDirectory ) ;
671
671
672
- if ( File . Exists ( bmpFileDirectory . FullName ) )
672
+ if ( File . Exists ( fileDirectory . FullName ) )
673
673
{
674
674
// Check if the texture being imported has been imported before
675
675
var modEntry = await modding . TryGetModEntry ( xivTex . TextureTypeAndPath . Path ) ;
@@ -679,7 +679,7 @@ public async Task<int> TexBMPImporter(XivTex xivTex, IItem item, DirectoryInfo b
679
679
switch ( xivTex . TextureFormat )
680
680
{
681
681
case XivTexFormat . DXT1 :
682
- compressionFormat = CompressionFormat . BC1 ;
682
+ compressionFormat = CompressionFormat . BC1a ;
683
683
break ;
684
684
case XivTexFormat . DXT5 :
685
685
compressionFormat = CompressionFormat . BC3 ;
@@ -691,8 +691,11 @@ public async Task<int> TexBMPImporter(XivTex xivTex, IItem item, DirectoryInfo b
691
691
throw new Exception ( $ "Format { xivTex . TextureFormat } is not currently supported for BMP import\n \n Please use the DDS import option instead.") ;
692
692
}
693
693
694
- using ( var surface = Surface . LoadFromFile ( bmpFileDirectory . FullName ) )
694
+ using ( var surface = Surface . LoadFromFile ( fileDirectory . FullName ) )
695
695
{
696
+ if ( surface == null )
697
+ throw new FormatException ( $ "Unsupported texture format") ;
698
+
696
699
surface . FlipVertically ( ) ;
697
700
698
701
using ( var compressor = new Compressor ( ) )
@@ -805,7 +808,7 @@ public async Task<int> TexBMPImporter(XivTex xivTex, IItem item, DirectoryInfo b
805
808
}
806
809
else
807
810
{
808
- throw new IOException ( $ "Could not find file: { bmpFileDirectory . FullName } ") ;
811
+ throw new IOException ( $ "Could not find file: { fileDirectory . FullName } ") ;
809
812
}
810
813
811
814
return offset ;
0 commit comments