diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c0acd85 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +end_of_line = crlf +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index 86ad221..84cf16a 100644 --- a/.gitignore +++ b/.gitignore @@ -529,3 +529,5 @@ healthchecksdb MigrationBackup/ # End of https://www.gitignore.io/api/qt,c++,cmake,delphi,qtcreator,visualstudio + +**/build diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 0189281..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,107 +0,0 @@ -cmake_minimum_required(VERSION 3.5..3.15) - -option(copy_dll_to_binary_dir "Will copy libbsarch DLL to the binary directory. May not work if libbsarch is used as a subproject" ON) - -# Project -project(libbsarch CXX) - -# Add library to build. -add_library(libbsarch SHARED - src/DDS.h - src/libbsarch.h - src/libbsarch.cpp - src/libbsarch.def - ) - -target_compile_features(libbsarch PRIVATE cxx_std_11) - -# Preprocessor definitions -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - if(MSVC) - target_compile_options(libbsarch PRIVATE /W3 /MDd /Od /EHsc) - endif() -endif() - -if(CMAKE_BUILD_TYPE STREQUAL "Release") - if(MSVC) - target_compile_options(libbsarch PRIVATE /W3 /Zi /EHsc) - endif() -endif() - -target_compile_definitions(libbsarch PRIVATE BSARCH_DLL_EXPORT) - -#We only want the lib file. The DLL will be provided by Delphi -#Removing the generated DLL -add_custom_command(TARGET libbsarch POST_BUILD - COMMAND ${CMAKE_COMMAND} -E remove - ${CMAKE_CURRENT_BINARY_DIR}/libbsarch.dll) - -############################################################ -# libbsarch_OOP # -############################################################ - -find_package(Qt5 OPTIONAL_COMPONENTS Core) - -add_library(libbsarch_OOP STATIC - src/base_types.hpp - src/bs_archive_auto.cpp - src/bs_archive_auto.hpp - src/bs_archive.cpp - src/bs_archive.h - src/bs_archive_entries.cpp - src/bs_archive_entries.h - src/dds.h - - src/libbsarch.hpp - src/libbsarch.h - src/dds.h - - src/utils/convertible_string.cpp - src/utils/convertible_string.hpp - src/utils/convertible_ostream.cpp - src/utils/convertible_ostream.hpp - src/utils/string_convert.cpp - src/utils/string_convert.hpp - ) - - -## Copying the corresponding DLL ## - -#Finding 32 or 64bits -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - # 64 bits - set(lib_delphi "${CMAKE_CURRENT_SOURCE_DIR}/delphi/lib64") - message("libbsarch: using 64bits DLL") -elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - # 32 bits - set(lib_delphi "${CMAKE_CURRENT_SOURCE_DIR}/delphi/lib") - message("libbsarch: using 32bits DLL") -endif() - -if(copy_dll_to_binary_dir) - #Finding debug or release - if(CMAKE_BUILD_TYPE MATCHES DEBUG) - set(libbsarch_dll_path "${lib_delphi}/libbsarchd.dll") - else() - set(libbsarch_dll_path "${lib_delphi}/libbsarch.dll") - endif() - - #Actually copying the DLL - add_custom_command(TARGET libbsarch POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${libbsarch_dll_path} - ${CMAKE_BINARY_DIR}/libbsarch.dll) - message("libbsarch: Copying the DLL to ${CMAKE_BINARY_DIR}/libbsarch.dll") -endif() - -#Adding Qt support -if(Qt5_FOUND) - message("libbsarch: Qt5 found, enabling Qt support") - target_link_libraries(libbsarch_OOP PUBLIC Qt5::Core) - target_compile_definitions(libbsarch PUBLIC "QT") - target_compile_definitions(libbsarch_OOP PUBLIC "QT") -endif() - -target_link_libraries(libbsarch_OOP PUBLIC libbsarch) -target_compile_features(libbsarch_OOP PRIVATE cxx_std_17) -target_compile_definitions(libbsarch_OOP PRIVATE _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING) diff --git a/src/base_types.hpp b/cpp/base_types.hpp similarity index 100% rename from src/base_types.hpp rename to cpp/base_types.hpp diff --git a/src/bs_archive.cpp b/cpp/bs_archive.cpp similarity index 100% rename from src/bs_archive.cpp rename to cpp/bs_archive.cpp diff --git a/src/bs_archive.h b/cpp/bs_archive.h similarity index 100% rename from src/bs_archive.h rename to cpp/bs_archive.h diff --git a/src/bs_archive_auto.cpp b/cpp/bs_archive_auto.cpp similarity index 100% rename from src/bs_archive_auto.cpp rename to cpp/bs_archive_auto.cpp diff --git a/src/bs_archive_auto.hpp b/cpp/bs_archive_auto.hpp similarity index 100% rename from src/bs_archive_auto.hpp rename to cpp/bs_archive_auto.hpp diff --git a/src/bs_archive_entries.cpp b/cpp/bs_archive_entries.cpp similarity index 100% rename from src/bs_archive_entries.cpp rename to cpp/bs_archive_entries.cpp diff --git a/src/bs_archive_entries.h b/cpp/bs_archive_entries.h similarity index 100% rename from src/bs_archive_entries.h rename to cpp/bs_archive_entries.h diff --git a/src/libbsarch.hpp b/cpp/libbsarch.hpp similarity index 100% rename from src/libbsarch.hpp rename to cpp/libbsarch.hpp diff --git a/src/utils/convertible_ostream.cpp b/cpp/utils/convertible_ostream.cpp similarity index 100% rename from src/utils/convertible_ostream.cpp rename to cpp/utils/convertible_ostream.cpp diff --git a/src/utils/convertible_ostream.hpp b/cpp/utils/convertible_ostream.hpp similarity index 100% rename from src/utils/convertible_ostream.hpp rename to cpp/utils/convertible_ostream.hpp diff --git a/src/utils/convertible_string.cpp b/cpp/utils/convertible_string.cpp similarity index 100% rename from src/utils/convertible_string.cpp rename to cpp/utils/convertible_string.cpp diff --git a/src/utils/convertible_string.hpp b/cpp/utils/convertible_string.hpp similarity index 100% rename from src/utils/convertible_string.hpp rename to cpp/utils/convertible_string.hpp diff --git a/src/utils/string_convert.cpp b/cpp/utils/string_convert.cpp similarity index 100% rename from src/utils/string_convert.cpp rename to cpp/utils/string_convert.cpp diff --git a/src/utils/string_convert.hpp b/cpp/utils/string_convert.hpp similarity index 100% rename from src/utils/string_convert.hpp rename to cpp/utils/string_convert.hpp diff --git a/cpp_lib/CMakeLists.txt b/cpp_lib/CMakeLists.txt new file mode 100644 index 0000000..3ff12ec --- /dev/null +++ b/cpp_lib/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.17) + +project("libbsarch-c99") + +include(CTest) +enable_testing() + +add_library(${PROJECT_NAME} INTERFACE) + +add_subdirectory(../delphi .) + +target_include_directories(${PROJECT_NAME} INTERFACE .) + +target_link_libraries(${PROJECT_NAME} INTERFACE "libbsarch-delphi") + +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) + +include(CPack) diff --git a/cpp_lib/cpp.hint b/cpp_lib/cpp.hint new file mode 100644 index 0000000..460536c --- /dev/null +++ b/cpp_lib/cpp.hint @@ -0,0 +1,7 @@ +// Hint files help the Visual Studio IDE interpret Visual C++ identifiers +// such as names of functions and macros. +// For more information see https://go.microsoft.com/fwlink/?linkid=865984 +#define PACKED(datastructure) datastructure __attribute__((__packed__)) +#define PACKED(datastructure) __pragma(pack(push, 1)) datastructure __pragma(pack(pop)) +#define BSARCH_DLL_API(ReturnType) extern "C" __declspec(dllexport) ReturnType __stdcall +#define BSARCH_DLL_API(ReturnType) extern "C" __declspec(dllimport) ReturnType __stdcall diff --git a/src/dds.h b/cpp_lib/dds.h similarity index 100% rename from src/dds.h rename to cpp_lib/dds.h diff --git a/src/libbsarch.cpp b/cpp_lib/libbsarch.cpp similarity index 94% rename from src/libbsarch.cpp rename to cpp_lib/libbsarch.cpp index ed8f984..9cab580 100644 --- a/src/libbsarch.cpp +++ b/cpp_lib/libbsarch.cpp @@ -1,7 +1,8 @@ -#ifdef BSARCH_DLL_EXPORT -#include "libbsarch.h" +#ifndef BSARCH_DLL_EXPORT +#define BSARCH_DLL_EXPORT 1 +#endif -namespace libbsarch { +#include "libbsarch.h" BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create() { return NULL; @@ -19,7 +20,7 @@ BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_l return { 0 }; } -BSARCH_DLL_API(uint32_t) bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, wchar_t *string_buffer) { +BSARCH_DLL_API(uint32_t) bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, const wchar_t *string_buffer) { return 0; } @@ -95,7 +96,7 @@ BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive) { return { 0 }; } -BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) { +BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, const wchar_t *string_buffer) { return 0; } @@ -107,7 +108,7 @@ BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive) { return 0; } -BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer) { +BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, const wchar_t *string_buffer) { return 0; } @@ -150,5 +151,3 @@ BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags) { BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context) { return; } -} -#endif diff --git a/src/libbsarch.def b/cpp_lib/libbsarch.def similarity index 100% rename from src/libbsarch.def rename to cpp_lib/libbsarch.def diff --git a/cpp_lib/libbsarch.h b/cpp_lib/libbsarch.h new file mode 100644 index 0000000..e079690 --- /dev/null +++ b/cpp_lib/libbsarch.h @@ -0,0 +1,118 @@ +#pragma once + +#include + +#include + +#include "DDS.h" + +#ifdef BSARCH_DLL_EXPORT +#define BSARCH_DLL_API(ReturnType) extern "C" __declspec(dllexport) ReturnType __stdcall +#else +#define BSARCH_DLL_API(ReturnType) extern "C" __declspec(dllimport) ReturnType __stdcall +#endif + +#ifdef __GNUC__ +#define PACKED(datastructure) datastructure __attribute__((__packed__)) +#else +#define PACKED(datastructure) __pragma(pack(push, 1)) datastructure __pragma(pack(pop)) +#endif + +typedef enum bsa_result_code_e { + BSA_RESULT_NONE = 0, + BSA_RESULT_EXCEPTION = -1 +} bsa_result_code_t; + +typedef void* bsa_buffer_t; +typedef void* bsa_archive_t; +typedef void* bsa_entry_list_t; +typedef void* bsa_file_record_t; +typedef void* bsa_folder_record_t; + +typedef struct bsa_dds_info_s { + uint32_t width, height, mipmaps; +} bsa_dds_info_t; + +PACKED ( +struct bsa_dds_header_s { + uint32_t magic; // DDS_MAGIC + struct DirectX::DDS_HEADER header; +}); + +typedef struct bsa_dds_header_s bsa_dds_header_t; + +PACKED ( +struct bsa_result_message_s { + int8_t code; // bsa_result_code_t + wchar_t text[1024]; +}); + +typedef struct bsa_result_message_s bsa_result_message_t; + +PACKED ( +struct bsa_result_buffer_s { + uint32_t size; + bsa_buffer_t data; +}); + +typedef struct bsa_result_buffer_s bsa_result_buffer_t; + +PACKED ( +struct bsa_result_message_buffer_s { + bsa_result_buffer_t buffer; + bsa_result_message_t message; +}); + +typedef struct bsa_result_message_buffer_s bsa_result_message_buffer_t; + +typedef enum bsa_archive_state_e { + stReading, stWriting +} bsa_archive_state_t; + +typedef enum bsa_archive_type_e { + baNone, baTES3, baTES4, baFO3, baSSE, baFO4, baFO4dds +} bsa_archive_type_t; + +typedef void (*bsa_file_dds_info_proc_t)(bsa_archive_t archive, const wchar_t *file_path, bsa_dds_info_t *dds_info, void *context); +typedef bool (*bsa_file_iteration_proc_t)(bsa_archive_t archive, const wchar_t *file_path, bsa_file_record_t file_record, bsa_folder_record_t folder_record, void *context); + +BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create(); +BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_free(bsa_entry_list_t entry_list); +BSARCH_DLL_API(uint32_t) bsa_entry_list_count(bsa_entry_list_t entry_list); +BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_list, const wchar_t *entry_string); +BSARCH_DLL_API(uint32_t) bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, const wchar_t *string_buffer); + +BSARCH_DLL_API(bsa_archive_t) bsa_create(); +BSARCH_DLL_API(bsa_result_message_t) bsa_free(bsa_archive_t archive); +BSARCH_DLL_API(bsa_result_message_t) bsa_load_from_file(bsa_archive_t archive, const wchar_t *file_path); +BSARCH_DLL_API(bsa_result_message_t) bsa_create_archive(bsa_archive_t archive, const wchar_t *file_path, bsa_archive_type_t archive_type, bsa_entry_list_t entry_list); +BSARCH_DLL_API(bsa_result_message_t) bsa_save(bsa_archive_t archive); +BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_disk(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *source_path); +BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_disk_root(bsa_archive_t archive, const wchar_t *root_dir, const wchar_t *source_path); +BSARCH_DLL_API(bsa_result_message_t) bsa_add_file_from_memory(bsa_archive_t archive, const wchar_t *file_path, uint32_t size, bsa_buffer_t data); +BSARCH_DLL_API(bsa_file_record_t) bsa_find_file_record(bsa_archive_t archive, const wchar_t *file_path); +BSARCH_DLL_API(bsa_result_message_buffer_t) bsa_extract_file_data_by_record(bsa_archive_t archive, bsa_file_record_t file_record); +BSARCH_DLL_API(bsa_result_message_buffer_t) bsa_extract_file_data_by_filename(bsa_archive_t archive, const wchar_t *file_path); +BSARCH_DLL_API(bsa_result_message_t) bsa_file_data_free(bsa_archive_t archive, bsa_result_buffer_t file_data_result); +BSARCH_DLL_API(bsa_result_message_t) bsa_extract_file(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *save_as); +BSARCH_DLL_API(bsa_result_message_t) bsa_iterate_files(bsa_archive_t archive, bsa_file_iteration_proc_t file_iteration_proc, void *context); +BSARCH_DLL_API(bool) bsa_file_exists(bsa_archive_t archive, const wchar_t *file_path); +BSARCH_DLL_API(bsa_result_message_t) bsa_get_resource_list(bsa_archive_t archive, bsa_entry_list_t entry_result_list, const wchar_t *folder); +BSARCH_DLL_API(bsa_result_message_t) bsa_resolve_hash(bsa_archive_t archive, uint64_t hash, bsa_entry_list_t entry_result_list); +BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive); + +BSARCH_DLL_API(uint32_t) bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, const wchar_t *string_buffer); +BSARCH_DLL_API(bsa_archive_type_t) bsa_archive_type_get(bsa_archive_t archive); +BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive); +BSARCH_DLL_API(uint32_t) bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, const wchar_t *string_buffer); +BSARCH_DLL_API(uint32_t) bsa_file_count_get(bsa_archive_t archive); +BSARCH_DLL_API(uint32_t) bsa_archive_flags_get(bsa_archive_t archive); +BSARCH_DLL_API(void) bsa_archive_flags_set(bsa_archive_t archive, uint32_t flags); +BSARCH_DLL_API(uint32_t) bsa_file_flags_get(bsa_archive_t archive); +BSARCH_DLL_API(void) bsa_file_flags_set(bsa_archive_t archive, uint32_t flags); +BSARCH_DLL_API(bool) bsa_compress_get(bsa_archive_t archive); +BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags); +BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive); +BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags); + +BSARCH_DLL_API(void) bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context); diff --git a/cpp_lib/libbsarch.sln b/cpp_lib/libbsarch.sln new file mode 100644 index 0000000..59cc737 --- /dev/null +++ b/cpp_lib/libbsarch.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.572 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbsarch", "libbsarch.vcxproj", "{537F42AD-5B15-4671-B99E-2D1818999A98}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {537F42AD-5B15-4671-B99E-2D1818999A98}.Debug|x64.ActiveCfg = Debug|x64 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Debug|x64.Build.0 = Debug|x64 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Debug|x86.ActiveCfg = Debug|Win32 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Debug|x86.Build.0 = Debug|Win32 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Release|x64.ActiveCfg = Release|x64 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Release|x64.Build.0 = Release|x64 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Release|x86.ActiveCfg = Release|Win32 + {537F42AD-5B15-4671-B99E-2D1818999A98}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {274A40A7-F42F-40A4-A8BD-2DA20258DB0A} + EndGlobalSection +EndGlobal diff --git a/cpp_lib/libbsarch.vcxproj b/cpp_lib/libbsarch.vcxproj new file mode 100644 index 0000000..756d747 --- /dev/null +++ b/cpp_lib/libbsarch.vcxproj @@ -0,0 +1,165 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {537F42AD-5B15-4671-B99E-2D1818999A98} + Win32Proj + 10.0 + + + + DynamicLibrary + true + v142 + + + DynamicLibrary + false + v142 + + + DynamicLibrary + true + v142 + + + DynamicLibrary + false + v142 + + + + + + + + + + + + + + + + + + + + + true + $(DirectXTexPath)\DirectXTex;$(IncludePath) + $(ProjectName) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + true + $(DirectXTexPath)\DirectXTex;$(IncludePath) + $(ProjectName) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + $(DirectXTexPath)\DirectXTex;$(IncludePath) + $(ProjectName) + + + $(DirectXTexPath)\DirectXTex;$(IncludePath) + $(ProjectName) + + + + WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBBSARCH_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + false + Windows + libbsarch.def + + + xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)" + Copying header file + $(OutDir)libbsarch.h + + + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBBSARCH_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + libbsarch.def + + + xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)" + Copying header file + $(OutDir)libbsarch.h + + + + + false + libbsarch.def + + + xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)" + Copying header file + $(OutDir)libbsarch.h + + + + + libbsarch.def + + + xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)" + Copying header file + $(OutDir)libbsarch.h + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cpp_lib/libbsarch.vcxproj.filters b/cpp_lib/libbsarch.vcxproj.filters new file mode 100644 index 0000000..912cd0d --- /dev/null +++ b/cpp_lib/libbsarch.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Resource Files + + + + + + Header Files + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/delphi/lib/libbsarch.dll b/delphi/lib/libbsarch.dll deleted file mode 100644 index c60183f..0000000 Binary files a/delphi/lib/libbsarch.dll and /dev/null differ diff --git a/delphi/lib/libbsarchd.dll b/delphi/lib/libbsarchd.dll deleted file mode 100644 index 3b6b094..0000000 Binary files a/delphi/lib/libbsarchd.dll and /dev/null differ diff --git a/delphi/lib64/libbsarch.dll b/delphi/lib64/libbsarch.dll deleted file mode 100644 index dae0d2d..0000000 Binary files a/delphi/lib64/libbsarch.dll and /dev/null differ diff --git a/delphi/lib64/libbsarchd.dll b/delphi/lib64/libbsarchd.dll deleted file mode 100644 index f034e75..0000000 Binary files a/delphi/lib64/libbsarchd.dll and /dev/null differ diff --git a/delphi_lib/.gitignore b/delphi_lib/.gitignore new file mode 100644 index 0000000..0ea3e1b --- /dev/null +++ b/delphi_lib/.gitignore @@ -0,0 +1 @@ +libbsarch.res \ No newline at end of file diff --git a/delphi_lib/CMakeLists.txt b/delphi_lib/CMakeLists.txt new file mode 100644 index 0000000..2d229bf --- /dev/null +++ b/delphi_lib/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.17) + +project("libbsarch-delphi" NONE) + +include(CTest) +enable_testing() + +add_library(${PROJECT_NAME} INTERFACE) + +# Finding 32 or 64 bits +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + # 64 bits + set(LIBBSARCH_DELPHI_DLL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib64) + message("Using 64 bits Delphi DLL") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) + # 32 bits + set(LIBBSARCH_DELPHI_DLL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib32) + message("Using 32 bits Delphi DLL") +endif() + +# Finding debug or release +if(CMAKE_BUILD_TYPE MATCHES DEBUG) + set(LIBBSARCH_DELPHI_DLL_PATH ${LIBBSARCH_DELPHI_DLL_DIR}/debug/libbsarch.dll) + message("Using debug Delphi DLL") +else() + set(LIBBSARCH_DELPHI_DLL_PATH ${LIBBSARCH_DELPHI_DLL_DIR}/release/libbsarch.dll) + message("Using release Delphi DLL") +endif() + +# Actually copying the DLL +add_custom_command( + COMMENT "Copying Delphi DLL" + DEPENDS ${LIBBSARCH_DELPHI_DLL_PATH} + OUTPUT ${CMAKE_BINARY_DIR}/libbsarch.dll + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBBSARCH_DELPHI_DLL_PATH} ${CMAKE_BINARY_DIR}/libbsarch.dll + ) + +add_custom_target("copy_delphi_dll" ALL DEPENDS ${CMAKE_BINARY_DIR}/libbsarch.dll) + +add_dependencies(${PROJECT_NAME} "copy_delphi_dll") + +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) + +include(CPack) \ No newline at end of file diff --git a/delphi_lib/lib32/debug/libbsarch.dll b/delphi_lib/lib32/debug/libbsarch.dll new file mode 100644 index 0000000..6890300 Binary files /dev/null and b/delphi_lib/lib32/debug/libbsarch.dll differ diff --git a/delphi_lib/lib32/release/libbsarch.dll b/delphi_lib/lib32/release/libbsarch.dll new file mode 100644 index 0000000..6d4ce84 Binary files /dev/null and b/delphi_lib/lib32/release/libbsarch.dll differ diff --git a/delphi_lib/lib64/debug/libbsarch.dll b/delphi_lib/lib64/debug/libbsarch.dll new file mode 100644 index 0000000..521bf6f Binary files /dev/null and b/delphi_lib/lib64/debug/libbsarch.dll differ diff --git a/delphi_lib/lib64/release/libbsarch.dll b/delphi_lib/lib64/release/libbsarch.dll new file mode 100644 index 0000000..396873d Binary files /dev/null and b/delphi_lib/lib64/release/libbsarch.dll differ diff --git a/delphi/libbsarch.dpr b/delphi_lib/libbsarch.dpr similarity index 98% rename from delphi/libbsarch.dpr rename to delphi_lib/libbsarch.dpr index 00de1c2..d34bb2e 100644 --- a/delphi/libbsarch.dpr +++ b/delphi_lib/libbsarch.dpr @@ -234,11 +234,11 @@ begin end; end; -function bsa_file_data_free(obj: Pointer; fileDataResult: TwbBSResultMessageBuffer): TwbBSResultMessage; stdcall; +function bsa_file_data_free(obj: Pointer; fileDataResult: TwbBSResultBuffer): TwbBSResultMessage; stdcall; begin Result.code := Ord(BSA_RESULT_NONE); try - TwbBSArchive(obj).ReleaseFileDataCompat(fileDataResult.buffer); + TwbBSArchive(obj).ReleaseFileDataCompat(fileDataResult); except on E: Exception do exception_handler(E, Result); diff --git a/delphi/libbsarch.dproj b/delphi_lib/libbsarch.dproj similarity index 93% rename from delphi/libbsarch.dproj rename to delphi_lib/libbsarch.dproj index 1c372f1..c26255f 100644 --- a/delphi/libbsarch.dproj +++ b/delphi_lib/libbsarch.dproj @@ -3,11 +3,11 @@ {381E4D59-4D34-46B3-B039-1B3C3ABEC58F} libbsarch.dpr True - Release + Debug 3 Library None - 18.6 + 18.8 Win64 @@ -69,20 +69,21 @@ 1033 CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName= System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace) - $(XEditPath);$(XEditPath)\lz4;$(XEditPath)\zlib;$(XEditPath)\Tools\BSArchive\TForge;$(DCC_UnitSearchPath) + $(XEditPath);$(XEditPath)\lz4;$(XEditPath)\zlib;$(XEditPath)\Tools\BSArchive\TForge;$(XEditPath)\Core;$(XEditPath)\External\ZLibEx;$(XEditPath)\External\lz4\lib\delphi;$(XEditPath)\External\TForge\Source\Include;$(XEditPath)\External\TForge\Source\Shared;$(XEditPath)\External\TForge\Source\Engine\Forge;$(XEditPath)\External\TForge\Source\Engine\Hashes;$(DCC_UnitSearchPath) System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) - 1033 + (None) System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) Debug true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + (None) RELEASE;$(DCC_Define) @@ -91,17 +92,15 @@ 0 - Win32\Release\ + lib32\release\ true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) - (None) Win32\Release\libbsarch-visualstudio-test.exe - X64\Release\ + lib64\release\ true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - (None) X64\Release\libbsarch-visualstudio-test.exe @@ -111,16 +110,14 @@ Win32\Debug\libbsarch-visualstudio-test.exe - Win32\Debug\ + lib32\debug\ true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) - (None) true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - (None) - X64\Debug\ + lib64\debug\ D:\Projects\libbsarch\x64\Debug\libbsarch-visualstudio-test.exe D:\Projects\libbsarch\x64\Debug diff --git a/delphi/wbBSArchive.pas b/delphi_lib/wbBSArchive.pas similarity index 99% rename from delphi/wbBSArchive.pas rename to delphi_lib/wbBSArchive.pas index 4bc0fcb..4d0b711 100644 --- a/delphi/wbBSArchive.pas +++ b/delphi_lib/wbBSArchive.pas @@ -1,15 +1,7 @@ -{******************************************************************************* - - The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - +{****************************************************************************** + This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain + one at https://mozilla.org/MPL/2.0/. *******************************************************************************} unit wbBSArchive; @@ -1374,6 +1366,7 @@ begin end; + fStream := TwbWriteCachedFileStream.Create(aFilePath, fmCreate); fFileName := aFilePath; Include(fStates, stWriting); @@ -1535,8 +1528,6 @@ begin Close; end; - - procedure TwbBSArchive.AddFileDisk(const aFilePath, aSourcePath: string); var fname: string; @@ -1909,13 +1900,13 @@ begin Result.size := FileTES3.Size; // Modified: Make sure memory is zeroed when allocated Result.data := AllocMem(FileTES3.Size); + fStream.ReadBuffer(Result.data[0], Result.size); end; baTES4, baFO3, baSSE: begin FileTES4 := aFileRecord; fStream.Position := FileTES4.Offset; size := FileTES4.Size; - bCompressed := size and FILE_SIZE_COMPRESS <> 0; if bCompressed then size := size and not FILE_SIZE_COMPRESS; @@ -1992,10 +1983,8 @@ begin FileFO4 := aFileRecord; TexSize := SizeOf(TDDSHeader); - for i := Low(FileFO4.TexChunks) to High(FileFO4.TexChunks) do Inc(TexSize, FileFO4.TexChunks[i].Size); - Result.size := Texsize; // Modified: Make sure memory is zeroed when allocated diff --git a/examples/CmakeLists.txt b/examples/CmakeLists.txt new file mode 100644 index 0000000..a5d0e92 --- /dev/null +++ b/examples/CmakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.17) + +project("libbsarch-examples") + +include(CTest) +enable_testing() + +add_subdirectory(../c99 .) + +add_executable("${PROJECT_NAME}-read-write" libbsarch-read-write.cpp) + +set_target_properties("${PROJECT_NAME}-read-write" PROPERTIES OUTPUT_NAME "libbsarch-read-write") + +target_link_libraries("${PROJECT_NAME}-read-write" PRIVATE "libbsarch-c99") + +add_dependencies(${PROJECT_NAME} "${PROJECT_NAME}-read-write") + +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) + +include(CPack) diff --git a/examples/libbsarch-visualstudio-test.cpp b/examples/libbsarch-read-write.cpp similarity index 100% rename from examples/libbsarch-visualstudio-test.cpp rename to examples/libbsarch-read-write.cpp diff --git a/examples/libbsarch-visualstudio-test.sln b/examples/libbsarch-read-write.sln similarity index 88% rename from examples/libbsarch-visualstudio-test.sln rename to examples/libbsarch-read-write.sln index 8f105e4..cf62585 100644 --- a/examples/libbsarch-visualstudio-test.sln +++ b/examples/libbsarch-read-write.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.156 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbsarch-visualstudio-test", "libbsarch-visualstudio-test.vcxproj", "{8F73F848-939D-4862-B58B-26572CF20A5F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbsarch-read-write", "libbsarch-read-write.vcxproj", "{8F73F848-939D-4862-B58B-26572CF20A5F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/examples/libbsarch-read-write.vcxproj b/examples/libbsarch-read-write.vcxproj new file mode 100644 index 0000000..e4ff607 --- /dev/null +++ b/examples/libbsarch-read-write.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {8F73F848-939D-4862-B58B-26572CF20A5F} + Win32Proj + libbsarchreadwrite + 10.0 + libbsarch-read-write + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(OutDir);$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(OutDir);$(ReferencePath) + + + true + $(OutDir);$(LibraryPath) + $(OutDir);$(ReferencePath) + + + false + $(OutDir);$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(OutDir);$(ReferencePath) + + + false + $(OutDir);$(LibraryPath) + $(OutDir);$(ReferencePath) + + + + + + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + $(OutDir) + + + + + + + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + $(OutDir) + + + + + + + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + $(OutDir) + + + + + + + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + $(OutDir) + + + + + + + + + diff --git a/examples/libbsarch-read-write.vcxproj.filters b/examples/libbsarch-read-write.vcxproj.filters new file mode 100644 index 0000000..ea01c0b --- /dev/null +++ b/examples/libbsarch-read-write.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + diff --git a/src/libbsarch.h b/src/libbsarch.h deleted file mode 100644 index f69ffaa..0000000 --- a/src/libbsarch.h +++ /dev/null @@ -1,147 +0,0 @@ -#pragma once - -#include "dds.h" -#include -#include - -#ifdef BSARCH_DLL_EXPORT -#define BSARCH_DLL_API(ReturnType) extern "C" __declspec(dllexport) ReturnType __stdcall -#else -#define BSARCH_DLL_API(ReturnType) extern "C" __declspec(dllimport) ReturnType __stdcall -#endif - -#ifdef __GNUC__ -#define PACKED(datastructure) datastructure __attribute__((__packed__)) -#else -#define PACKED(datastructure) __pragma(pack(push, 1)) datastructure __pragma(pack(pop)) -#endif - -typedef enum bsa_result_code_e -{ - BSA_RESULT_NONE = 0, - BSA_RESULT_EXCEPTION = -1 -} bsa_result_code_t; - -typedef void *bsa_buffer_t; -typedef void *bsa_archive_t; -typedef void *bsa_entry_list_t; -typedef void *bsa_file_record_t; -typedef void *bsa_folder_record_t; - -typedef struct bsa_dds_info_s -{ - uint32_t width, height, mipmaps; -} bsa_dds_info_t; - -PACKED(struct bsa_dds_header_s { - uint32_t magic; // DDS_MAGIC - struct DirectX::DDS_HEADER header; -}); - -typedef struct bsa_dds_header_s bsa_dds_header_t; - -PACKED(struct bsa_result_message_s { - int8_t code; // bsa_result_code_t - wchar_t text[1024]; -}); - -typedef struct bsa_result_message_s bsa_result_message_t; - -PACKED(struct bsa_result_buffer_s { - uint32_t size; - bsa_buffer_t data; -}); - -typedef struct bsa_result_buffer_s bsa_result_buffer_t; - -PACKED(struct bsa_result_message_buffer_s { - bsa_result_buffer_t buffer; - bsa_result_message_t message; -}); - -typedef struct bsa_result_message_buffer_s bsa_result_message_buffer_t; - -typedef enum bsa_archive_state_e -{ - stReading, - stWriting -} bsa_archive_state_t; - -typedef enum bsa_archive_type_e -{ - baNone, - baTES3, - baTES4, - baFO3, - baSSE, - baFO4, - baFO4dds -} bsa_archive_type_t; - -typedef void (*bsa_file_dds_info_proc_t)(bsa_archive_t archive, - const wchar_t *file_path, - bsa_dds_info_t *dds_info, - void *context); -typedef bool (*bsa_file_iteration_proc_t)(bsa_archive_t archive, - const wchar_t *file_path, - bsa_file_record_t file_record, - bsa_folder_record_t folder_record, - void *context); - -BSARCH_DLL_API(bsa_entry_list_t) bsa_entry_list_create(); -BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_free(bsa_entry_list_t entry_list); -BSARCH_DLL_API(uint32_t) bsa_entry_list_count(bsa_entry_list_t entry_list); -BSARCH_DLL_API(bsa_result_message_t) bsa_entry_list_add(bsa_entry_list_t entry_list, const wchar_t *entry_string); -BSARCH_DLL_API(uint32_t) -bsa_entry_list_get(bsa_entry_list_t entry_list, uint32_t index, uint32_t string_buffer_size, wchar_t *string_buffer); - -BSARCH_DLL_API(bsa_archive_t) bsa_create(); -BSARCH_DLL_API(bsa_result_message_t) bsa_free(bsa_archive_t archive); -BSARCH_DLL_API(bsa_result_message_t) bsa_load_from_file(bsa_archive_t archive, const wchar_t *file_path); -BSARCH_DLL_API(bsa_result_message_t) -bsa_create_archive(bsa_archive_t archive, - const wchar_t *file_path, - bsa_archive_type_t _archivetype, - bsa_entry_list_t entry_list); -BSARCH_DLL_API(bsa_result_message_t) bsa_save(bsa_archive_t archive); -BSARCH_DLL_API(bsa_result_message_t) -bsa_add_file_from_disk(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *source_path); -BSARCH_DLL_API(bsa_result_message_t) -bsa_add_file_from_disk_root(bsa_archive_t archive, const wchar_t *root_dir, const wchar_t *source_path); -BSARCH_DLL_API(bsa_result_message_t) -bsa_add_file_from_memory(bsa_archive_t archive, const wchar_t *file_path, uint32_t size, bsa_buffer_t data); -BSARCH_DLL_API(bsa_file_record_t) bsa_find_file_record(bsa_archive_t archive, const wchar_t *file_path); -BSARCH_DLL_API(bsa_result_message_buffer_t) -bsa_extract_file_data_by_record(bsa_archive_t archive, bsa_file_record_t file_record); -BSARCH_DLL_API(bsa_result_message_buffer_t) -bsa_extract_file_data_by_filename(bsa_archive_t archive, const wchar_t *file_path); -BSARCH_DLL_API(bsa_result_message_t) bsa_file_data_free(bsa_archive_t archive, bsa_result_buffer_t file_data_result); -BSARCH_DLL_API(bsa_result_message_t) -bsa_extract_file(bsa_archive_t archive, const wchar_t *file_path, const wchar_t *save_as); -BSARCH_DLL_API(bsa_result_message_t) -bsa_iterate_files(bsa_archive_t archive, bsa_file_iteration_proc_t file_iteration_proc, void *context); -BSARCH_DLL_API(bool) bsa_file_exists(bsa_archive_t archive, const wchar_t *file_path); -BSARCH_DLL_API(bsa_result_message_t) -bsa_get_resource_list(bsa_archive_t archive, bsa_entry_list_t entry_result_list, const wchar_t *folder); -BSARCH_DLL_API(bsa_result_message_t) -bsa_resolve_hash(bsa_archive_t archive, uint64_t hash, bsa_entry_list_t entry_result_list); -BSARCH_DLL_API(bsa_result_message_t) bsa_close(bsa_archive_t archive); - -BSARCH_DLL_API(uint32_t) -bsa_filename_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer); -BSARCH_DLL_API(bsa_archive_type_t) bsa_archive_type_get(bsa_archive_t archive); -BSARCH_DLL_API(uint32_t) bsa_version_get(bsa_archive_t archive); -BSARCH_DLL_API(uint32_t) -bsa_format_name_get(bsa_archive_t archive, uint32_t string_buffer_size, wchar_t *string_buffer); -BSARCH_DLL_API(uint32_t) bsa_file_count_get(bsa_archive_t archive); -BSARCH_DLL_API(uint32_t) bsa_archive_flags_get(bsa_archive_t archive); -BSARCH_DLL_API(void) bsa_archive_flags_set(bsa_archive_t archive, uint32_t flags); -BSARCH_DLL_API(uint32_t) bsa_file_flags_get(bsa_archive_t archive); -BSARCH_DLL_API(void) bsa_file_flags_set(bsa_archive_t archive, uint32_t flags); -BSARCH_DLL_API(bool) bsa_compress_get(bsa_archive_t archive); -BSARCH_DLL_API(void) bsa_compress_set(bsa_archive_t archive, bool flags); -BSARCH_DLL_API(bool) bsa_share_data_get(bsa_archive_t archive); -BSARCH_DLL_API(void) bsa_share_data_set(bsa_archive_t archive, bool flags); - -BSARCH_DLL_API(void) -bsa_file_dds_info_callback_set(bsa_archive_t archive, bsa_file_dds_info_proc_t file_dds_info_proc, void *context);