Skip to content

Commit

Permalink
Fix BG3 multipart archive behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbyte committed Oct 13, 2020
1 parent 5d68a96 commit 3ceaf72
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,4 @@ DebuggerFrontend/Osidebug.cs
StoryCompiler/Debuginfo.cs
DebuggerFrontend/Debuginfo.cs
DebuggerFrontend/DbgProtocol.cs
WwiseTool
2 changes: 1 addition & 1 deletion ConverterApp/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ConverterApp/PackagePane.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 21 additions & 28 deletions ConverterApp/PackagePane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ private void extractPackageBtn_Click(object sender, EventArgs e)
}
}

private PackageVersion SelectedPackageVersion()
{
switch (packageVersion.SelectedIndex)
{
case 0: return PackageVersion.V15;
case 1: return PackageVersion.V13;
case 2: return PackageVersion.V10;
case 3: return PackageVersion.V9;
case 4: return PackageVersion.V7;
default: throw new InvalidDataException();
}
}

private void createPackageBtn_Click(object sender, EventArgs e)
{
createPackageBtn.Enabled = false;
Expand All @@ -101,34 +114,7 @@ private void createPackageBtn_Click(object sender, EventArgs e)
try
{
var options = new PackageCreationOptions();
switch (packageVersion.SelectedIndex)
{
case 0:
{
options.Version = PackageVersion.V15;
break;
}
case 1:
{
options.Version = PackageVersion.V13;
break;
}
case 2:
{
options.Version = PackageVersion.V10;
break;
}
case 3:
{
options.Version = PackageVersion.V9;
break;
}
case 4:
{
options.Version = PackageVersion.V7;
break;
}
}
options.Version = SelectedPackageVersion();

switch (compressionMethod.SelectedIndex)
{
Expand Down Expand Up @@ -272,5 +258,12 @@ public void SetGame(Game game)
break;
}
}

private void packageVersion_SelectedIndexChanged(object sender, EventArgs e)
{
var hasPackageFlags = SelectedPackageVersion() < PackageVersion.V15;
packagePriority.Enabled = hasPackageFlags;
solid.Enabled = hasPackageFlags;
}
}
}
2 changes: 1 addition & 1 deletion LSLib/LS/PackageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public PackagedFileInfo WriteFile(AbstractFileInfo info)
{
// Assume that all files are written uncompressed (worst-case) when calculating package sizes
long size = (long)info.Size();
if (_streams.Last().Position + size > MaxPackageSize)
if (Version < PackageVersion.V15 && _streams.Last().Position + size > MaxPackageSize)
{
// Start a new package file if the current one is full.
string partPath = Package.MakePartFilename(_path, _streams.Count);
Expand Down

0 comments on commit 3ceaf72

Please sign in to comment.