This is perhaps an issue spread over all the sdk branches. The detection of little endianess only ever works for gcc, there's nothing for msvc. From my short research, it seems msvc doesn't/never tell the preprocessor anything about the CPU brand. So instead we're going to assume if the CPU is a x86 or x86_64 processor it's most likely intel so i386-family, therefore little endian. Even if there's room for error, this is still marginally better than not having anything defined.
* Fix compilation for windows, setup ambuild
* Add built tier1 and mathlib for win64
* Ensure compilation is working on windows and linux
* Add -fPIC
* Add compiled libs, with optimisation enabled
* Added windows lib
* Fix hl2sdk for windows
* Longs are the devil
* Fix up threadtools functions
* Add updated libs
* Rework lib naming, and package script
* Update lib directory according to new packaging
---------
Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
TF2's VScript update appears to add a new member to the overlay
interface. Discovered by cross-referencing VDebugOverlay003
argument counts / inferred types in disassembly on Windows.
NDebugOverlay::ScreenText was affected by this change differently
on Windows and Linux, so it suggests an overload.
* Get rid of warnings
-macro expansion producing 'defined' has undefined behaviour
-conversion from 'int' to 'float', possible loss of data
* Get rid of errors
-conversion from 'int' to 'float', possible loss of data
The swap() function provided in the MathLib header was renamed to V_swap in recent Source SDK versions (e.g. 2013) to avoid causing ambiguity problems with std::swap(). But older SDK versions (such as TF2) lack this change, as they predate it.
The ambiguity between MathLib's swap() and std::swap() causes considerable problems when using newer features of C++ (such as std::unique_ptr) which internally call swap() in an unqualified manner to implement move semantics:
/usr/include/c++/5.2.0/bits/unique_ptr.h:342:6: error: call of overloaded ‘swap(MyType*&, MyType*&)’ is ambiguous
/usr/include/c++/5.2.0/bits/move.h:176:5: note: candidate: void std::swap(_Tp&, _Tp&) [with _Tp = MyType*]
hl2sdk-tf2/public/mathlib/mathlib.h:611:18: note: candidate: void swap(T&, T&) [with T = MyType*]
This patch backports the swap() -> V_swap() rename from the 2013 SDK version to the TF2 SDK version, so that the TF2 SDK can be used in conjunction with C++11 features such as std::unique_ptr without difficulty.
More information on why swap() isn't called in a namespace-qualified manner by standard library functions:
http://en.cppreference.com/w/cpp/language/adl#Notes