mirror of
https://github.com/ModOrganizer2/libbsarch.git
synced 2026-07-27 14:06:31 -07:00
Compare commits
1
Commits
reorganize
..
0.0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a88aab247 |
@@ -1,7 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = crlf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -529,5 +529,3 @@ healthchecksdb
|
||||
MigrationBackup/
|
||||
|
||||
# End of https://www.gitignore.io/api/qt,c++,cmake,delphi,qtcreator,visualstudio
|
||||
|
||||
**/build
|
||||
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
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(Qt6 COMPONENTS Core REQUIRED)
|
||||
|
||||
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(Qt6_FOUND)
|
||||
message("libbsarch: Qt6 found, enabling Qt support")
|
||||
target_link_libraries(libbsarch_OOP PUBLIC Qt::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)
|
||||
@@ -1,19 +0,0 @@
|
||||
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)
|
||||
@@ -1,7 +0,0 @@
|
||||
// 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
|
||||
@@ -1,118 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <dxgiformat.h>
|
||||
|
||||
#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);
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
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
|
||||
@@ -1,165 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{537F42AD-5B15-4671-B99E-2D1818999A98}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(DirectXTexPath)\DirectXTex;$(IncludePath)</IncludePath>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(DirectXTexPath)\DirectXTex;$(IncludePath)</IncludePath>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(DirectXTexPath)\DirectXTex;$(IncludePath)</IncludePath>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(DirectXTexPath)\DirectXTex;$(IncludePath)</IncludePath>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBBSARCH_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ModuleDefinitionFile>libbsarch.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<CustomBuildStep>
|
||||
<Command>xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)"</Command>
|
||||
<Message>Copying header file</Message>
|
||||
<Outputs>$(OutDir)libbsarch.h</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBBSARCH_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<ModuleDefinitionFile>libbsarch.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<CustomBuildStep>
|
||||
<Command>xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)"</Command>
|
||||
<Message>Copying header file</Message>
|
||||
<Outputs>$(OutDir)libbsarch.h</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ModuleDefinitionFile>libbsarch.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<CustomBuildStep>
|
||||
<Command>xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)"</Command>
|
||||
<Message>Copying header file</Message>
|
||||
<Outputs>$(OutDir)libbsarch.h</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<ModuleDefinitionFile>libbsarch.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<CustomBuildStep>
|
||||
<Command>xcopy /y "$(ProjectDir)libbsarch.h" "$(OutDir)"</Command>
|
||||
<Message>Copying header file</Message>
|
||||
<Outputs>$(OutDir)libbsarch.h</Outputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".vscode\ipch\c1c5ff332820ca89\mmap_address.bin" />
|
||||
<None Include="cpp.hint" />
|
||||
<None Include="libbsarch.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DDS.h" />
|
||||
<ClInclude Include="libbsarch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="libbsarch.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="libbsarch.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include=".vscode\ipch\c1c5ff332820ca89\mmap_address.bin">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="cpp.hint" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="DDS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libbsarch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="libbsarch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -234,11 +234,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function bsa_file_data_free(obj: Pointer; fileDataResult: TwbBSResultBuffer): TwbBSResultMessage; stdcall;
|
||||
function bsa_file_data_free(obj: Pointer; fileDataResult: TwbBSResultMessageBuffer): TwbBSResultMessage; stdcall;
|
||||
begin
|
||||
Result.code := Ord(BSA_RESULT_NONE);
|
||||
try
|
||||
TwbBSArchive(obj).ReleaseFileDataCompat(fileDataResult);
|
||||
TwbBSArchive(obj).ReleaseFileDataCompat(fileDataResult.buffer);
|
||||
except
|
||||
on E: Exception do
|
||||
exception_handler(E, Result);
|
||||
@@ -3,11 +3,11 @@
|
||||
<ProjectGuid>{381E4D59-4D34-46B3-B039-1B3C3ABEC58F}</ProjectGuid>
|
||||
<MainSource>libbsarch.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Config Condition="'$(Config)'==''">Release</Config>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Library</AppType>
|
||||
<FrameworkType>None</FrameworkType>
|
||||
<ProjectVersion>18.8</ProjectVersion>
|
||||
<ProjectVersion>18.6</ProjectVersion>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
@@ -69,21 +69,20 @@
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)</DCC_Namespace>
|
||||
<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)</DCC_UnitSearchPath>
|
||||
<DCC_UnitSearchPath>$(XEditPath);$(XEditPath)\lz4;$(XEditPath)\zlib;$(XEditPath)\Tools\BSArchive\TForge;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_Namespace>System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
@@ -92,15 +91,17 @@
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_ExeOutput>lib32\release\</DCC_ExeOutput>
|
||||
<DCC_ExeOutput>Win32\Release\</DCC_ExeOutput>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
<Debugger_HostApplication>Win32\Release\libbsarch-visualstudio-test.exe</Debugger_HostApplication>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
||||
<DCC_ExeOutput>lib64\release\</DCC_ExeOutput>
|
||||
<DCC_ExeOutput>X64\Release\</DCC_ExeOutput>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
<Debugger_HostApplication>X64\Release\libbsarch-visualstudio-test.exe</Debugger_HostApplication>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
@@ -110,14 +111,16 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||
<Debugger_HostApplication>Win32\Debug\libbsarch-visualstudio-test.exe</Debugger_HostApplication>
|
||||
<DCC_ExeOutput>lib32\debug\</DCC_ExeOutput>
|
||||
<DCC_ExeOutput>Win32\Debug\</DCC_ExeOutput>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<DCC_ExeOutput>lib64\debug\</DCC_ExeOutput>
|
||||
<Manifest_File>(None)</Manifest_File>
|
||||
<DCC_ExeOutput>X64\Debug\</DCC_ExeOutput>
|
||||
<Debugger_HostApplication>D:\Projects\libbsarch\x64\Debug\libbsarch-visualstudio-test.exe</Debugger_HostApplication>
|
||||
<Debugger_CWD>D:\Projects\libbsarch\x64\Debug</Debugger_CWD>
|
||||
</PropertyGroup>
|
||||
@@ -1,7 +1,15 @@
|
||||
{******************************************************************************
|
||||
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/.
|
||||
{*******************************************************************************
|
||||
|
||||
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.
|
||||
|
||||
*******************************************************************************}
|
||||
|
||||
unit wbBSArchive;
|
||||
@@ -1366,7 +1374,6 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
fStream := TwbWriteCachedFileStream.Create(aFilePath, fmCreate);
|
||||
fFileName := aFilePath;
|
||||
Include(fStates, stWriting);
|
||||
@@ -1528,6 +1535,8 @@ begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure TwbBSArchive.AddFileDisk(const aFilePath, aSourcePath: string);
|
||||
var
|
||||
fname: string;
|
||||
@@ -1900,13 +1909,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;
|
||||
@@ -1983,8 +1992,10 @@ 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
|
||||
@@ -1 +0,0 @@
|
||||
libbsarch.res
|
||||
@@ -1,45 +0,0 @@
|
||||
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)
|
||||
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user