From cfb928bfce2ccbf9de57c7bc1da422d019307575 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Mon, 26 Sep 2022 21:02:39 -0600 Subject: [PATCH] Fix native game compilation --- CHANGELOG.md | 5 +++-- .../CompilationSteps/ACompilationStep.cs | 2 ++ .../CompilationSteps/ICompilationStep.cs | 2 ++ .../CompilationSteps/IgnoreDisabledMods.cs | 10 ++++++---- .../CompilationSteps/IncludeThisProfile.cs | 5 +++++ Wabbajack.Compiler/CompilerSettings.cs | 2 ++ Wabbajack.Compiler/MO2Compiler.cs | 2 +- Wabbajack.DTOs/Game/GameRegistry.cs | 1 + Wabbajack.Downloaders.Nexus/NexusDownloader.cs | 3 ++- 9 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc825b71..3633512a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ ### Changelog -#### Version - 3.0.1.6 - 9/??/2022 +#### Version - 3.0.1.6 - 9/26/2022 * Fix Cyberpunk 2077 GoG recognition * Add a CLI command `list-games` to list all games recognized by WJ and their versions/locations -* Fix Native Game compiler installs +* Fix Native Game Compiler installs +* Fix Native Game Compiler compilation #### Version - 3.0.1.5 - 9/26/2022 * Fix MO2ArchiveName resolution diff --git a/Wabbajack.Compiler/CompilationSteps/ACompilationStep.cs b/Wabbajack.Compiler/CompilationSteps/ACompilationStep.cs index 7b52b2cf..48125cd3 100644 --- a/Wabbajack.Compiler/CompilationSteps/ACompilationStep.cs +++ b/Wabbajack.Compiler/CompilationSteps/ACompilationStep.cs @@ -7,6 +7,8 @@ public abstract class ACompilationStep : ICompilationStep { protected ACompiler _compiler; + public bool Disabled { get; set; } = false; + public ACompilationStep(ACompiler compiler) { _compiler = compiler; diff --git a/Wabbajack.Compiler/CompilationSteps/ICompilationStep.cs b/Wabbajack.Compiler/CompilationSteps/ICompilationStep.cs index 6bd42068..98be211a 100644 --- a/Wabbajack.Compiler/CompilationSteps/ICompilationStep.cs +++ b/Wabbajack.Compiler/CompilationSteps/ICompilationStep.cs @@ -6,4 +6,6 @@ namespace Wabbajack.Compiler.CompilationSteps; public interface ICompilationStep { ValueTask Run(RawSourceFile source); + + bool Disabled { get; } } \ No newline at end of file diff --git a/Wabbajack.Compiler/CompilationSteps/IgnoreDisabledMods.cs b/Wabbajack.Compiler/CompilationSteps/IgnoreDisabledMods.cs index 14c1ce3a..9434f43d 100644 --- a/Wabbajack.Compiler/CompilationSteps/IgnoreDisabledMods.cs +++ b/Wabbajack.Compiler/CompilationSteps/IgnoreDisabledMods.cs @@ -16,10 +16,12 @@ public class IgnoreDisabledMods : ACompilationStep public IgnoreDisabledMods(ACompiler compiler) : base(compiler) { _mo2Compiler = (MO2Compiler) compiler; - //var alwaysEnabled = _mo2Compiler.ModInis.Where(f => HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_ENABLE)).Select(f => f.Key).Distinct(); - // TODO: Re-enable this - //var alwaysDisabled = _mo2Compiler.ModInis - // .Where(f => HasFlagInNotes(f.Value, Consts.WABBAJACK_ALWAYS_DISABLE)).Select(f => f.Key).Distinct(); + + if (!compiler.Settings.IsMO2Modlist) + { + Disabled = true; + return; + } _allEnabledMods = _mo2Compiler._settings.AllProfiles .SelectMany(p => _mo2Compiler._settings.Source.Combine("profiles", p, "modlist.txt").ReadAllLines()) diff --git a/Wabbajack.Compiler/CompilationSteps/IncludeThisProfile.cs b/Wabbajack.Compiler/CompilationSteps/IncludeThisProfile.cs index ec39e37f..dc01d360 100644 --- a/Wabbajack.Compiler/CompilationSteps/IncludeThisProfile.cs +++ b/Wabbajack.Compiler/CompilationSteps/IncludeThisProfile.cs @@ -18,6 +18,11 @@ public class IncludeThisProfile : ACompilationStep public IncludeThisProfile(ACompiler compiler) : base(compiler) { _mo2Compiler = (MO2Compiler) compiler; + if (!compiler.Settings.IsMO2Modlist) + { + Disabled = true; + return; + } _correctProfiles = _mo2Compiler._settings.AllProfiles .Select(p => _mo2Compiler.MO2ProfileDir.Parent.Combine(p)).ToList(); } diff --git a/Wabbajack.Compiler/CompilerSettings.cs b/Wabbajack.Compiler/CompilerSettings.cs index 5db52167..8dddaa71 100644 --- a/Wabbajack.Compiler/CompilerSettings.cs +++ b/Wabbajack.Compiler/CompilerSettings.cs @@ -48,6 +48,8 @@ public class CompilerSettings [JsonIgnore] public IEnumerable AllProfiles => AdditionalProfiles.Append(Profile); + [JsonIgnore] public bool IsMO2Modlist => AllProfiles.Any(p => !string.IsNullOrWhiteSpace(p)); + /// diff --git a/Wabbajack.Compiler/MO2Compiler.cs b/Wabbajack.Compiler/MO2Compiler.cs index db9dba88..fa9e63a3 100644 --- a/Wabbajack.Compiler/MO2Compiler.cs +++ b/Wabbajack.Compiler/MO2Compiler.cs @@ -314,6 +314,6 @@ public class MO2Compiler : ACompiler if (!_settings.UseTextureRecompression) steps = steps.Where(s => s is not MatchSimilarTextures).ToList(); - return steps; + return steps.Where(s => !s.Disabled); } } \ No newline at end of file diff --git a/Wabbajack.DTOs/Game/GameRegistry.cs b/Wabbajack.DTOs/Game/GameRegistry.cs index e11064be..4a5a1dea 100644 --- a/Wabbajack.DTOs/Game/GameRegistry.cs +++ b/Wabbajack.DTOs/Game/GameRegistry.cs @@ -225,6 +225,7 @@ public static class GameRegistry Game = Game.Dishonored, NexusName = "dishonored", MO2Name = "Dishonored", + MO2ArchiveName = "dishonored", NexusGameId = 802, SteamIDs = new[] {205100}, GOGIDs = new[] {1701063787}, diff --git a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs index 471bbd3e..8bb1eb88 100644 --- a/Wabbajack.Downloaders.Nexus/NexusDownloader.cs +++ b/Wabbajack.Downloaders.Nexus/NexusDownloader.cs @@ -215,9 +215,10 @@ public class NexusDownloader : ADownloader, IUrlDownloader public override IEnumerable MetaIni(Archive a, Nexus state) { + var meta = state.Game.MetaData(); return new[] { - $"gameName={state.Game.MetaData().MO2ArchiveName}", $"modID={state.ModID}", $"fileID={state.FileID}" + $"gameName={meta.MO2ArchiveName ?? meta.NexusName}", $"modID={state.ModID}", $"fileID={state.FileID}" }; } } \ No newline at end of file