mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #11 from halgari/issue-10
issue-10 add handling for dummy ESPs
This commit is contained in:
commit
bfca62432c
@ -561,6 +561,7 @@ namespace Wabbajack
|
|||||||
IncludeModIniData(),
|
IncludeModIniData(),
|
||||||
DirectMatch(),
|
DirectMatch(),
|
||||||
IncludePatches(),
|
IncludePatches(),
|
||||||
|
IncludeDummyESPs(),
|
||||||
|
|
||||||
DeconstructBSAs(),
|
DeconstructBSAs(),
|
||||||
|
|
||||||
@ -581,6 +582,35 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Some tools like the Cathedral Asset Optimizer will create dummy ESPs whos only existance is to make
|
||||||
|
/// sure a BSA with the same name is loaded. We don't have a good way to detect these, but if an ESP is
|
||||||
|
/// less than 100 bytes in size and shares a name with a BSA it's a pretty good chance that it's a dummy
|
||||||
|
/// and the contents are generated.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private Func<RawSourceFile, Directive> IncludeDummyESPs()
|
||||||
|
{
|
||||||
|
return source =>
|
||||||
|
{
|
||||||
|
if (Path.GetExtension(source.AbsolutePath) == ".esp")
|
||||||
|
{
|
||||||
|
var bsa = Path.Combine(Path.GetDirectoryName(source.AbsolutePath), Path.GetFileNameWithoutExtension(source.AbsolutePath) + ".bsa");
|
||||||
|
var bsa_textures = Path.Combine(Path.GetDirectoryName(source.AbsolutePath), Path.GetFileNameWithoutExtension(source.AbsolutePath) + " - Textures.bsa");
|
||||||
|
var esp_size = new FileInfo(source.AbsolutePath).Length;
|
||||||
|
if (esp_size <= 100 && (File.Exists(bsa) || File.Exists(bsa_textures)))
|
||||||
|
{
|
||||||
|
var inline = source.EvolveTo<InlineFile>();
|
||||||
|
inline.SourceData = File.ReadAllBytes(source.AbsolutePath).ToBase64();
|
||||||
|
return inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function will search for a way to create a BSA in the installed mod list by assembling it from files
|
/// This function will search for a way to create a BSA in the installed mod list by assembling it from files
|
||||||
/// found in archives. To do this we hash all the files in side the BSA then try to find matches and patches for
|
/// found in archives. To do this we hash all the files in side the BSA then try to find matches and patches for
|
||||||
|
Loading…
Reference in New Issue
Block a user