Skip to content

Commit 40a9407

Browse files
committed
Merge branch 'improve_crc_logging_ea' into headless_sh
2 parents bf19c8c + 4917362 commit 40a9407

File tree

119 files changed

+3423
-1868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3423
-1868
lines changed

Core/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# c stands for core, i stands for Interface
22
add_library(corei_libraries_include INTERFACE)
3+
add_library(corei_always INTERFACE)
34

45
target_include_directories(corei_libraries_include INTERFACE "Libraries/Include")
6+
target_link_libraries(corei_always INTERFACE
7+
core_utility
8+
corei_libraries_include
9+
)
510

611
# Do we want to build extra SDK stuff or just the game binary?
712
option(RTS_BUILD_CORE_TOOLS "Build core tools" ON)

Core/Libraries/Source/Compression/CMakeLists.txt

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
set(COMPRESSION_SRC
2+
Compression.h
3+
CompressionManager.cpp
24
EAC/btreeabout.cpp
5+
EAC/btreecodex.h
36
EAC/btreedecode.cpp
47
EAC/btreeencode.cpp
8+
EAC/codex.h
9+
EAC/gimex.h
510
EAC/huffabout.cpp
11+
EAC/huffcodex.h
612
EAC/huffdecode.cpp
713
EAC/huffencode.cpp
814
EAC/refabout.cpp
15+
EAC/refcodex.h
916
EAC/refdecode.cpp
1017
EAC/refencode.cpp
11-
EAC/btreecodex.h
12-
EAC/codex.h
13-
EAC/gimex.h
14-
EAC/huffcodex.h
15-
EAC/refcodex.h
1618
LZHCompress/NoxCompress.cpp
1719
LZHCompress/NoxCompress.h
18-
CompressionManager.cpp
19-
Compression.h
2020
)
2121

2222
add_library(core_compression STATIC)

Core/Libraries/Source/Compression/CompressionManager.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extern "C" {
3737
//#pragma message("************************************** WARNING, optimization disabled for debugging purposes")
3838
#endif
3939

40+
// TheSuperHackers @todo Recover debug logging in this file?
4041
#define DEBUG_LOG(x) {}
4142

4243
const char *CompressionManager::getCompressionNameByType( CompressionType compType )
@@ -328,10 +329,6 @@ Int CompressionManager::decompressData( void *srcVoid, Int srcLen, void *destVoi
328329

329330
if (compType >= COMPRESSION_ZLIB1 && compType <= COMPRESSION_ZLIB9)
330331
{
331-
#ifdef DEBUG_LOGGING
332-
Int level = compType - COMPRESSION_ZLIB1 + 1; // 1-9
333-
#endif
334-
335332
unsigned long outLen = destLen;
336333
Int err = z_uncompress(dest, &outLen, src+8, srcLen-8);
337334
if (err == Z_OK || err == Z_STREAM_END)
@@ -340,7 +337,8 @@ Int CompressionManager::decompressData( void *srcVoid, Int srcLen, void *destVoi
340337
}
341338
else
342339
{
343-
DEBUG_LOG(("ZLib decompression error (src is level %d, %d bytes long) %d\n", level, srcLen, err));
340+
DEBUG_LOG(("ZLib decompression error (src is level %d, %d bytes long) %d\n",
341+
compType - COMPRESSION_ZLIB1 + 1 /* 1-9 */, srcLen, err));
344342
return 0;
345343
}
346344
}

Core/Tools/Compress/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ target_sources(core_compress PRIVATE ${COMRPESS_SRC})
1010
target_link_libraries(core_compress PRIVATE
1111
core_config
1212
core_compression
13-
zi_always
13+
corei_always
1414
)
1515

1616
if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")

Dependencies/Utility/Utility/intrin_compat.h

+16-12
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ static inline uint32_t _lrotl(uint32_t value, int shift)
8787
#ifdef _WIN32
8888
#include <intrin.h>
8989
#pragma intrinsic(__rdtsc)
90-
#endif
91-
90+
#endif // _WIN32
91+
#endif // _rdtsc
92+
#ifndef _rdtsc
9293
static inline uint64_t _rdtsc()
9394
{
94-
#if _WIN32
95+
#ifdef _WIN32
9596
return __rdtsc();
9697
#elif defined(__has_builtin) && __has_builtin(__builtin_readcyclecounter)
9798
return __builtin_readcyclecounter();
@@ -101,9 +102,9 @@ static inline uint64_t _rdtsc()
101102
#error "No implementation for _rdtsc"
102103
#endif
103104
}
104-
#endif
105+
#endif // _rdtsc
105106

106-
#ifdef _MSC_VER
107+
#ifdef _WIN32
107108
#include <intrin.h>
108109
#pragma intrinsic(_ReturnAddress)
109110
#elif defined(__has_builtin)
@@ -132,17 +133,20 @@ static inline uint64_t _rdtsc()
132133
#endif
133134

134135
#ifndef cpuid
135-
#if defined(_MSC_VER)
136+
#if (defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __amd64__)
137+
#ifdef _WIN32
136138
#include <intrin.h>
137139
#define cpuid(regs, cpuid_type) __cpuid(reinterpret_cast<int *>(regs), cpuid_type)
138-
#elif (defined __clang__ || defined __GNUC__) && (defined __i386__ || defined __amd64__)
140+
#elif (defined __clang__ || defined __GNUC__)
139141
#include <cpuid.h>
140142
#define cpuid(regs, cpuid_type) __cpuid(cpuid_type, regs[0], regs[1], regs[2], regs[3])
141-
#else
142-
/* Just return 0 for everything if its not x86 */
143+
#endif
144+
#endif // (defined _M_IX86 || defined _M_X64 || defined __i386__ || defined __amd64__)
145+
#endif // cpuid
146+
#ifndef cpuid
147+
/* Just return 0 for everything if its not x86 or as fallback */
143148
#include <string.h>
144149
#define cpuid(regs, cpuid_type) memset(regs, 0, 16)
145-
#endif
146-
#endif //cpuid
150+
#endif // cpuid
147151

148-
#endif // defined(_MSC_VER) && _MSC_VER < 1300
152+
#endif // !(defined(_MSC_VER) && _MSC_VER < 1300)

0 commit comments

Comments
 (0)