mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #921 from erri120/add-darkestdungeon
Re-added Darkest Dungeons
This commit is contained in:
commit
e02e045c1d
@ -27,7 +27,10 @@ namespace Wabbajack.Common
|
||||
[Description("Skyrim VR")]
|
||||
SkyrimVR,
|
||||
[Description("Fallout 4 VR")]
|
||||
Fallout4VR
|
||||
Fallout4VR,
|
||||
//MO2 Non-BGS Games
|
||||
[Description("Darkest Dungeon")]
|
||||
DarkestDungeon
|
||||
}
|
||||
|
||||
public static class GameExtensions
|
||||
@ -43,6 +46,8 @@ namespace Wabbajack.Common
|
||||
public Game Game { get; internal set; }
|
||||
public ModManager SupportedModManager { get; internal set; }
|
||||
|
||||
public bool IsGenericMO2Plugin { get; internal set; }
|
||||
|
||||
public string? MO2ArchiveName { get; internal set; }
|
||||
public string? NexusName { get; internal set; }
|
||||
// Nexus DB id for the game, used in some specific situations
|
||||
@ -395,6 +400,23 @@ namespace Wabbajack.Common
|
||||
MainExecutable = "Fallout4VR.exe",
|
||||
CommonlyConfusedWith = new [] {Game.Fallout4}
|
||||
}
|
||||
},
|
||||
{
|
||||
Game.DarkestDungeon, new GameMetaData
|
||||
{
|
||||
Game = Game.DarkestDungeon,
|
||||
NexusName = "darkestdungeon",
|
||||
MO2Name = "Darkest Dungeon",
|
||||
NexusGameId = 804,
|
||||
SteamIDs = new List<int> {262060},
|
||||
GOGIDs = new List<int>{1450711444},
|
||||
IsGenericMO2Plugin = true,
|
||||
RequiredFiles = new List<string>
|
||||
{
|
||||
"_windows\\Darkest.exe"
|
||||
},
|
||||
MainExecutable = "_windows\\Darkest.exe"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
60
Wabbajack.Lib/CompilationSteps/IncludeGenericGamePlugin.cs
Normal file
60
Wabbajack.Lib/CompilationSteps/IncludeGenericGamePlugin.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IncludeGenericGamePlugin : ACompilationStep
|
||||
{
|
||||
private readonly bool _validGame;
|
||||
private readonly string _pluginsFolder = string.Empty;
|
||||
private readonly string _gameName = string.Empty;
|
||||
|
||||
public IncludeGenericGamePlugin(ACompiler compiler) : base(compiler)
|
||||
{
|
||||
if (!(compiler is MO2Compiler mo2Compiler))
|
||||
return;
|
||||
|
||||
if (mo2Compiler.CompilingGame.NexusName == null)
|
||||
return;
|
||||
|
||||
_validGame = mo2Compiler.CompilingGame.IsGenericMO2Plugin;
|
||||
_pluginsFolder = mo2Compiler.MO2Folder.Combine("plugins").ToString();
|
||||
_gameName = $"game_{mo2Compiler.CompilingGame.NexusName}.py";
|
||||
}
|
||||
|
||||
private static Regex regex = new Regex(@"^game_$");
|
||||
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_validGame)
|
||||
return null;
|
||||
|
||||
if (!source.AbsolutePath.ToString().StartsWith(_pluginsFolder))
|
||||
return null;
|
||||
|
||||
if(!source.AbsolutePath.FileName.ToString().Equals(_gameName, StringComparison.InvariantCultureIgnoreCase))
|
||||
return null;
|
||||
|
||||
var res = source.EvolveTo<InlineFile>();
|
||||
res.SourceDataID = await _compiler.IncludeFile(await source.AbsolutePath.ReadAllBytesAsync());
|
||||
return res;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludeGenericGamePlugin")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(ACompiler compiler)
|
||||
{
|
||||
return new IncludeGenericGamePlugin(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -175,7 +175,6 @@ namespace Wabbajack.Lib
|
||||
UpdateTracker.NextStep("Reindexing downloads after meta inferring");
|
||||
await VFS.AddRoot(MO2DownloadsFolder);
|
||||
await VFS.WriteToFile(VFSCacheName);
|
||||
|
||||
|
||||
if (cancel.IsCancellationRequested) return false;
|
||||
UpdateTracker.NextStep("Pre-validating Archives");
|
||||
@ -193,34 +192,38 @@ namespace Wabbajack.Lib
|
||||
|
||||
|
||||
var stockGameFolder = CompilingGame.GameLocation();
|
||||
|
||||
foreach (var (relativePath, hash) in await ClientAPI.GetGameFiles(CompilingGame.Game, Version.Parse(CompilingGame.InstalledVersion)))
|
||||
|
||||
var installedVersion = CompilingGame.InstalledVersion;
|
||||
if (installedVersion != null)
|
||||
{
|
||||
if (!VFS.Index.ByRootPath.TryGetValue(relativePath.RelativeTo(stockGameFolder), out var virtualFile))
|
||||
continue;
|
||||
if (virtualFile.Hash != hash)
|
||||
foreach (var (relativePath, hash) in await ClientAPI.GetGameFiles(CompilingGame.Game, Version.Parse(installedVersion)))
|
||||
{
|
||||
Utils.Log(
|
||||
$"File {relativePath} int the game folder appears to be modified, it will not be used during compilation");
|
||||
continue;
|
||||
if (!VFS.Index.ByRootPath.TryGetValue(relativePath.RelativeTo(stockGameFolder), out var virtualFile))
|
||||
continue;
|
||||
if (virtualFile.Hash != hash)
|
||||
{
|
||||
Utils.Log(
|
||||
$"File {relativePath} int the game folder appears to be modified, it will not be used during compilation");
|
||||
continue;
|
||||
}
|
||||
|
||||
var state = new GameFileSourceDownloader.State
|
||||
{
|
||||
Game = CompilingGame.Game,
|
||||
GameVersion = CompilingGame.InstalledVersion,
|
||||
GameFile = relativePath
|
||||
};
|
||||
|
||||
Utils.Log($"Adding Game file: {relativePath}");
|
||||
IndexedArchives.Add(new IndexedArchive(virtualFile)
|
||||
{
|
||||
Name = (string)relativePath.FileName,
|
||||
IniData = state.GetMetaIniString().LoadIniString(),
|
||||
Meta = state.GetMetaIniString()
|
||||
});
|
||||
}
|
||||
|
||||
var state = new GameFileSourceDownloader.State
|
||||
{
|
||||
Game = CompilingGame.Game, GameVersion = CompilingGame.InstalledVersion, GameFile = relativePath
|
||||
};
|
||||
|
||||
Utils.Log($"Adding Game file: {relativePath}");
|
||||
IndexedArchives.Add(new IndexedArchive(virtualFile)
|
||||
{
|
||||
Name = (string)relativePath.FileName,
|
||||
IniData = state.GetMetaIniString().LoadIniString(),
|
||||
Meta = state.GetMetaIniString()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
await CleanInvalidArchives();
|
||||
|
||||
UpdateTracker.NextStep("Finding Install Files");
|
||||
@ -550,6 +553,7 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
new IgnoreGameFilesIfGameFolderFilesExist(this),
|
||||
new IncludePropertyFiles(this),
|
||||
new IncludeGenericGamePlugin(this),
|
||||
new IgnoreStartsWith(this,"logs\\"),
|
||||
new IgnoreStartsWith(this, "downloads\\"),
|
||||
new IgnoreStartsWith(this,"webcache\\"),
|
||||
|
Loading…
Reference in New Issue
Block a user