Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always compress baFO4dds and baSFdds archives and use completeBaseName for created archives. #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BsaPackerWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace BsaPacker
const QFileInfo fileInfo(this->m_ArchiveNameService->GetArchiveFullPath(type, modDto.get()));
bool res = this->m_ArchiveAutoService->CreateBSA(archive.get(), fileInfo.absoluteFilePath(), type);
if (res) {
createdArchives.append(fileInfo.baseName());
createdArchives.append(fileInfo.completeBaseName());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/SettingsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace BsaPacker
const QList<MOBase::PluginSetting>& SettingsService::PluginSettings = {
MOBase::PluginSetting(SettingsService::SETTING_HIDE_LOOSE_ASSETS, QObject::tr("After creating the archive, set loose assets to hidden."), false),
MOBase::PluginSetting(SettingsService::SETTING_CREATE_PLUGINS, QObject::tr("Create a dummy plugin to load the archive if one does not exist."), false),
MOBase::PluginSetting(SettingsService::SETTING_BLACKLISTED_FILES, QObject::tr("Specify a semi-colon seperated list of file extensions to ignore when packing."), ".txt;.hkx;.xml;.ini;.bk2"),
MOBase::PluginSetting(SettingsService::SETTING_COMPRESS_ARCHIVES, QObject::tr("Compress archives if they do not contain incompressible files."), true)
MOBase::PluginSetting(SettingsService::SETTING_BLACKLISTED_FILES, QObject::tr("Specify a semi-colon separated list of file extensions to ignore when packing."), ".txt;.hkx;.xml;.ini;.bk2"),
MOBase::PluginSetting(SettingsService::SETTING_COMPRESS_ARCHIVES, QObject::tr("Compress archives if they do not contain incompressible files. Texture archives for Fallout 4 and Starfield will always be compressed. Morrowind archives will never be compressed."), true)
//MOBase::PluginSetting(SettingsService::SETTING_SPLIT_ARCHIVES, QObject::tr("Automatically create multiple archives if they exceed the size limit."), false);
};

Expand Down
10 changes: 4 additions & 6 deletions src/TextureArchiveBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace BsaPacker

uint32_t TextureArchiveBuilder::setFiles()
{
uint32_t incompressibleFiles = 0;
uint32_t compressibleFiles = 0;
int count = 0;
qint64 currentSize = 0;
Expand Down Expand Up @@ -54,24 +53,23 @@ namespace BsaPacker
currentSize += fileInfo.size();
if (currentSize > SIZE_LIMIT) {
currentSize = fileInfo.size();
this->m_Archives.back()->set_compressed(!static_cast<bool>(incompressibleFiles));
this->m_Archives.back()->set_compressed(true);
this->m_Archives.back()->set_dds_callback(TextureArchiveBuilder::DDSCallback, this->getRootPath().toStdWString());
incompressibleFiles = 0;
compressibleFiles = 0;
this->m_Archives.emplace_back(std::make_unique<libbsarch::bs_archive_auto>(this->m_ArchiveType));
this->setShareData(true);
}

this->m_ArchiveBuilderHelper->isIncompressible(filepath.toStdWString()) ? ++incompressibleFiles : ++compressibleFiles;
++compressibleFiles;
auto fileBlob = disk_blob(
dirString,
filepath.toStdWString());
this->m_Archives.back()->add_file_from_disk(fileBlob);
qDebug() << "file is: " << filepath;
}
this->m_Archives.back()->set_compressed(!static_cast<bool>(incompressibleFiles));
this->m_Archives.back()->set_compressed(true);
this->m_Archives.back()->set_dds_callback(TextureArchiveBuilder::DDSCallback, this->getRootPath().toStdWString());
return incompressibleFiles + compressibleFiles;
return compressibleFiles;
}

void TextureArchiveBuilder::setShareData(const bool value)
Expand Down