Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text eol=crlf
*.h text eol=crlf
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build BSA Packer

on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]

env:
VCPKG_BINARY_SOURCES: clear;x-azblob,${{ vars.AZ_BLOB_VCPKG_URL }},${{ secrets.AZ_BLOB_SAS }},readwrite

jobs:
build:
runs-on: windows-2022
steps:
- name: Build BSA Packer
id: build-bsa-packer
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-dependencies: uibase
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-case-conflict
# - repo: https://github.com/pre-commit/mirrors-clang-format
# rev: v19.1.5
# hooks:
# - id: clang-format
# 'types_or': [c++, c]

ci:
autofix_commit_msg: "[pre-commit.ci] Auto fixes from pre-commit.com hooks."
autofix_prs: true
autoupdate_commit_msg: "[pre-commit.ci] Pre-commit autoupdate."
autoupdate_schedule: quarterly
submodules: false
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
cmake_minimum_required(VERSION 3.16)

if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()
set(MO2_CMAKE_DEPRECATED_UIBASE_INCLUDE ON)

project(bsa_packer)

add_subdirectory(src)

set(BSAPACKER_TESTS ${BSAPACKER_TESTS} CACHE BOOL "build tests for bsapacker plugin")
if(BSAPACKER_TESTS)
set(BUILD_TESTING ${BUILD_TESTING} CACHE BOOL "build tests for bsapacker plugin")
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
63 changes: 63 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"configurePresets": [
{
"errors": {
"deprecated": true
},
"hidden": true,
"name": "cmake-dev",
"warnings": {
"deprecated": true,
"dev": true
}
},
{
"cacheVariables": {
"VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
"type": "BOOL",
"value": "ON"
}
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"hidden": true,
"name": "vcpkg"
},
{
"cacheVariables": {
"VCPKG_MANIFEST_FEATURES": {
"type": "STRING",
"value": "testing"
}
},
"hidden": true,
"inherits": ["vcpkg"],
"name": "vcpkg-dev"
},
{
"binaryDir": "${sourceDir}/vsbuild",
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
}
},
"generator": "Visual Studio 17 2022",
"inherits": ["cmake-dev", "vcpkg-dev"],
"name": "vs2022-windows",
"toolset": "v143"
}
],
"buildPresets": [
{
"name": "vs2022-windows",
"resolvePackageReferences": "on",
"configurePreset": "vs2022-windows"
}
],
"version": 4
}
41 changes: 0 additions & 41 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/ArchiveAutoService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BsaPacker
{
bool ArchiveAutoService::CreateBSA(libbsarch::bs_archive_auto* archive, const QString& archiveName, const bsa_archive_type_e type) const
bool ArchiveAutoService::CreateBSA(libbsarch::bs_archive_auto* archive, const QString& archiveName, const bsa_archive_type_e) const
{
QProgressDialog savingDialog;
savingDialog.setWindowFlags(savingDialog.windowFlags() & ~Qt::WindowCloseButtonHint);
Expand Down
16 changes: 8 additions & 8 deletions src/ArchiveBuilderHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <bsapacker/ArchiveBuilderHelper.h>

#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <ranges>

#include "SettingsService.h"

Expand Down Expand Up @@ -61,13 +61,13 @@ namespace BsaPacker
bool ArchiveBuilderHelper::isExtensionBlacklisted(const path& filepath) const
{
const auto& setting = this->m_SettingsService->GetPluginSetting(SettingsService::SETTING_BLACKLISTED_FILES).toString().toStdString();
std::set<std::string> blacklist;
boost::split(blacklist, setting, [](char c){return c == ';';});

const auto& extension = filepath.extension().string();
const auto& count = blacklist.count(extension);
const auto& result = count > 0;
return result;
const auto &extension = filepath.extension().string();
const auto count = std::ranges::count(
setting | std::views::split(' '),
extension,
[](auto r)
{ return std::string_view(r.data(), r.size()); });
return count > 0;
}

bool ArchiveBuilderHelper::doesPathContainFiles(const path& filepath, const std::vector<path::string_type>& files) const
Expand Down
2 changes: 1 addition & 1 deletion src/ArchiveNameService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ namespace BsaPacker
}
return QString();
}
}
}
1 change: 0 additions & 1 deletion src/BSArchiveEntries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ bsa_entry_list_t BSArchiveEntries::getEntries() const
{
return _entries;
}

24 changes: 19 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
cmake_minimum_required(VERSION 3.16)

find_package(Qt6 COMPONENTS Concurrent)
find_path(BEXT_DI_INCLUDE_DIRS "boost/di.hpp")
find_package(mo2-cmake CONFIG REQUIRED)
find_package(mo2-uibase CONFIG REQUIRED)
find_package(mo2-libbsarch CONFIG REQUIRED)
find_package(mo2-dds-header CONFIG REQUIRED)
find_package(DirectXTex CONFIG REQUIRED)

add_library(bsa_packer SHARED)
mo2_configure_plugin(bsa_packer WARNINGS OFF
PRIVATE_DEPENDS boost Qt::Concurrent libbsarch)
mo2_configure_plugin(bsa_packer WARNINGS OFF)

