mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
finish ba2 integration
This commit is contained in:
parent
29943aab87
commit
31b764204f
@ -35,7 +35,7 @@ namespace Wabbajack.Common
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Consts.SupportedBSAs.Any(b => source.EndsWith(b)))
|
if (Consts.SupportedBSAs.Any(b => source.ToLower().EndsWith(b)))
|
||||||
ExtractAllWithBSA(source, dest);
|
ExtractAllWithBSA(source, dest);
|
||||||
else if (source.EndsWith(".exe"))
|
else if (source.EndsWith(".exe"))
|
||||||
ExtractAllWithInno(source, dest);
|
ExtractAllWithInno(source, dest);
|
||||||
@ -216,6 +216,7 @@ namespace Wabbajack.Common
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool CanExtract(string v)
|
public static bool CanExtract(string v)
|
||||||
{
|
{
|
||||||
|
v = v.ToLower();
|
||||||
return Consts.SupportedArchives.Contains(v) || Consts.SupportedBSAs.Contains(v);
|
return Consts.SupportedArchives.Contains(v) || Consts.SupportedBSAs.Contains(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,6 +407,7 @@ namespace Wabbajack
|
|||||||
group.PMap(entry =>
|
group.PMap(entry =>
|
||||||
{
|
{
|
||||||
Info($"Patching {entry.To}");
|
Info($"Patching {entry.To}");
|
||||||
|
Status($"Patching {entry.To}");
|
||||||
using (var origin = by_path[string.Join("|", entry.ArchiveHashPath.Skip(1))].OpenRead())
|
using (var origin = by_path[string.Join("|", entry.ArchiveHashPath.Skip(1))].OpenRead())
|
||||||
using (var output = new MemoryStream())
|
using (var output = new MemoryStream())
|
||||||
{
|
{
|
||||||
@ -431,10 +432,15 @@ namespace Wabbajack
|
|||||||
var bsa_id = to.Split('\\')[1];
|
var bsa_id = to.Split('\\')[1];
|
||||||
var bsa = InstallDirectives.OfType<CreateBSA>().First(b => b.TempID == bsa_id);
|
var bsa = InstallDirectives.OfType<CreateBSA>().First(b => b.TempID == bsa_id);
|
||||||
|
|
||||||
using (var a = new BSAReader(Path.Combine(MO2Folder, bsa.To)))
|
using (var a = BSADispatch.OpenRead(Path.Combine(MO2Folder, bsa.To)))
|
||||||
{
|
{
|
||||||
var file = a.Files.First(e => e.Path == Path.Combine(to.Split('\\').Skip(2).ToArray()));
|
var find = Path.Combine(to.Split('\\').Skip(2).ToArray());
|
||||||
return file.GetData();
|
var file = a.Files.First(e => e.Path.Replace('/', '\\') == find);
|
||||||
|
using (var ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
file.CopyDataTo(ms);
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -927,7 +933,7 @@ namespace Wabbajack
|
|||||||
|
|
||||||
return source =>
|
return source =>
|
||||||
{
|
{
|
||||||
if (!Consts.SupportedBSAs.Contains(Path.GetExtension(source.Path))) return null;
|
if (!Consts.SupportedBSAs.Contains(Path.GetExtension(source.Path).ToLower())) return null;
|
||||||
|
|
||||||
var default_include = false;
|
var default_include = false;
|
||||||
if (source.Path.StartsWith("mods"))
|
if (source.Path.StartsWith("mods"))
|
||||||
@ -959,20 +965,17 @@ namespace Wabbajack
|
|||||||
;
|
;
|
||||||
|
|
||||||
CreateBSA directive;
|
CreateBSA directive;
|
||||||
using (var bsa = new BSAReader(source.AbsolutePath))
|
using (var bsa = BSADispatch.OpenRead(source.AbsolutePath))
|
||||||
{
|
{
|
||||||
directive = new CreateBSA
|
directive = new CreateBSA
|
||||||
{
|
{
|
||||||
To = source.Path,
|
To = source.Path,
|
||||||
TempID = id,
|
TempID = id,
|
||||||
Type = (uint)bsa.HeaderType,
|
State = bsa.State,
|
||||||
FileFlags = (uint)bsa.FileFlags,
|
FileStates = bsa.Files.Select(f => f.State).ToList()
|
||||||
ArchiveFlags = (uint)bsa.ArchiveFlags
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
return directive;
|
return directive;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Compression.BSA;
|
||||||
using VFS;
|
using VFS;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
|
|
||||||
@ -167,15 +168,10 @@ namespace Wabbajack
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class CreateBSA : Directive
|
public class CreateBSA : Directive
|
||||||
{
|
{
|
||||||
public string IsCompressed;
|
|
||||||
public bool ShareData;
|
|
||||||
public string TempID;
|
public string TempID;
|
||||||
public uint Type;
|
public uint Type;
|
||||||
public uint Version;
|
public ArchiveStateObject State { get; set; }
|
||||||
|
public List<FileStateObject> FileStates { get; set; }
|
||||||
public uint FileFlags { get; set; }
|
|
||||||
public bool Compress { get; set; }
|
|
||||||
public uint ArchiveFlags { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -242,30 +242,21 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
Status($"Building {bsa.To}");
|
Status($"Building {bsa.To}");
|
||||||
var source_dir = Path.Combine(Outputfolder, Consts.BSACreationDir, bsa.TempID);
|
var source_dir = Path.Combine(Outputfolder, Consts.BSACreationDir, bsa.TempID);
|
||||||
var source_files = Directory.EnumerateFiles(source_dir, "*", SearchOption.AllDirectories)
|
|
||||||
.Select(e => e.Substring(source_dir.Length + 1))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (source_files.Count > 0)
|
using (var a = bsa.State.MakeBuilder())
|
||||||
using (var a = new BSABuilder())
|
{
|
||||||
|
bsa.FileStates.PMap(state =>
|
||||||
{
|
{
|
||||||
//a.Create(Path.Combine(Outputfolder, bsa.To), (bsa_archive_type_t)bsa.Type, entries);
|
Status($"Adding {state.Path} to BSA");
|
||||||
a.HeaderType = (VersionType)bsa.Type;
|
using (var fs = File.OpenRead(Path.Combine(source_dir, state.Path)))
|
||||||
a.FileFlags = (FileFlags)bsa.FileFlags;
|
|
||||||
a.ArchiveFlags = (ArchiveFlags)bsa.ArchiveFlags;
|
|
||||||
|
|
||||||
source_files.PMap(f =>
|
|
||||||
{
|
{
|
||||||
Status($"Adding {f} to BSA");
|
a.AddFile(state, fs);
|
||||||
using (var fs = File.OpenRead(Path.Combine(source_dir, f)))
|
}
|
||||||
{
|
});
|
||||||
a.AddFile(f, fs);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Info($"Writing {bsa.To}");
|
Info($"Writing {bsa.To}");
|
||||||
a.Build(Path.Combine(Outputfolder, bsa.To));
|
a.Build(Path.Combine(Outputfolder, bsa.To));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace Wabbajack
|
|||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
ShutdownOnClose = false;
|
ShutdownOnClose = false;
|
||||||
new MainWindow(RunMode.Compile, file).Start().Show();
|
new MainWindow(RunMode.Compile, file).Show();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ namespace Wabbajack
|
|||||||
if (file != null)
|
if (file != null)
|
||||||
{
|
{
|
||||||
ShutdownOnClose = false;
|
ShutdownOnClose = false;
|
||||||
new MainWindow(RunMode.Install, file).Start().Show();
|
new MainWindow(RunMode.Install, file).Show();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ namespace Wabbajack.Validation
|
|||||||
if (nexus_mod_permissions.TryGetValue(p.ArchiveHashPath[0], out var archive))
|
if (nexus_mod_permissions.TryGetValue(p.ArchiveHashPath[0], out var archive))
|
||||||
{
|
{
|
||||||
if (!(archive.permissions.CanExtractBSAs ?? true) &&
|
if (!(archive.permissions.CanExtractBSAs ?? true) &&
|
||||||
p.ArchiveHashPath.Skip(1).ButLast().Any(a => Consts.SupportedBSAs.Contains(Path.GetExtension(a))))
|
p.ArchiveHashPath.Skip(1).ButLast().Any(a => Consts.SupportedBSAs.Contains(Path.GetExtension(a).ToLower())))
|
||||||
{
|
{
|
||||||
ValidationErrors.Push($"{p.To} from {archive.archive.NexusURL} is set to disallow BSA Extraction");
|
ValidationErrors.Push($"{p.To} from {archive.archive.NexusURL} is set to disallow BSA Extraction");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user