From fd37835532073f7ece2d8d2eca7104ec4e0db904 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Mon, 22 Aug 2022 17:15:19 -0600 Subject: [PATCH] Lots of little compiler fixes --- CHANGELOG.md | 5 +++-- .../View Models/Compilers/CompilerVM.cs | 4 +++- Wabbajack.Compiler/ACompiler.cs | 4 +++- Wabbajack.VFS/Context.cs | 18 ++++++++++++++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c422e2..9a4d677c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ ### Changelog -#### Version - 3.0.0.5 - -* No longer rehashes files on every compile +#### Version - 3.0.0.5 - 8/22/2022 +* No longer rehashes files on every compile (faster Add Roots step during compilation) * Editing paths in the install/compile settings won't crash the app * Fix for .refcache files not being ignored during compilation +* Greatly reduce the amount of UI hangups during compilation #### Version - 3.0.0.4 - 8/20/2022 * Fix for: when some optional game files weren't present (like CreationKit.exe), the app would refuse to recognize any files from that game diff --git a/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs b/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs index 912a6ce1..b0dc1bad 100644 --- a/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Compilers/CompilerVM.cs @@ -278,7 +278,9 @@ namespace Wabbajack try { - await compiler.Begin(token); + var result = await compiler.Begin(token); + if (!result) + throw new Exception("Compilation Failed"); } finally { diff --git a/Wabbajack.Compiler/ACompiler.cs b/Wabbajack.Compiler/ACompiler.cs index fdde73df..e659b1ad 100644 --- a/Wabbajack.Compiler/ACompiler.cs +++ b/Wabbajack.Compiler/ACompiler.cs @@ -447,6 +447,8 @@ public abstract class ACompiler /// protected async Task BuildPatches(CancellationToken token) { + + NextStep("Compiling","Looking for patches"); var toBuild = InstallDirectives.OfType() .Where(p => _patchOptions.GetValueOrDefault(p, Array.Empty()).Length > 0) .SelectMany(p => _patchOptions[p].Select(c => new PatchedFromArchive @@ -487,7 +489,7 @@ public abstract class ACompiler _logger.LogInformation("Patch size {patchSize} for {to}", patchSize, match.To); }, token); } - }, token); + }, token, runInParallel: false); // Load in the patches await InstallDirectives.OfType() diff --git a/Wabbajack.VFS/Context.cs b/Wabbajack.VFS/Context.cs index cbea822d..3ad4fe3a 100644 --- a/Wabbajack.VFS/Context.cs +++ b/Wabbajack.VFS/Context.cs @@ -99,11 +99,11 @@ public class Context /// Predefined list of files to extract, all others will be skipped /// Func called for each file extracted /// Optional: folder to use for temporary storage - /// Optional: Status update tracker + /// Optional: run `callback`s in parallel /// /// public async Task Extract(HashSet files, Func callback, - CancellationToken token, AbsolutePath? tempFolder = null) + CancellationToken token, AbsolutePath? tempFolder = null, bool runInParallel = true) { var top = new VirtualFile(); var filesByParent = files.SelectMany(f => f.FilesInFullPath) @@ -144,8 +144,18 @@ public class Context } } - await filesByParent[top].PDoAll( - async file => await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false})); + if (runInParallel) + { + await filesByParent[top].PDoAll( + async file => await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false})); + } + else + { + foreach (var file in filesByParent[top]) + { + await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false}); + } + } } #region KnownFiles