diff --git a/hecl/CMakeLists.txt b/hecl/CMakeLists.txt index df116f9f4..28339935d 100644 --- a/hecl/CMakeLists.txt +++ b/hecl/CMakeLists.txt @@ -4,6 +4,8 @@ set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) set(ATHENA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/Athena/include) set(LOG_VISOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/LogVisor/include) set(ANGELSCRIPT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/AngelScript/angelscript/include) +set(LIBPNG_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libpng) +set(SQUISH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/libSquish) add_definitions(-DAS_USE_NAMESPACE=1) add_subdirectory(extern) include_directories(include ${LOG_VISOR_INCLUDE_DIR} ${ATHENA_INCLUDE_DIR} ${ANGELSCRIPT_INCLUDE_DIR}) diff --git a/hecl/driver/CMakeLists.txt b/hecl/driver/CMakeLists.txt index 40df3f8ab..005203da9 100644 --- a/hecl/driver/CMakeLists.txt +++ b/hecl/driver/CMakeLists.txt @@ -21,5 +21,5 @@ list(APPEND DATA_SPEC_LIBS target_link_libraries(hecl "-Wl,-whole-archive" HECLDatabaseInit ${DATA_SPEC_LIBS} "-Wl,-no-whole-archive" - HECLDatabase HECL AthenaCore AngelScript NOD LogVisor blowfish z lzo2 + HECLDatabase HECL AthenaCore AngelScript NOD LogVisor png squish blowfish z lzo2 ) diff --git a/hecl/extern/CMakeLists.txt b/hecl/extern/CMakeLists.txt index 81fe9a6d6..ee467e361 100644 --- a/hecl/extern/CMakeLists.txt +++ b/hecl/extern/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(libpng) +add_subdirectory(libSquish) add_subdirectory(blowfish) add_subdirectory(LogVisor) add_subdirectory(AngelScript) diff --git a/hecl/extern/RetroCommon b/hecl/extern/RetroCommon index dea341d27..149165ee9 160000 --- a/hecl/extern/RetroCommon +++ b/hecl/extern/RetroCommon @@ -1 +1 @@ -Subproject commit dea341d27b52e60ab3b8f4ee7e7b808ef516b39d +Subproject commit 149165ee97f1ab310e8fc6f8643c501297a18fe2 diff --git a/hecl/extern/blowfish/blowfish.c b/hecl/extern/blowfish/blowfish.c index 0f8a7a409..3852f5298 100644 --- a/hecl/extern/blowfish/blowfish.c +++ b/hecl/extern/blowfish/blowfish.c @@ -4,19 +4,19 @@ #define N 16 -extern const unsigned long BLOWFISH_P[N + 2]; -extern const unsigned long BLOWFISH_S[4][256]; +extern const uint32_t BLOWFISH_P[N + 2]; +extern const uint32_t BLOWFISH_S[4][256]; #define P BLOWFISH_P #define S BLOWFISH_S -static unsigned long F(unsigned long x) +static uint32_t F(uint32_t x) { - unsigned short a; - unsigned short b; - unsigned short c; - unsigned short d; - unsigned long y; + uint16_t a; + uint16_t b; + uint16_t c; + uint16_t d; + uint32_t y; d = x & 0x00FF; x >>= 8; @@ -32,11 +32,11 @@ static unsigned long F(unsigned long x) return y; } -void Blowfish_encipher(unsigned long *xl, unsigned long *xr) +void Blowfish_encipher(uint32_t *xl, uint32_t *xr) { - unsigned long Xl; - unsigned long Xr; - unsigned long temp; + uint32_t Xl; + uint32_t Xr; + uint32_t temp; short i; Xl = *xl; @@ -62,11 +62,11 @@ void Blowfish_encipher(unsigned long *xl, unsigned long *xr) *xr = Xr; } -void Blowfish_decipher(unsigned long *xl, unsigned long *xr) +void Blowfish_decipher(uint32_t *xl, uint32_t *xr) { - unsigned long Xl; - unsigned long Xr; - unsigned long temp; + uint32_t Xl; + uint32_t Xr; + uint32_t temp; short i; Xl = *xl; @@ -99,13 +99,13 @@ int64_t Blowfish_hash(const void* buf, size_t len) unsigned i,j; union { - unsigned long h32[2]; + uint32_t h32[2]; int64_t h64; } hash = {}; for (i=0 ; i #include -void Blowfish_encipher(unsigned long *xl, unsigned long *xr); -void Blowfish_decipher(unsigned long *xl, unsigned long *xr); +void Blowfish_encipher(uint32_t *xl, uint32_t *xr); +void Blowfish_decipher(uint32_t *xl, uint32_t *xr); int64_t Blowfish_hash(const void* buf, size_t len); #ifdef __cplusplus diff --git a/hecl/extern/libSquish b/hecl/extern/libSquish index 1d3ed2763..ac84440be 160000 --- a/hecl/extern/libSquish +++ b/hecl/extern/libSquish @@ -1 +1 @@ -Subproject commit 1d3ed2763636ef7d049644c7ddc7fb905e52e254 +Subproject commit ac84440bec8284050cb9ad746a75821e8521e9a5 diff --git a/hecl/include/HECL/HECL.hpp b/hecl/include/HECL/HECL.hpp index 15f02cd19..4783852df 100644 --- a/hecl/include/HECL/HECL.hpp +++ b/hecl/include/HECL/HECL.hpp @@ -522,6 +522,8 @@ static inline int32_t SBig(int32_t val) {return bswap32(val);} static inline uint32_t SBig(uint32_t val) {return bswap32(val);} static inline int64_t SBig(int64_t val) {return bswap64(val);} static inline uint64_t SBig(uint64_t val) {return bswap64(val);} +#define SBIG(q) ( ( (q) & 0x000000FF ) << 24 | ( (q) & 0x0000FF00 ) << 8 \ + | ( (q) & 0x00FF0000 ) >> 8 | ( (q) & 0xFF000000 ) >> 24 ) static inline int16_t SLittle(int16_t val) {return val;} static inline uint16_t SLittle(uint16_t val) {return val;} @@ -529,6 +531,7 @@ static inline int32_t SLittle(int32_t val) {return val;} static inline uint32_t SLittle(uint32_t val) {return val;} static inline int64_t SLittle(int64_t val) {return val;} static inline uint64_t SLittle(uint64_t val) {return val;} +#define SLITTLE(q) (q) #else static inline int16_t SLittle(int16_t val) {return bswap16(val);} static inline uint16_t SLittle(uint16_t val) {return bswap16(val);} @@ -536,6 +539,8 @@ static inline int32_t SLittle(int32_t val) {return bswap32(val);} static inline uint32_t SLittle(uint32_t val) {return bswap32(val);} static inline int64_t SLittle(int64_t val) {return bswap64(val);} static inline uint64_t SLittle(uint64_t val) {return bswap64(val);} +#define SLITTLE(q) ( ( (q) & 0x000000FF ) << 24 | ( (q) & 0x0000FF00 ) << 8 \ + | ( (q) & 0x00FF0000 ) >> 8 | ( (q) & 0xFF000000 ) >> 24 ) static inline int16_t SBig(int16_t val) {return val;} static inline uint16_t SBig(uint16_t val) {return val;} @@ -543,6 +548,7 @@ static inline int32_t SBig(int32_t val) {return val;} static inline uint32_t SBig(uint32_t val) {return val;} static inline int64_t SBig(int64_t val) {return val;} static inline uint64_t SBig(uint64_t val) {return val;} +#define SBIG(q) (q) #endif } diff --git a/hecl/lib/ProjectPath.cpp b/hecl/lib/ProjectPath.cpp index e3606a458..2c10f6826 100644 --- a/hecl/lib/ProjectPath.cpp +++ b/hecl/lib/ProjectPath.cpp @@ -22,9 +22,8 @@ static SystemString canonRelPath(const SystemString& path) std::vector comps; HECL::SystemRegexMatch matches; SystemString in = path; - while (std::regex_search(in, matches, regPATHCOMP)) + for (; std::regex_search(in, matches, regPATHCOMP) ; in = matches.suffix()) { - in = matches.suffix(); const SystemString& match = matches[1]; if (!match.compare(_S("."))) continue;