Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update (passive_anticheat): build fix #106

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b7287e8
Core/Misc: Fixed deprecation warnings for c++20
Shauren Dec 31, 2022
203bc3a
Core/Threading: Modernize ProducerConsumerQueue a bit to fix GCC build
Shauren Dec 20, 2022
85fc9d9
Dep: Upgrade utfcpp to 3.2.3
Shauren Jan 31, 2023
97c977d
Build: Update required compilers to current debian stable and VS 2022
Shauren Dec 31, 2022
d0553d4
Build: Enable C++20
Shauren Dec 31, 2022
73e7f0f
Core/Misc: Added a include hack for msvc <chrono> to use only c++17 b…
Shauren Jan 5, 2023
b8dc87a
Core/Spells: Hide spell effect immunity info implementation details
Shauren Jan 5, 2023
30adff1
Core/Utils: Replace boost flat_set with our own
Shauren Jan 6, 2023
f5a2e2a
Core/Misc: Replaced boost::container::static_vector in packet classes…
Shauren Jan 6, 2023
cccc062
Core/Misc: Remove boost::heap::fibonacci_heap from header files
Shauren Jan 6, 2023
ad3fc81
Core/Misc: Add missing Containers.h include where neccessary
Shauren Aug 12, 2023
777b001
Core/Misc: Use boost/circular_buffer forward declaration headers in o…
Shauren Jan 6, 2023
58f0c4b
Tests: Fixed environment variable confg test compilation on windows
Shauren Jan 6, 2023
d251ab6
Core/Misc: Migrate our c++20 advstd to standard features
Shauren Jan 7, 2023
27cd5a9
Core/Misc: Replace enable_if overload selection with if constexpr
Shauren Jan 7, 2023
3144566
Core/Misc: Include cleanup, 2023 edition
Shauren Jan 7, 2023
ede3620
CI: Switch appveyor to use VS 2022
Shauren Aug 12, 2023
6221457
Merge remote-tracking branch 'upstream/3.3.5' into 3.3.5-passive_anti…
acidmanifesto Aug 13, 2023
fbbe7f4
Merge remote-tracking branch 'upstream/3.3.5' into 3.3.5-passive_anti…
acidmanifesto Aug 13, 2023
e31a4d0
moar conflict fixit
acidmanifesto Aug 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/gcc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v2
- name: Dependencies
run: |
sudo apt-get update && sudo apt-get install -yq libboost-all-dev g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo apt-get update && sudo apt-get install -yq libboost-all-dev g++-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
- name: Setup
run: |
mkdir bin
Expand Down
18 changes: 9 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 1.0.{build}
image: Visual Studio 2019
image: Visual Studio 2022
clone_depth: 1
init:
- ps: ''
Expand All @@ -12,9 +12,9 @@ build_script:

md build && cd build

cmake -G"Visual Studio 16 2019" -A x64 -DSCRIPTS=dynamic -DTOOLS=True -DCMAKE_CXX_FLAGS=" /DWIN32 /D_WINDOWS /W3 /GR /EHsc /WX" -DCMAKE_C_FLAGS="/DWIN32 /D_WINDOWS /W3 /WX" ..
cmake -G"Visual Studio 17 2022" -A x64 -DSCRIPTS=dynamic -DTOOLS=True -DCMAKE_CXX_FLAGS=" /DWIN32 /D_WINDOWS /W3 /GR /EHsc /WX" -DCMAKE_C_FLAGS="/DWIN32 /D_WINDOWS /W3 /WX" ..

"%programfiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\MsBuild.exe" /nologo /m:2 /p:Configuration=RelWithDebInfo /p:Platform="X64" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" "TrinityCore.sln"
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" /nologo /m:2 /p:Configuration=RelWithDebInfo /p:Platform="X64" /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" "TrinityCore.sln"

cd bin\RelWithDebInfo\

Expand All @@ -26,16 +26,16 @@ build_script:

cd ..

7z a TrinityCoreWin64VS2019.zip .\RelWithDebInfo\*
7z a TrinityCoreWin64VS2022.zip .\RelWithDebInfo\*

