mirror of
https://github.com/rehlds/rehlds.git
synced 2025-02-10 21:59:00 +03:00
Fixed crash hlds, when building with GCC 6.X and later
Fix gcc compile
This commit is contained in:
parent
2cf2fc6b63
commit
b0660861cb
@ -155,7 +155,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>HOOK_HLTV;HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DEMOPLAYER_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitiHOOons)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DEMOPLAYER_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitiHOOons)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
|
||||||
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "vmodes.h"
|
#include "vmodes.h"
|
||||||
#include "cdll_int.h"
|
#include "cdll_int.h"
|
||||||
#include "IDemoPlayer.h"
|
#include "IDemoPlayer.h"
|
||||||
#include "IEngineWrapper.h"
|
#include "IEngineWrapperEx.h"
|
||||||
|
|
||||||
#include "BaseSystemModule.h"
|
#include "BaseSystemModule.h"
|
||||||
#include "ObjectDictionary.h"
|
#include "ObjectDictionary.h"
|
||||||
|
77
rehlds/HLTV/DemoPlayer/src/IEngineWrapperEx.h
Normal file
77
rehlds/HLTV/DemoPlayer/src/IEngineWrapperEx.h
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the author gives permission to
|
||||||
|
* link the code of this program with the Half-Life Game Engine ("HL
|
||||||
|
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||||
|
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||||
|
* respects for all of the code used other than the HL Engine and MODs
|
||||||
|
* from Valve. If you modify this file, you may extend this exception
|
||||||
|
* to your version of the file, but you are not obligated to do so. If
|
||||||
|
* you do not wish to do so, delete this exception statement from your
|
||||||
|
* version.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "event_args.h"
|
||||||
|
#include "vmodes.h"
|
||||||
|
#include "cdll_int.h"
|
||||||
|
|
||||||
|
class IBaseSystem;
|
||||||
|
class ISystemModule;
|
||||||
|
|
||||||
|
// TODO: common/IEngineWrapper.h
|
||||||
|
class IEngineWrapperEx {
|
||||||
|
public:
|
||||||
|
virtual ~IEngineWrapperEx() {}
|
||||||
|
|
||||||
|
virtual bool Init(IBaseSystem *system, int serial, char *name) = 0;
|
||||||
|
virtual void RunFrame(double time) = 0;
|
||||||
|
virtual void ReceiveSignal(ISystemModule *module, unsigned int signal, void *data) = 0;
|
||||||
|
virtual void ExecuteCommand(int commandID, char *commandLine) = 0;
|
||||||
|
virtual void RegisterListener(ISystemModule *module) = 0;
|
||||||
|
virtual void RemoveListener(ISystemModule *module) = 0;
|
||||||
|
|
||||||
|
virtual IBaseSystem *GetSystem() = 0;
|
||||||
|
|
||||||
|
virtual int GetSerial() = 0;
|
||||||
|
virtual char *GetStatusLine() = 0;
|
||||||
|
virtual char *GetType() = 0;
|
||||||
|
virtual char *GetName() = 0;
|
||||||
|
|
||||||
|
virtual int GetState() = 0;
|
||||||
|
virtual int GetVersion() = 0;
|
||||||
|
virtual void ShutDown() = 0;
|
||||||
|
|
||||||
|
virtual bool GetViewOrigin(float *origin) = 0;
|
||||||
|
virtual bool GetViewAngles(float *angles) = 0;
|
||||||
|
virtual int GetTraceEntity() = 0;
|
||||||
|
virtual float GetCvarFloat(char *szName) = 0;
|
||||||
|
virtual char *GetCvarString(char *szName) = 0;
|
||||||
|
virtual void SetCvar(char *szName, char *szValue) = 0;
|
||||||
|
virtual void Cbuf_AddText(char *text) = 0;
|
||||||
|
virtual void DemoUpdateClientData(client_data_t *cdat) = 0;
|
||||||
|
virtual void CL_QueueEvent(int flags, int index, float delay, event_args_t *pargs) = 0;
|
||||||
|
virtual void HudWeaponAnim(int iAnim, int body) = 0;
|
||||||
|
virtual void CL_DemoPlaySound(int channel, char *sample, float attenuation, float volume, int flags, int pitch) = 0;
|
||||||
|
virtual void ClientDLL_ReadDemoBuffer(int size, unsigned char *buffer) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
using IEngineWrapper = IEngineWrapperEx;
|
||||||
|
|
||||||
|
#define ENGINEWRAPPER_INTERFACE_VERSION "enginewrapper001"
|
@ -166,7 +166,7 @@ void setupToolchain(NativeBinarySpec b) {
|
|||||||
if (useGcc) {
|
if (useGcc) {
|
||||||
// Produce code optimized for the most common IA32/AMD64/EM64T processors.
|
// Produce code optimized for the most common IA32/AMD64/EM64T processors.
|
||||||
// As new processors are deployed in the marketplace, the behavior of this option will change.
|
// As new processors are deployed in the marketplace, the behavior of this option will change.
|
||||||
cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings'
|
cfg.compilerOptions.args '-mtune=generic', '-Wno-write-strings', '-msse3'
|
||||||
} else {
|
} else {
|
||||||
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti'
|
cfg.compilerOptions.args '-Qoption,cpp,--treat_func_as_string_literal_cpp', '-fno-rtti'
|
||||||
}
|
}
|
||||||
|
@ -35,28 +35,10 @@
|
|||||||
class IBaseSystem;
|
class IBaseSystem;
|
||||||
class ISystemModule;
|
class ISystemModule;
|
||||||
|
|
||||||
class IEngineWrapper {
|
class IEngineWrapper: virtual public ISystemModule {
|
||||||
public:
|
public:
|
||||||
virtual ~IEngineWrapper() {}
|
virtual ~IEngineWrapper() {}
|
||||||
|
|
||||||
virtual bool Init(IBaseSystem *system, int serial, char *name) = 0;
|
|
||||||
virtual void RunFrame(double time) = 0;
|
|
||||||
virtual void ReceiveSignal(ISystemModule *module, unsigned int signal, void *data) = 0;
|
|
||||||
virtual void ExecuteCommand(int commandID, char *commandLine) = 0;
|
|
||||||
virtual void RegisterListener(ISystemModule *module) = 0;
|
|
||||||
virtual void RemoveListener(ISystemModule *module) = 0;
|
|
||||||
|
|
||||||
virtual IBaseSystem *GetSystem() = 0;
|
|
||||||
|
|
||||||
virtual int GetSerial() = 0;
|
|
||||||
virtual char *GetStatusLine() = 0;
|
|
||||||
virtual char *GetType() = 0;
|
|
||||||
virtual char *GetName() = 0;
|
|
||||||
|
|
||||||
virtual int GetState() = 0;
|
|
||||||
virtual int GetVersion() = 0;
|
|
||||||
virtual void ShutDown() = 0;
|
|
||||||
|
|
||||||
virtual bool GetViewOrigin(float *origin) = 0;
|
virtual bool GetViewOrigin(float *origin) = 0;
|
||||||
virtual bool GetViewAngles(float *angles) = 0;
|
virtual bool GetViewAngles(float *angles) = 0;
|
||||||
virtual int GetTraceEntity() = 0;
|
virtual int GetTraceEntity() = 0;
|
||||||
|
@ -81,6 +81,7 @@ inline void xmm2vec(vec_t *v, const __m128 m)
|
|||||||
_mm_store_ss(v + 2, _mm_shuffle_ps(m, m, 0x02));
|
_mm_store_ss(v + 2, _mm_shuffle_ps(m, m, 0x02));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FUNC_TARGET("sse4.1")
|
||||||
inline __m128 dotProduct3D(__m128 v1, __m128 v2)
|
inline __m128 dotProduct3D(__m128 v1, __m128 v2)
|
||||||
{
|
{
|
||||||
if (cpuinfo.sse4_1)
|
if (cpuinfo.sse4_1)
|
||||||
|
@ -115,10 +115,12 @@ uint32 crc32c_t_nosse(uint32 iCRC, const uint8 *buf, int len) {
|
|||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FUNC_TARGET("sse4.2")
|
||||||
uint32 crc32c_t8_sse(uint32 iCRC, uint8 u8) {
|
uint32 crc32c_t8_sse(uint32 iCRC, uint8 u8) {
|
||||||
return _mm_crc32_u8(iCRC, u8);
|
return _mm_crc32_u8(iCRC, u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FUNC_TARGET("sse4.2")
|
||||||
uint32 crc32c_t_sse(uint32 iCRC, const uint8 *buf, unsigned int len) {
|
uint32 crc32c_t_sse(uint32 iCRC, const uint8 *buf, unsigned int len) {
|
||||||
uint32 crc32cval = iCRC;
|
uint32 crc32cval = iCRC;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
@ -111,6 +111,7 @@
|
|||||||
#define ALIGN16 __declspec(align(16))
|
#define ALIGN16 __declspec(align(16))
|
||||||
#define NORETURN __declspec(noreturn)
|
#define NORETURN __declspec(noreturn)
|
||||||
#define FORCE_STACK_ALIGN
|
#define FORCE_STACK_ALIGN
|
||||||
|
#define FUNC_TARGET(x)
|
||||||
|
|
||||||
#define __builtin_bswap16 _byteswap_ushort
|
#define __builtin_bswap16 _byteswap_ushort
|
||||||
#define __builtin_bswap32 _byteswap_ulong
|
#define __builtin_bswap32 _byteswap_ulong
|
||||||
@ -160,9 +161,13 @@
|
|||||||
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
|
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
|
||||||
|
|
||||||
#if defined __INTEL_COMPILER
|
#if defined __INTEL_COMPILER
|
||||||
|
#define FUNC_TARGET(x)
|
||||||
|
|
||||||
#define __builtin_bswap16 _bswap16
|
#define __builtin_bswap16 _bswap16
|
||||||
#define __builtin_bswap32 _bswap
|
#define __builtin_bswap32 _bswap
|
||||||
#define __builtin_bswap64 _bswap64
|
#define __builtin_bswap64 _bswap64
|
||||||
|
#else
|
||||||
|
#define FUNC_TARGET(x) __attribute__((target(x)))
|
||||||
#endif // __INTEL_COMPILER
|
#endif // __INTEL_COMPILER
|
||||||
|
|
||||||
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
|
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
|
||||||
|
@ -171,8 +171,8 @@ size_t Q_strlcat(char (&dest)[N], const char *src)
|
|||||||
if (srclen > size)
|
if (srclen > size)
|
||||||
srclen = size;
|
srclen = size;
|
||||||
|
|
||||||
Q_memcpy(dst + dstlen, src, srclen);
|
Q_memcpy(dest + dstlen, src, srclen);
|
||||||
dst[dstlen + srclen] = '\0';
|
dest[dstlen + srclen] = '\0';
|
||||||
|
|
||||||
return dstlen + srclen;
|
return dstlen + srclen;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,11 @@ rootProject.ext.createGccConfig = { boolean release, BinaryKind binKind ->
|
|||||||
//intelExtensions: false,
|
//intelExtensions: false,
|
||||||
//asmBlocks: true,
|
//asmBlocks: true,
|
||||||
|
|
||||||
positionIndependentCode: false
|
positionIndependentCode: false,
|
||||||
|
|
||||||
|
extraDefines: [
|
||||||
|
'_GLIBCXX_USE_CXX11_ABI': 0,
|
||||||
|
]
|
||||||
),
|
),
|
||||||
|
|
||||||
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
||||||
@ -41,7 +45,11 @@ rootProject.ext.createGccConfig = { boolean release, BinaryKind binKind ->
|
|||||||
|
|
||||||
noBuiltIn: true,
|
noBuiltIn: true,
|
||||||
//intelExtensions: false,
|
//intelExtensions: false,
|
||||||
//asmBlocks: true
|
//asmBlocks: true,
|
||||||
|
|
||||||
|
extraDefines: [
|
||||||
|
'_GLIBCXX_USE_CXX11_ABI': 0,
|
||||||
|
]
|
||||||
),
|
),
|
||||||
|
|
||||||
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
linkerOptions: new GccToolchainConfig.LinkerOptions(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user