Skip to content

Commit

Permalink
Update StormLib to v 8.20
Browse files Browse the repository at this point in the history
Signed-off-by: Salja <salja2012@hotmail.de>
  • Loading branch information
Salja committed Aug 1, 2012
1 parent c22e195 commit 6737128
Show file tree
Hide file tree
Showing 66 changed files with 28,027 additions and 5,564 deletions.
4 changes: 2 additions & 2 deletions contrib/extractor/System.cpp
Expand Up @@ -218,12 +218,12 @@ uint32 ReadBuild(int locale)
exit(1);
}

unsigned int data_size = SFileGetFileSize(fileHandle);
unsigned int data_size = SFileGetFileSize(fileHandle, NULL);

std::string text;
text.resize(data_size);

if (!SFileReadFile(fileHandle, &text[0], data_size))
if (!SFileReadFile(fileHandle, &text[0], data_size, NULL, NULL))
{
printf("Fatal error: Can't read %s file!\n", filename.c_str());
exit(1);
Expand Down
12 changes: 6 additions & 6 deletions contrib/extractor/dbcfile.cpp
Expand Up @@ -19,7 +19,7 @@ bool DBCFile::open()
char header[4];
unsigned int na,nb,es,ss;

if (!SFileReadFile(fileHandle, header, 4)) // Magic header
if (!SFileReadFile(fileHandle, header, 4, NULL, NULL)) // Magic header
{
SFileCloseFile(fileHandle);
return false;
Expand All @@ -31,25 +31,25 @@ bool DBCFile::open()
return false;
}

if (!SFileReadFile(fileHandle, &na, 4)) // Number of records
if (!SFileReadFile(fileHandle, &na, 4, NULL, NULL)) // Number of records
{
SFileCloseFile(fileHandle);
return false;
}

if (!SFileReadFile(fileHandle, &nb, 4)) // Number of fields
if (!SFileReadFile(fileHandle, &nb, 4, NULL, NULL)) // Number of fields
{
SFileCloseFile(fileHandle);
return false;
}

if (!SFileReadFile(fileHandle, &es, 4)) // Size of a record
if (!SFileReadFile(fileHandle, &es, 4, NULL, NULL)) // Size of a record
{
SFileCloseFile(fileHandle);
return false;
}

if (!SFileReadFile(fileHandle, &ss, 4)) // String size
if (!SFileReadFile(fileHandle, &ss, 4, NULL, NULL)) // String size
{
SFileCloseFile(fileHandle);
return false;
Expand All @@ -70,7 +70,7 @@ bool DBCFile::open()

size_t data_size = recordSize*recordCount+stringSize;

if (!SFileReadFile(fileHandle, data, data_size))
if (!SFileReadFile(fileHandle, data, data_size, NULL, NULL))
{
SFileCloseFile(fileHandle);
return false;
Expand Down
6 changes: 3 additions & 3 deletions contrib/extractor/loadlib/loadlib.cpp
Expand Up @@ -45,7 +45,7 @@ bool ExtractFile( char const* mpq_name, std::string const& filename )
if (!SFileOpenFileEx(*i, mpq_name, SFILE_OPEN_PATCHED_FILE, &fileHandle))
continue;

if (SFileGetFileSize(fileHandle) == 0) // some files removed in next updates and its reported size 0
if (SFileGetFileSize(fileHandle, NULL) == 0) // some files removed in next updates and its reported size 0
{
SFileCloseFile(fileHandle);
return true;
Expand Down Expand Up @@ -99,7 +99,7 @@ bool FileLoader::loadFile(char *filename, bool log)
return false;
}

data_size = SFileGetFileSize(fileHandle);
data_size = SFileGetFileSize(fileHandle, NULL);

data = new uint8 [data_size];
if (!data)
Expand All @@ -108,7 +108,7 @@ bool FileLoader::loadFile(char *filename, bool log)
return false;
}

if (!SFileReadFile(fileHandle, data, data_size))
if (!SFileReadFile(fileHandle, data, data_size, NULL, NULL))
{
if (log)
printf("Can't read file %s\n", filename);
Expand Down
49 changes: 32 additions & 17 deletions dep/StormLib/CMakeLists.txt
Expand Up @@ -5,8 +5,6 @@ set(SRC_FILES
src/adpcm/adpcm.cpp
src/huffman/huff.cpp
src/jenkins/lookup3.c
src/libtomcrypt/src/misc/crypt_libc.c
src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c
src/lzma/C/LzFind.c
src/lzma/C/LzmaDec.c
src/lzma/C/LzmaEnc.c
Expand All @@ -15,6 +13,7 @@ set(SRC_FILES
src/sparse/sparse.cpp
src/FileStream.cpp
src/SBaseCommon.cpp
src/SBaseDumpData.cpp
src/SBaseFileTable.cpp
src/SCompression.cpp
src/SFileAddFile.cpp
Expand Down Expand Up @@ -44,6 +43,7 @@ set(TOMCRYPT_FILES
src/libtomcrypt/src/misc/crypt_find_prng.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
src/libtomcrypt/src/misc/crypt_ltc_mp_descriptor.c
src/libtomcrypt/src/misc/crypt_prng_descriptor.c
src/libtomcrypt/src/misc/crypt_prng_is_valid.c
Expand Down Expand Up @@ -91,6 +91,7 @@ set(TOMCRYPT_FILES
src/libtomcrypt/src/pk/rsa/rsa_import.c
src/libtomcrypt/src/pk/rsa/rsa_make_key.c
src/libtomcrypt/src/pk/rsa/rsa_verify_hash.c
src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c
)

set(TOMMATH_FILES
Expand Down Expand Up @@ -233,9 +234,9 @@ set(ZLIB_BZIP2_FILES
src/zlib/zutil.c
)

set(TEST_SRC_FILES
test/Test.cpp
)
# set(TEST_SRC_FILES
# test/Test.cpp
# )

add_definitions(-D_7ZIP_ST -DBZ_STRICT_ANSI)

Expand All @@ -247,6 +248,7 @@ if(WIN32)
message(STATUS "Using mingw")
endif()
set(SRC_ADDITIONAL_FILES ${ZLIB_BZIP2_FILES} ${TOMCRYPT_FILES} ${TOMMATH_FILES})
set(LINK_LIBS wininet)
endif()

if(APPLE)
Expand All @@ -266,25 +268,38 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
endif()
endif()

add_library(StormLib SHARED ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(StormLib ${LINK_LIBS})
add_library(storm SHARED ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(storm ${LINK_LIBS})

add_library(StormLib_static STATIC ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(StormLib_static ${LINK_LIBS})
set_target_properties(StormLib_static PROPERTIES OUTPUT_NAME StormLib)
# option(WITH_TEST "Compile Test application" OFF)
# if(WITH_TEST)
# add_executable(storm_test ${TEST_SRC_FILES})
# target_link_libraries(storm_test storm)
# endif()

add_executable(StormLib_test ${TEST_SRC_FILES})
target_link_libraries(StormLib_test StormLib_static)
# option(WITH_STATIC "Compile static linked library" OFF)
# if(WITH_STATIC)
# add_library(StormLib_static STATIC ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
# target_link_libraries(StormLib_static ${LINK_LIBS})
# set_target_properties(StormLib_static PROPERTIES OUTPUT_NAME StormLib)
# endif()

if(APPLE)
set_target_properties(StormLib PROPERTIES FRAMEWORK true)
set_target_properties(StormLib PROPERTIES PUBLIC_HEADER "src/StormLib.h src/StormPort.h")
set_target_properties(StormLib PROPERTIES LINK_FLAGS "-framework Carbon")
set_target_properties(storm PROPERTIES FRAMEWORK true)
set_target_properties(storm PROPERTIES PUBLIC_HEADER "src/StormLib.h src/StormPort.h")
set_target_properties(storm PROPERTIES LINK_FLAGS "-framework Carbon")
endif()

if(UNIX)
set_target_properties(StormLib PROPERTIES SOVERSION 0)
set_target_properties(storm PROPERTIES VERSION 8.20.0)
set_target_properties(storm PROPERTIES SOVERSION 8.20)
endif()

install(TARGETS StormLib StormLib_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
# On Win32, build StormLib.dll since we don't want to clash with Storm.dll
if(WIN32)
set_target_properties(storm PROPERTIES OUTPUT_NAME StormLib)
endif()

install(TARGETS storm RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib FRAMEWORK DESTINATION /Library/Frameworks)
install(FILES src/StormLib.h src/StormPort.h DESTINATION include)

7 changes: 3 additions & 4 deletions dep/StormLib/Publish.bat
Expand Up @@ -10,13 +10,12 @@ zip.exe -ur9 ..\WWW\web\download\stormlib.zip StormLib\storm_dll\*
zip.exe -ur9 ..\WWW\web\download\stormlib.zip StormLib\StormLib.xcodeproj\*
zip.exe -ur9 ..\WWW\web\download\stormlib.zip StormLib\stormlib_dll\*
zip.exe -ur9 ..\WWW\web\download\stormlib.zip StormLib\test\*
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\makefile*
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\CMakeLists.txt
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\makefile.*
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\Info.plist
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\*.bat
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\*.sln
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\*.vcproj
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\*.plist
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\*.txt
zip.exe -u9 ..\WWW\web\download\stormlib.zip StormLib\*.kdev4
echo.

echo Press any key to exit ...
Expand Down
7 changes: 3 additions & 4 deletions dep/StormLib/Publish_beta.bat
Expand Up @@ -10,13 +10,12 @@ zip.exe -ur9 ..\WWW\web\download\stormlib_beta.zip StormLib\storm_dll\*
zip.exe -ur9 ..\WWW\web\download\stormlib_beta.zip StormLib\StormLib.xcodeproj\*
zip.exe -ur9 ..\WWW\web\download\stormlib_beta.zip StormLib\stormlib_dll\*
zip.exe -ur9 ..\WWW\web\download\stormlib_beta.zip StormLib\test\*
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\makefile*
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\CMakeLists.txt
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\makefile.*
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\Info.plist
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\*.bat
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\*.sln
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\*.vcproj
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\*.plist
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\*.txt
zip.exe -u9 ..\WWW\web\download\stormlib_beta.zip StormLib\*.kdev4
echo.

echo Press any key to exit ...
Expand Down
23 changes: 23 additions & 0 deletions dep/StormLib/README.md
@@ -0,0 +1,23 @@
stormlib ![Project status](http://getmangos.com/assets/img/repository-status-maintained.png)
========

The StormLib library is a pack of modules, written in C++, which are able to
read and also to write files from/to the MPQ archives.

MPQ (MoPaQ) is an archive format developed by Blizzard Entertainment,
purposed for storing data files, images, sounds, music and videos for their
games.

*Notice*: this repository is meant to track the development of the original
[stormlib][1], developed by [Ladislav Zezula][2].

Usage
-----
This library is used inside of [mangos-zero][3] to access data inside of MPQ
archives included in the [World of Warcraft][4] game client.


[1]: http://www.zezula.net/en/mpq/stormlib.html "StormLib"
[2]: http://www.zezula.net/ "Ladislav Zezula"
[3]: http://github.com/mangos-zero "mangos-zero"
[4]: http://eu.blizzard.com/en-gb/games/wow/ "World of Warcraft"

0 comments on commit 6737128

Please sign in to comment.