del /F /Q /S "RelWithDebInfo\*.pdb" > NUL

7z a TrinityCoreWin64VS2019NoSymbols.zip .\RelWithDebInfo\*
7z a TrinityCoreWin64VS2022NoSymbols.zip .\RelWithDebInfo\*

test: off
artifacts:
- path: build\bin\TrinityCoreWin64VS2019.zip
name: TrinityCoreWin64VS2019
- path: build\bin\TrinityCoreWin64VS2022.zip
name: TrinityCoreWin64VS2022

- path: build\bin\TrinityCoreWin64VS2019NoSymbols.zip
name: TrinityCoreWin64VS2019NoSymbols
- path: build\bin\TrinityCoreWin64VS2022NoSymbols.zip
name: TrinityCoreWin64VS2022NoSymbols
2 changes: 1 addition & 1 deletion cmake/compiler/clang/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ target_compile_definitions(trinity-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="$<CONFIG>")

set(CLANG_EXPECTED_VERSION 7.0.0)
set(CLANG_EXPECTED_VERSION 11.0.0)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
message(FATAL_ERROR "Clang: TrinityCore requires version ${CLANG_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler/gcc/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ target_compile_definitions(trinity-compile-option-interface
INTERFACE
-D_BUILD_DIRECTIVE="$<CONFIG>")

set(GCC_EXPECTED_VERSION 8.3.0)
set(GCC_EXPECTED_VERSION 10.0.0)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION)
message(FATAL_ERROR "GCC: TrinityCore requires version ${GCC_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down
13 changes: 5 additions & 8 deletions cmake/compiler/msvc/settings.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(MSVC_EXPECTED_VERSION 19.24)
set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2019 16.4")
set(MSVC_EXPECTED_VERSION 19.30)
set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2022 17")

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION)
message(FATAL_ERROR "MSVC: TrinityCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}")
Expand Down Expand Up @@ -88,12 +88,9 @@ endif()
# that the program will eventually be linked with a conforming operator new implementation,
# and can omit all of these extra null checks from your program.
# http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx
if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0))
# makes this flag a requirement to build TC at all
target_compile_options(trinity-compile-option-interface
INTERFACE
/Zc:throwingNew)
endif()
target_compile_options(trinity-compile-option-interface
INTERFACE
/Zc:throwingNew)

# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
target_compile_definitions(trinity-compile-option-interface
Expand Down
4 changes: 2 additions & 2 deletions cmake/macros/ConfigureBaseTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
add_library(trinity-compile-option-interface INTERFACE)

# Use -std=c++11 instead of -std=gnu++11
set(CXX_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)

# An interface library to make the target features available to other targets
add_library(trinity-feature-interface INTERFACE)

target_compile_features(trinity-feature-interface
INTERFACE
cxx_std_17)
cxx_std_20)

# An interface library to make the warnings level available to other targets
# This interface taget is set-up through the platform specific script
Expand Down
1 change: 1 addition & 0 deletions dep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if(SERVERS)
add_subdirectory(readline)
add_subdirectory(gsoap)
add_subdirectory(efsw)
add_subdirectory(short_alloc)
endif()

if(TOOLS)
Expand Down
8 changes: 6 additions & 2 deletions dep/PackageList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ SFMT (SIMD-oriented Fast Mersenne Twister)
Version: 73bcba2e483640b8d50c1275514326dd4c1b0ca4

utf8-cpp (UTF-8 with C++ in a Portable Way)
http://utfcpp.sourceforge.net/
Version: 2.3.4
https://github.com/nemtrif/utfcpp
Version: 3.2.3

zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library)
http://www.zlib.net/
Expand All @@ -72,3 +72,7 @@ argon2
catch2
https://github.com/catchorg/Catch2
Version: v2.13.0

