From c62a2a99799172c07b034f74b2975bb6a38a8895 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Tue, 9 Aug 2022 05:54:21 -0600 Subject: [PATCH] Fixes for Wildlander --- Wabbajack.App.Wpf/Models/ResourceMonitor.cs | 3 +- .../View Models/Compilers/CompilerVM.cs | 11 +++++-- .../CompilerSettingsInferencer.cs | 4 +++ Wabbajack.Hashing.PHash/Image.cs | 1 + Wabbajack.Installer/AInstaller.cs | 29 ++++++++++--------- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/Wabbajack.App.Wpf/Models/ResourceMonitor.cs b/Wabbajack.App.Wpf/Models/ResourceMonitor.cs index 97f01c7e..27fb755f 100644 --- a/Wabbajack.App.Wpf/Models/ResourceMonitor.cs +++ b/Wabbajack.App.Wpf/Models/ResourceMonitor.cs @@ -45,6 +45,7 @@ public class ResourceMonitor : IDisposable .DisposeWith(_compositeDisposable); _tasks.Connect() + .Filter(x => x.IsWorking) .Bind(out _tasksFiltered) .Subscribe() .DisposeWith(_compositeDisposable); @@ -64,7 +65,7 @@ public class ResourceMonitor : IDisposable var used = new HashSet(); foreach (var resource in _resources) { - foreach (var job in resource.Jobs) + foreach (var job in resource.Jobs.Where(j => j.Current > 0)) { used.Add(job.ID); var tsk = l.Lookup(job.ID); diff --git a/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs b/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs index b3733f6e..26b154f8 100644 --- a/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs @@ -270,10 +270,15 @@ namespace Wabbajack } _logger.LogInformation("Compiler Finished"); - StatusText = "Compilation Completed"; - StatusProgress = Percent.Zero; + RxApp.MainThreadScheduler.Schedule(_logger, (_, _) => + { + StatusText = "Compilation Completed"; + StatusProgress = Percent.Zero; + State = CompilerState.Completed; + return Disposable.Empty; + }); - State = CompilerState.Completed; + } catch (Exception ex) { diff --git a/Wabbajack.Compiler/CompilerSettingsInferencer.cs b/Wabbajack.Compiler/CompilerSettingsInferencer.cs index 3f4aa213..56ed795b 100644 --- a/Wabbajack.Compiler/CompilerSettingsInferencer.cs +++ b/Wabbajack.Compiler/CompilerSettingsInferencer.cs @@ -64,10 +64,14 @@ public class CompilerSettingsInferencer cs.Downloads = cs.Source.Combine("downloads"); cs.NoMatchInclude = Array.Empty(); + cs.Include = Array.Empty(); foreach (var file in mo2Folder.EnumerateFiles()) { if (file.FileName == Consts.WABBAJACK_NOMATCH_INCLUDE_FILES) cs.NoMatchInclude = cs.NoMatchInclude.Add(file.Parent.RelativeTo(mo2Folder)); + + if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_INCLUDE) + cs.Include = cs.Include.Add(file.Parent.RelativeTo(mo2Folder)); } _logger.LogInformation("Finding Always Enabled mods"); diff --git a/Wabbajack.Hashing.PHash/Image.cs b/Wabbajack.Hashing.PHash/Image.cs index 169c6b38..58450401 100644 --- a/Wabbajack.Hashing.PHash/Image.cs +++ b/Wabbajack.Hashing.PHash/Image.cs @@ -105,6 +105,7 @@ public class ImageLoader DXGI_FORMAT.BC4_UNORM => CompressionFormat.Bc4, DXGI_FORMAT.BC5_UNORM => CompressionFormat.Bc5, DXGI_FORMAT.BC7_UNORM => CompressionFormat.Bc7, + DXGI_FORMAT.B8G8R8A8_UNORM => CompressionFormat.Bgra, _ => throw new Exception($"Cannot re-encode texture with {dx} format, encoding not supported") }; } diff --git a/Wabbajack.Installer/AInstaller.cs b/Wabbajack.Installer/AInstaller.cs index d2b53340..4c1e4603 100644 --- a/Wabbajack.Installer/AInstaller.cs +++ b/Wabbajack.Installer/AInstaller.cs @@ -486,24 +486,25 @@ public abstract class AInstaller var savePath = (RelativePath) "saves"; NextStep(Consts.StepPreparing, "Looking for files to delete", 0); - foreach (var f in _configuration.Install.EnumerateFiles()) - { - var relativeTo = f.RelativeTo(_configuration.Install); - if (indexed.ContainsKey(relativeTo) || f.InFolder(_configuration.Downloads)) - return; + await _configuration.Install.EnumerateFiles() + .PDoAll(_limiter, async f => + { + var relativeTo = f.RelativeTo(_configuration.Install); + if (indexed.ContainsKey(relativeTo) || f.InFolder(_configuration.Downloads)) + return ; - if (f.InFolder(profileFolder) && f.Parent.FileName == savePath) return; + if (f.InFolder(profileFolder) && f.Parent.FileName == savePath) return; - if (NoDeleteRegex.IsMatch(f.ToString())) - return; + if (NoDeleteRegex.IsMatch(f.ToString())) + return ; - if (bsaPathsToNotBuild.Contains(f)) - return; + if (bsaPathsToNotBuild.Contains(f)) + return ; + + _logger.LogInformation("Deleting {RelativePath} it's not part of this ModList", relativeTo); + f.Delete(); + }); - _logger.LogInformation("Deleting {RelativePath} it's not part of this ModList", relativeTo); - f.Delete(); - } - _logger.LogInformation("Cleaning empty folders"); var expectedFolders = indexed.Keys .Select(f => f.RelativeTo(_configuration.Install))