target_include_directories(bsa_packer
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${BOOST_DI_ROOT}/include)
target_link_libraries(bsa_packer PUBLIC mo2::uibase Qt6::Concurrent mo2::libbsarch Microsoft::DirectXTex)
target_include_directories(bsa_packer PUBLIC ${BEXT_DI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(bsa_packer PRIVATE BSAPACKER_LIBRARY)

mo2_install_target(bsa_packer)
# need to deploy this here as MO2 does not depends on Qt6::Concurrent
install(FILES $<TARGET_FILE:Qt6::Concurrent> DESTINATION bin/dlls)

# this is done by modorganizer itself now
#
# install(FILES $<TARGET_FILE:mo2::libbsarch> DESTINATION bin/dlls)

mo2_install_plugin(bsa_packer)
1 change: 0 additions & 1 deletion src/DummyPluginServiceFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ namespace BsaPacker
return std::make_unique<NullDummyPluginService>();
}
} // namespace BsaPacker

2 changes: 1 addition & 1 deletion src/ModContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace BsaPacker
if (primarySource == "FalloutNV") { // TTW
return NexusId::NewVegas;
}
}
}
return nexusId;
}

Expand Down
1 change: 0 additions & 1 deletion src/NewVegasDummyPluginService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ namespace BsaPacker
sizeof(NewVegasDummyPluginService::RAW_NEWVEGAS));
}
}

2 changes: 1 addition & 1 deletion src/NullDummyPluginService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace BsaPacker
{
bool NullDummyPluginService::CreatePlugin(const QString& modPath, const QString& archiveNameBase) const
bool NullDummyPluginService::CreatePlugin([[maybe_unused]] const QString& modPath, [[maybe_unused]] const QString& archiveNameBase) const
{
return false;
}
Expand Down
1 change: 0 additions & 1 deletion src/OblivionDummyPluginService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ namespace BsaPacker
sizeof(OblivionDummyPluginService::RAW_OBLIVION));
}
}

4 changes: 2 additions & 2 deletions src/OverrideFileService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace BsaPacker {
res = false;
}
}

return res;
}
} // namespace BsaPacker
} // namespace BsaPacker
2 changes: 1 addition & 1 deletion src/OverrideFileService.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ namespace BsaPacker {
};
} // namespace BsaPacker

#endif // OVERRIDEFILESERVICE_H
#endif // OVERRIDEFILESERVICE_H
2 changes: 1 addition & 1 deletion src/TextureArchiveBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace BsaPacker
this->m_Cancelled = true;
}

void TextureArchiveBuilder::DDSCallback(bsa_archive_t archive, const wchar_t* file_path, bsa_dds_info_t* dds_info, void* context)
void TextureArchiveBuilder::DDSCallback(bsa_archive_t, const wchar_t* file_path, bsa_dds_info_t* dds_info, void* context)
{
const auto& path = *static_cast<std::wstring*>(context) + L'/' + std::wstring(file_path);

Expand Down
2 changes: 1 addition & 1 deletion src/bsa_packer.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
5 changes: 3 additions & 2 deletions src/bsa_packer_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@
</message>
<message>
<location filename="SettingsService.cpp" line="14"/>
<source>Specify a semi-colon seperated list of file extensions to ignore when packing.</source>
<source>Specify a semi-colon separated list of file extensions to ignore when packing.</source>
<oldsource>Specify a semi-colon seperated list of file extensions to ignore when packing.</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="SettingsService.cpp" line="15"/>
<source>Compress archives if they do not contain incompressible files.</source>
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
2 changes: 1 addition & 1 deletion src/bsapacker/ArchiveBuilderFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <bsapacker/IArchiveBuilder.h>
#include <bsapacker/IArchiveBuilderHelper.h>
#include <bsapacker/IModDto.h>
#include <libbsarch.h>
#include <libbsarch/libbsarch.h>

namespace BsaPacker
{
Expand Down
2 changes: 1 addition & 1 deletion src/bsapacker/IArchiveAutoService.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef IARCHIVEAUTOSERVICE_H
#define IARCHIVEAUTOSERVICE_H

#include <bs_archive_auto.hpp>
#include <libbsarch/bs_archive_auto.hpp>
#include <bsapacker/IModDto.h>

namespace BsaPacker
Expand Down
2 changes: 1 addition & 1 deletion src/bsapacker/IArchiveBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define IARCHIVEBUILDER_H

#include <bsapacker/IEmitsValueChanged.h>
#include <bs_archive_auto.hpp>
#include <libbsarch/bs_archive_auto.hpp>

namespace BsaPacker
{
Expand Down
2 changes: 1 addition & 1 deletion src/bsapacker/IOverrideFileService.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ namespace BsaPacker {
};
} // namespace BsaPacker

#endif // IOVERRIDEFILESERVICE_H
#endif // IOVERRIDEFILESERVICE_H
2 changes: 1 addition & 1 deletion src/bsapacker_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# define BSAPACKER_EXPORT Q_DECL_EXPORT
#else
# define BSAPACKER_EXPORT Q_DECL_IMPORT
#endif
#endif
2 changes: 1 addition & 1 deletion src/qlibbsarch/BSArchiveAuto.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QMap>

/*!
* \brief A convenience class for BSArchive and BSArchiveEntries. Its performance is worse than using these
* \brief A convenience class for BSArchive and BSArchiveEntries. Its performance is worse than using these
* two classes separately, but it removes the need to manually handle the BSArchiveEntries.
*/
class BSArchiveAuto
Expand Down
2 changes: 1 addition & 1 deletion src/qlibbsarch/QLibbsarch.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <libbsarch.h>
#include <libbsarch/libbsarch.h>
#include <string>
#include <stdexcept>
#include <QDebug>
Expand Down
Loading