Merge pull request #822 from wabbajack-tools/fix-fo4-issues

More hotfixes for Elder Souls / FO4 compilation
This commit is contained in:
Timothy Baldridge 2020-05-11 08:56:13 -07:00 committed by GitHub
commit 18c605974e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,8 @@
### Changelog
#### Version - 2.0.4.4 - 5/11/2020
* BA2s store file names as UTF8 instead of UTF7
* Check for a BSA file by header magic not by extension (allows .bsa.bak files to be extracted)
* Exclude the game `Data` directory from compilation
#### Version - 2.0.4.3 - 5/10/2020
* Hotfix: tell the WJ CDN downloader to create the parent folder if it doesn't exist

View File

@ -87,7 +87,7 @@ namespace Compression.BSA
foreach (var entry in _entries)
{
var bytes = Encoding.UTF7.GetBytes(entry.FullName);
var bytes = Encoding.UTF8.GetBytes(entry.FullName);
bw.Write((ushort)bytes.Length);
await bw.BaseStream.WriteAsync(bytes, 0, bytes.Length);
}

View File

@ -94,7 +94,7 @@ namespace Compression.BSA
{
_rdr.BaseStream.Seek((long) _nameTableOffset, SeekOrigin.Begin);
foreach (var file in files)
file.FullPath = Encoding.UTF7.GetString(_rdr.ReadBytes(_rdr.ReadInt16()));
file.FullPath = Encoding.UTF8.GetString(_rdr.ReadBytes(_rdr.ReadInt16()));
}
Files = files;

View File

@ -1,4 +1,5 @@
using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Wabbajack.Common;
@ -22,5 +23,13 @@ namespace Compression.BSA
return new BA2Reader(filename);
throw new InvalidDataException("Filename is not a .bsa or .ba2, magic " + fourcc);
}
private static HashSet<string> MagicStrings = new HashSet<string> {TES3Reader.TES3_MAGIC, "BSA\0", "BTDX"};
public static bool MightBeBSA(AbsolutePath filename)
{
using var file = filename.OpenRead();
var fourcc = Encoding.ASCII.GetString(new BinaryReader(file).ReadBytes(4));
return MagicStrings.Contains(fourcc);
}
}
}

View File

@ -550,6 +550,9 @@ namespace Wabbajack.Lib
// Ignore the ModOrganizer.ini file it contains info created by MO2 on startup
new IncludeStubbedConfigFiles(this),
new IncludeLootFiles(this),
new IgnoreStartsWith(this, Path.Combine((string)Consts.GameFolderFilesDir, "Data")),
new IgnoreStartsWith(this, Path.Combine((string)Consts.GameFolderFilesDir, "Papyrus Compiler")),
new IgnoreStartsWith(this, Path.Combine((string)Consts.GameFolderFilesDir, "Skyrim")),
new IgnoreRegex(this, Consts.GameFolderFilesDir + "\\\\.*\\.bsa"),
new IncludeRegex(this, "^[^\\\\]*\\.bat$"),
new IncludeModIniData(this),

View File

@ -22,7 +22,7 @@ namespace Wabbajack.VirtualFileSystem
{
try
{
if (Consts.SupportedBSAs.Contains(source.Extension))
if (BSADispatch.MightBeBSA(source))
return await ExtractAllWithBSA(queue, source);
else if (source.Extension == Consts.OMOD)
return await ExtractAllWithOMOD(source);