mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Check for a DDS signature before attempting to analyze textures
This commit is contained in:
parent
9422b571b1
commit
631ccba553
@ -1,5 +1,8 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 2.5.1.5 - 7/17/2021
|
||||
* HOTFIX - Don't attempt to analyze files that have .dds extensions but are not DDS files internally
|
||||
|
||||
#### Version - 2.5.1.4 - 7/17/2021
|
||||
* Fix some broken VFS caching (that's existed for awhile)
|
||||
* Enable perceptual hashing for files inside BSA file
|
||||
|
@ -6,8 +6,8 @@
|
||||
<AssemblyName>wabbajack-cli</AssemblyName>
|
||||
<Company>Wabbajack</Company>
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyVersion>2.5.1.4</AssemblyVersion>
|
||||
<FileVersion>2.5.1.4</FileVersion>
|
||||
<AssemblyVersion>2.5.1.5</AssemblyVersion>
|
||||
<FileVersion>2.5.1.5</FileVersion>
|
||||
<Copyright>Copyright © 2019-2021</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -85,7 +85,9 @@ namespace Wabbajack.ImageHashing
|
||||
|
||||
public static async Task<ImageState> GetState(AbsolutePath path)
|
||||
{
|
||||
var ph = new ProcessHelper
|
||||
try
|
||||
{
|
||||
var ph = new ProcessHelper
|
||||
{
|
||||
Path = @"Tools\texdiag.exe".RelativeTo(AbsolutePath.EntryPoint),
|
||||
Arguments = new object[] {"info", path, "-nologo"},
|
||||
@ -112,6 +114,11 @@ namespace Wabbajack.ImageHashing
|
||||
Format = Enum.Parse<DXGI_FORMAT>(data["format"]),
|
||||
PerceptualHash = await GetPHash(path)
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyVersion>2.5.1.4</AssemblyVersion>
|
||||
<FileVersion>2.5.1.4</FileVersion>
|
||||
<AssemblyVersion>2.5.1.5</AssemblyVersion>
|
||||
<FileVersion>2.5.1.5</FileVersion>
|
||||
<Copyright>Copyright © 2019-2020</Copyright>
|
||||
<Description>Wabbajack Application Launcher</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<AssemblyVersion>2.5.1.4</AssemblyVersion>
|
||||
<FileVersion>2.5.1.4</FileVersion>
|
||||
<AssemblyVersion>2.5.1.5</AssemblyVersion>
|
||||
<FileVersion>2.5.1.5</FileVersion>
|
||||
<Copyright>Copyright © 2019-2021</Copyright>
|
||||
<Description>Wabbajack Server</Description>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
|
@ -7,6 +7,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Compression.BSA;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
using K4os.Hash.Crc;
|
||||
using Wabbajack.Common;
|
||||
@ -189,8 +190,8 @@ namespace Wabbajack.VirtualFileSystem
|
||||
Size = Size
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static SignatureChecker DDSSig = new(Definitions.FileType.DSS);
|
||||
public static async Task<VirtualFile> Analyze(Context context, VirtualFile parent, IStreamFactory extractedFile,
|
||||
IPath relPath, int depth = 0)
|
||||
{
|
||||
@ -226,10 +227,18 @@ namespace Wabbajack.VirtualFileSystem
|
||||
Hash = hash,
|
||||
};
|
||||
|
||||
if (Consts.TextureExtensions.Contains(relPath.FileName.Extension))
|
||||
if (Consts.TextureExtensions.Contains(relPath.FileName.Extension) && (await DDSSig.MatchesAsync(stream)) != null)
|
||||
{
|
||||
self.ImageState = await ImageState.FromImageStream(stream, relPath.FileName.Extension, false);
|
||||
stream.Position = 0;
|
||||
try
|
||||
{
|
||||
self.ImageState = await ImageState.FromImageStream(stream, relPath.FileName.Extension, false);
|
||||
stream.Position = 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Utils.Log($"Unable to perform perceptual hashing on {relPath.FileName} in {parent.FullPath}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
self.FillFullPath(depth);
|
||||
|
@ -6,8 +6,8 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<Platforms>x64</Platforms>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<AssemblyVersion>2.5.1.4</AssemblyVersion>
|
||||
<FileVersion>2.5.1.4</FileVersion>
|
||||
<AssemblyVersion>2.5.1.5</AssemblyVersion>
|
||||
<FileVersion>2.5.1.5</FileVersion>
|
||||
<Copyright>Copyright © 2019-2021</Copyright>
|
||||
<Description>An automated ModList installer</Description>
|
||||
<PublishReadyToRun>true</PublishReadyToRun>
|
||||
|
Loading…
Reference in New Issue
Block a user