short_alloc (Stack based allocator) https://howardhinnant.github.io/stack_alloc.html
https://howardhinnant.github.io/short_alloc.h
Version: N/A
20 changes: 20 additions & 0 deletions dep/g3dlite/G3D-v9.0 hotfix10.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/dep/g3dlite/include/G3D/Array.h b/dep/g3dlite/include/G3D/Array.h
index c562f5c920f7..c86b20fd7e97 100644
--- a/dep/g3dlite/include/G3D/Array.h
+++ b/dep/g3dlite/include/G3D/Array.h
@@ -346,6 +346,7 @@ class Array {

/** Resizes this to match the size of \a other and then copies the data from other using memcpy. This is only safe for POD types */
void copyPOD(const Array<T>& other) {
+ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "copyPOD called on non-POD type");
if (numAllocated < other.num) {
m_memoryManager->free(data);
data = NULL;
@@ -364,6 +365,7 @@ class Array {
/** Resizes this to just barely match the size of \a other + itself and then copies the data to the end of the array from other using memcpy.
This is only safe for POD types */
void appendPOD(const Array<T>& other) {
+ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "appendPOD called on non-POD type");
const size_t oldSize = num;
num += other.num;
if (numAllocated < num) {
13 changes: 13 additions & 0 deletions dep/g3dlite/G3D-v9.0 hotfix11.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/dep/g3dlite/source/fileutils.cpp b/dep/g3dlite/source/fileutils.cpp
index 2788adad3bcd..f5310084cec7 100644
--- a/dep/g3dlite/source/fileutils.cpp
+++ b/dep/g3dlite/source/fileutils.cpp
@@ -490,7 +490,7 @@ void parseFilename(

}

- } else if ((f.size() >= 2) & isSlash(f[0]) && isSlash(f[1])) {
+ } else if ((f.size() >= 2) && isSlash(f[0]) && isSlash(f[1])) {

// e.g. //foo
root = f.substr(0, 2);
192 changes: 192 additions & 0 deletions dep/g3dlite/G3D-v9.0 hotfix12.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
index 7b56e001ae29..9824d426d741 100644
--- a/dep/g3dlite/include/G3D/AtomicInt32.h
+++ b/dep/g3dlite/include/G3D/AtomicInt32.h
@@ -76,12 +76,16 @@ class AtomicInt32 {

# elif defined(G3D_LINUX) || defined(G3D_FREEBSD)

- int32 old;
- asm volatile ("lock; xaddl %0,%1"
- : "=r"(old), "=m"(m_value) /* outputs */
- : "0"(x), "m"(m_value) /* inputs */
- : "memory", "cc");
- return old;
+# if defined(__aarch64__)
+ return __sync_fetch_and_add(&m_value, x);
+# else
+ int32 old;
+ asm volatile ("lock; xaddl %0,%1"
+ : "=r"(old), "=m"(m_value) /* outputs */
+ : "0"(x), "m"(m_value) /* inputs */
+ : "memory", "cc");
+ return old;
+# endif

# elif defined(G3D_OSX)

@@ -115,14 +119,18 @@ class AtomicInt32 {
// Note: returns the newly decremented value
return InterlockedDecrement(&m_value);
# elif defined(G3D_LINUX) || defined(G3D_FREEBSD)
- unsigned char nz;
-
- asm volatile ("lock; decl %1;\n\t"
- "setnz %%al"
- : "=a" (nz)
- : "m" (m_value)
- : "memory", "cc");
- return nz;
+# if defined(__aarch64__)
+ return __sync_sub_and_fetch(&m_value, 1);
+# else
+ unsigned char nz;
+
+ asm volatile ("lock; decl %1;\n\t"
+ "setnz %%al"
+ : "=a" (nz)
+ : "m" (m_value)
+ : "memory", "cc");
+ return nz;
+# endif
# elif defined(G3D_OSX)
// Note: returns the newly decremented value
return OSAtomicDecrement32(&m_value);
@@ -143,17 +151,21 @@ class AtomicInt32 {
# if defined(G3D_WINDOWS)
return InterlockedCompareExchange(&m_value, exchange, comperand);
# elif defined(G3D_LINUX) || defined(G3D_FREEBSD) || defined(G3D_OSX)
- // Based on Apache Portable Runtime
- // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx
- int32 ret;
- asm volatile ("lock; cmpxchgl %1, %2"
- : "=a" (ret)
- : "r" (exchange), "m" (m_value), "0"(comperand)
- : "memory", "cc");
- return ret;
-
- // Note that OSAtomicCompareAndSwap32 does not return a useful value for us
- // so it can't satisfy the cmpxchgl contract.
+# if defined(__aarch64__)
+ return __sync_val_compare_and_swap(&m_value, comperand, exchange);
+# else
+ // Based on Apache Portable Runtime
+ // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx
+ int32 ret;
+ asm volatile ("lock; cmpxchgl %1, %2"
+ : "=a" (ret)
+ : "r" (exchange), "m" (m_value), "0"(comperand)
+ : "memory", "cc");
+ return ret;
+
+ // Note that OSAtomicCompareAndSwap32 does not return a useful value for us
+ // so it can't satisfy the cmpxchgl contract.
+# endif
# endif
}

diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
index 4624dd916474..9ed88957d755 100644
--- a/dep/g3dlite/include/G3D/System.h
+++ b/dep/g3dlite/include/G3D/System.h
@@ -21,6 +21,10 @@
#include "G3D/FileNotFound.h"
#include <string>

+#if defined(__aarch64__)
+#include <sys/time.h>
+#endif
+
#ifdef G3D_OSX
#define Zone OSX_Zone
# include <CoreServices/CoreServices.h>
@@ -497,15 +501,37 @@ class System {
#elif defined(G3D_LINUX)

inline uint64 System::getCycleCount() {
- uint32 timehi, timelo;
+# if defined(__aarch64__)
+# if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount
+ uint32_t pmccntr;
+ uint32_t pmuseren;
+ uint32_t pmcntenset;
+ // Read the user mode perf monitor counter access permissions.
+ __asm__ __volatile__("mrc p15, 0, %w0, c9, c14, 0" : "=r"(pmuseren));
+ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code.
+ __asm__ __volatile__("mrc p15, 0, %w0, c9, c12, 1" : "=r"(pmcntenset));
+ if (pmcntenset & 0x80000000ul) { // Is it counting?
+ __asm__ __volatile__("mrc p15, 0, %w0, c9, c13, 0" : "=r"(pmccntr));
+ // The counter is set up to count every 64th cycle
+ return static_cast<uint64>(pmccntr) * 64; // Should optimize to << 6
+ }
+ }
+# endif

- __asm__ __volatile__ (
- "rdtsc "
- : "=a" (timelo),
- "=d" (timehi)
- : );
+ struct timeval tv;
+ gettimeofday(&tv, nullptr);
+ return static_cast<uint64>(tv.tv_sec) * 1000000 + tv.tv_usec;
+# else
+ uint32 timehi, timelo;
+
+ __asm__ __volatile__ (
+ "rdtsc "
+ : "=a" (timelo),
+ "=d" (timehi)
+ : );

- return ((uint64)timehi << 32) + (uint64)timelo;
+ return ((uint64)timehi << 32) + (uint64)timelo;
+# endif
}

#elif defined(G3D_OSX)
diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
index 439495ab1315..d043f21491ad 100644
--- a/dep/g3dlite/include/G3D/platform.h
+++ b/dep/g3dlite/include/G3D/platform.h
@@ -273,7 +273,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {\
# define __stdcall __attribute__((stdcall))
# endif

-# elif defined(__x86_64__)
+# elif defined(__x86_64__) || defined(__arm) || defined(__aarch64__)

# ifndef __cdecl
# define __cdecl
diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp
index b841e23c497e..4a75d320b8d3 100644
--- a/dep/g3dlite/source/System.cpp
+++ b/dep/g3dlite/source/System.cpp
@@ -79,8 +79,9 @@
#endif

// SIMM include
+#if !defined(__aarch64__)
#include <xmmintrin.h>
-
+#endif

namespace G3D {

@@ -1697,6 +1698,16 @@ void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, ui
edx = regs[3];
}

+#elif defined(__aarch64__) || defined(G3D_OSX) && ! defined(G3D_OSX_INTEL)
+
+// non-x86 CPU; no CPUID
+void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, uint32& edx) {
+ eax = 0;
+ ebx = 0;
+ ecx = 0;
+ edx = 0;
+}
+
#else

// See http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
Loading
Loading