Skip to content

Commit

Permalink
Added casclib
Browse files Browse the repository at this point in the history
  • Loading branch information
maxemann96 committed Aug 30, 2018
1 parent b9ebf69 commit 9ccfccd
Show file tree
Hide file tree
Showing 103 changed files with 43,275 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CascLib/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.bat text eol=crlf
*.sln text eol=crlf
*.vcproj text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
50 changes: 50 additions & 0 deletions CascLib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# CMake related files
/CMakeFiles/
/CMakeCache.txt
/*.cmake
/Makefile
/CMakeScripts/

# Visual Studio related files
*.opensdf
*.ncb
*.sdf
*.suo
*.vcxproj.user
*.db
*.opendb
.vs/

# Xcode related files
*.xcodeproj

# KDevelop related files
*.kdev4

# Intermediate directory
/casc.dir/
/Win32/
/Debug/
bin/
153 changes: 153 additions & 0 deletions CascLib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
cmake_minimum_required(VERSION 2.6)
project(CascLib)

set(HEADER_FILES
src/CascCommon.h
src/CascLib.h
src/CascPort.h
src/common/Array.h
src/common/Common.h
src/common/Csv.h
src/common/FileStream.h
src/common/FileTree.h
src/common/ListFile.h
src/common/Map.h
src/jenkins/lookup.h
)

set(SRC_FILES
src/common/Common.cpp
src/common/Directory.cpp
src/common/Csv.cpp
src/common/FileStream.cpp
src/common/FileTree.cpp
src/common/ListFile.cpp
src/common/Map.cpp
src/common/RootHandler.cpp
src/jenkins/lookup3.c
src/CascCommon.cpp
src/CascDecompress.cpp
src/CascDecrypt.cpp
src/CascDumpData.cpp
src/CascFiles.cpp
src/CascFindFile.cpp
src/CascOpenFile.cpp
src/CascOpenStorage.cpp
src/CascReadFile.cpp
src/CascRootFile_Diablo3.cpp
src/CascRootFile_MNDX.cpp
src/CascRootFile_Text.cpp
src/CascRootFile_TVFS.cpp
src/CascRootFile_OW.cpp
src/CascRootFile_WoW6.cpp
)

set(TOMCRYPT_FILES
src/libtomcrypt/src/hashes/hash_memory.c
src/libtomcrypt/src/hashes/md5.c
src/libtomcrypt/src/misc/crypt_argchk.c
src/libtomcrypt/src/misc/crypt_hash_descriptor.c
src/libtomcrypt/src/misc/crypt_hash_is_valid.c
src/libtomcrypt/src/misc/crypt_libc.c
)

set(ZLIB_FILES
src/zlib/adler32.c
src/zlib/crc32.c
src/zlib/inffast.c
src/zlib/inflate.c
src/zlib/inftrees.c
src/zlib/zutil.c
)

set(TEST_SRC_FILES
test/CascTest.cpp
)

add_definitions(-D_7ZIP_ST -DBZ_STRICT_ANSI)

if(WIN32)
if(MSVC)
message(STATUS "Using MSVC")
add_definitions(-D_7ZIP_ST)
else()
message(STATUS "Using mingw")
endif()
set(SRC_ADDITIONAL_FILES ${ZLIB_FILES} ${TOMCRYPT_FILES})
set(LINK_LIBS wininet)
endif()

if(APPLE)
message(STATUS "Using Mac OS X port")
set(LINK_LIBS z bz2)
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES})
endif()

if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
message(STATUS "Using Linux port")
option(WITH_LIBTOMCRYPT "Use system LibTomCrypt library" OFF)
if(WITH_LIBTOMCRYPT)
set(LINK_LIBS tomcrypt)
else()
set(LINK_LIBS)
set(SRC_ADDITIONAL_FILES ${ZLIB_FILES} ${TOMCRYPT_FILES})
endif()
endif()

option(CASC_BUILD_SHARED_LIB "Compile dynamically linked library" ON)
if(CASC_BUILD_SHARED_LIB)
message(STATUS "Build dynamically linked library")
add_library(casc SHARED ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(casc ${LINK_LIBS})
install(TARGETS casc RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
# On Win32, build CascLib.dll
if(WIN32)
set_target_properties(casc PROPERTIES OUTPUT_NAME CascLib)
endif()


if(APPLE)
set_target_properties(casc PROPERTIES FRAMEWORK true)
set_target_properties(casc PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
set_target_properties(casc PROPERTIES LINK_FLAGS "-framework Carbon")
endif()

if(UNIX)
set_target_properties(casc PROPERTIES VERSION 1.0.0)
set_target_properties(casc PROPERTIES SOVERSION 1)
endif()

endif()

option(CASC_BUILD_TESTS "Build Test application" OFF)
if(CASC_BUILD_TESTS)
set(CASC_BUILD_STATIC_LIB ON CACHE BOOL "Force Static library building to link test app")
message(STATUS "Build Test application")
add_executable(casc_test ${TEST_SRC_FILES})
target_link_libraries(casc_test casc_static)
install(TARGETS casc_test RUNTIME DESTINATION bin)
endif()

option(CASC_BUILD_STATIC_LIB "Build static linked library" OFF)
if(CASC_BUILD_STATIC_LIB)
message(STATUS "Build static linked library")
add_library(casc_static STATIC ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(casc_static ${LINK_LIBS})
set_target_properties(casc_static PROPERTIES OUTPUT_NAME casc)
install(TARGETS casc_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)

if(APPLE)
set_target_properties(casc_static PROPERTIES FRAMEWORK true)
set_target_properties(casc_static PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
set_target_properties(casc_static PROPERTIES LINK_FLAGS "-framework Carbon")
endif()

if(UNIX)
set_target_properties(casc_static PROPERTIES VERSION 1.0.0)
set_target_properties(casc_static PROPERTIES SOVERSION 1)
endif()

endif()


install(FILES src/CascLib.h src/CascPort.h DESTINATION include)
24 changes: 24 additions & 0 deletions CascLib/CascLib.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@echo off
rem Post-build batch for CascLib project
rem Called as CascLib.bat $(PlatformName) $(ConfigurationName)
rem Example: CascLib.bat x64 Debug

if not exist ..\aaa goto exit

copy src\CascPort.h ..\aaa\inc
copy src\CascLib.h ..\aaa\inc

if x%1 == xWin32 goto PlatformWin32
if x%1 == xx64 goto PlatformWin64
goto exit

:PlatformWin32
copy .\bin\CascLib\%1\%2\*.lib ..\aaa\lib32
goto exit

:PlatformWin64
copy .\bin\CascLib\%1\%2\*.lib ..\aaa\lib64
goto exit

:exit

139 changes: 139 additions & 0 deletions CascLib/CascLib_vs08.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CascLib", "CascLib_vs08.vcproj", "{78424708-1F6E-4D4B-920C-FB6D26847055}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CascLib_test", "CascLib_vs08_test.vcproj", "{9403EA00-98F8-4D02-80B0-65D9168B0CCC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CascLib_dll", "CascLib_vs08_dll.vcproj", "{CB385198-50B1-4CF4-883B-11F042DED6AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugAD|Win32 = DebugAD|Win32
DebugAD|x64 = DebugAD|x64
DebugAS|Win32 = DebugAS|Win32
DebugAS|x64 = DebugAS|x64
DebugUD|Win32 = DebugUD|Win32
DebugUD|x64 = DebugUD|x64
DebugUS|Win32 = DebugUS|Win32
DebugUS|x64 = DebugUS|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseAD|Win32 = ReleaseAD|Win32
ReleaseAD|x64 = ReleaseAD|x64
ReleaseAS|Win32 = ReleaseAS|Win32
ReleaseAS|x64 = ReleaseAS|x64
ReleaseUD|Win32 = ReleaseUD|Win32
ReleaseUD|x64 = ReleaseUD|x64
ReleaseUS|Win32 = ReleaseUS|Win32
ReleaseUS|x64 = ReleaseUS|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|Win32.ActiveCfg = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.ActiveCfg = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Debug|x64.Build.0 = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|Win32.ActiveCfg = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|Win32.Build.0 = DebugAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|x64.ActiveCfg = DebugAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAD|x64.Build.0 = DebugAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|Win32.ActiveCfg = DebugAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|Win32.Build.0 = DebugAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|x64.ActiveCfg = DebugAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugAS|x64.Build.0 = DebugAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUD|Win32.ActiveCfg = DebugUD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUD|Win32.Build.0 = DebugUD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUD|x64.ActiveCfg = DebugUD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUD|x64.Build.0 = DebugUD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUS|Win32.ActiveCfg = DebugUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUS|Win32.Build.0 = DebugUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUS|x64.ActiveCfg = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.DebugUS|x64.Build.0 = DebugUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|Win32.ActiveCfg = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.ActiveCfg = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.Release|x64.Build.0 = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|Win32.ActiveCfg = ReleaseAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|Win32.Build.0 = ReleaseAD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|x64.ActiveCfg = ReleaseAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAD|x64.Build.0 = ReleaseAD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|Win32.ActiveCfg = ReleaseAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|Win32.Build.0 = ReleaseAS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|x64.ActiveCfg = ReleaseAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseAS|x64.Build.0 = ReleaseAS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUD|Win32.ActiveCfg = ReleaseUD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUD|Win32.Build.0 = ReleaseUD|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUD|x64.ActiveCfg = ReleaseUD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUD|x64.Build.0 = ReleaseUD|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUS|Win32.ActiveCfg = ReleaseUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUS|Win32.Build.0 = ReleaseUS|Win32
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUS|x64.ActiveCfg = ReleaseUS|x64
{78424708-1F6E-4D4B-920C-FB6D26847055}.ReleaseUS|x64.Build.0 = ReleaseUS|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Debug|Win32.ActiveCfg = Debug|Win32
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Debug|Win32.Build.0 = Debug|Win32
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Debug|x64.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Debug|x64.Build.0 = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugAD|Win32.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugAD|x64.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugAD|x64.Build.0 = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugAS|Win32.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugAS|x64.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugAS|x64.Build.0 = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugUD|Win32.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugUD|x64.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugUD|x64.Build.0 = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugUS|Win32.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugUS|x64.ActiveCfg = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.DebugUS|x64.Build.0 = Debug|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Release|Win32.ActiveCfg = Release|Win32
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Release|Win32.Build.0 = Release|Win32
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Release|x64.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.Release|x64.Build.0 = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseAD|Win32.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseAD|x64.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseAD|x64.Build.0 = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseAS|Win32.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseAS|x64.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseAS|x64.Build.0 = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseUD|Win32.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseUD|x64.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseUD|x64.Build.0 = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseUS|Win32.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseUS|x64.ActiveCfg = Release|x64
{9403EA00-98F8-4D02-80B0-65D9168B0CCC}.ReleaseUS|x64.Build.0 = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Debug|Win32.ActiveCfg = Debug|Win32
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Debug|Win32.Build.0 = Debug|Win32
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Debug|x64.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Debug|x64.Build.0 = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugAD|Win32.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugAD|x64.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugAD|x64.Build.0 = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugAS|Win32.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugAS|x64.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugAS|x64.Build.0 = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugUD|Win32.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugUD|x64.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugUD|x64.Build.0 = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugUS|Win32.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugUS|x64.ActiveCfg = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.DebugUS|x64.Build.0 = Debug|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Release|Win32.ActiveCfg = Release|Win32
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Release|Win32.Build.0 = Release|Win32
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Release|x64.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.Release|x64.Build.0 = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseAD|Win32.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseAD|x64.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseAD|x64.Build.0 = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseAS|Win32.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseAS|x64.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseAS|x64.Build.0 = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseUD|Win32.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseUD|x64.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseUD|x64.Build.0 = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseUS|Win32.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseUS|x64.ActiveCfg = Release|x64
{CB385198-50B1-4CF4-883B-11F042DED6AA}.ReleaseUS|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Loading

0 comments on commit 9ccfccd

Please sign in to comment.