arch: added support for aarch64
This commit is contained in:
parent
bea8120a41
commit
1ecc0827c9
7 changed files with 83 additions and 48 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit e9c1c7c9cb290149a260c9e9c56997051be34570
|
Subproject commit 0252d7bd8561047a70ebd6cec421af7d9e1cc9c7
|
||||||
|
|
@ -635,7 +635,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// for android
|
// for android
|
||||||
#if defined (CR_ANDROID) && defined(CR_ARCH_ARM)
|
#if defined (CR_ARCH_ARM)
|
||||||
extern "C" void player (entvars_t *);
|
extern "C" void player (entvars_t *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -680,7 +680,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void callPlayerFunction (edict_t *ent) {
|
void callPlayerFunction (edict_t *ent) {
|
||||||
#if defined (CR_ANDROID) && defined (CR_ARCH_ARM)
|
#if defined (CR_ARCH_ARM)
|
||||||
player (&ent->v);
|
player (&ent->v);
|
||||||
#else
|
#else
|
||||||
reinterpret_cast <EntityFunction> (lookup (Game::instance ().lib ().handle (), "player")) (&ent->v);
|
reinterpret_cast <EntityFunction> (lookup (Game::instance ().lib ().handle (), "player")) (&ent->v);
|
||||||
|
|
|
||||||
29
meson.build
29
meson.build
|
|
@ -23,7 +23,8 @@ project (
|
||||||
'optimization=3',
|
'optimization=3',
|
||||||
'default_library=static',
|
'default_library=static',
|
||||||
'cpp_eh=none',
|
'cpp_eh=none',
|
||||||
'b_vscrt=static_from_buildtype'
|
'b_vscrt=static_from_buildtype',
|
||||||
|
'b_lto=true'
|
||||||
],
|
],
|
||||||
meson_version: '>=0.56.0')
|
meson_version: '>=0.56.0')
|
||||||
|
|
||||||
|
|
@ -33,6 +34,7 @@ find_program ('hostname', required: true)
|
||||||
|
|
||||||
cpp = meson.get_compiler ('cpp')
|
cpp = meson.get_compiler ('cpp')
|
||||||
sys = host_machine.system ()
|
sys = host_machine.system ()
|
||||||
|
target = build_machine.cpu_family ()
|
||||||
version = meson.project_version ()
|
version = meson.project_version ()
|
||||||
count = run_command ('git', 'rev-list', '--count', 'HEAD').stdout ().strip ()
|
count = run_command ('git', 'rev-list', '--count', 'HEAD').stdout ().strip ()
|
||||||
|
|
||||||
|
|
@ -48,6 +50,7 @@ clang = cpp_id == 'clang'
|
||||||
win32 = sys == 'windows'
|
win32 = sys == 'windows'
|
||||||
linux = sys == 'linux'
|
linux = sys == 'linux'
|
||||||
mac = sys == 'darwin'
|
mac = sys == 'darwin'
|
||||||
|
aarch64 = target == 'aarch64'
|
||||||
|
|
||||||
ldflags = []
|
ldflags = []
|
||||||
ccflags = []
|
ccflags = []
|
||||||
|
|
@ -76,12 +79,15 @@ ccflags += '-DVERSION_GENERATED'
|
||||||
|
|
||||||
if clang or gcc
|
if clang or gcc
|
||||||
ccflags += [
|
ccflags += [
|
||||||
'-m32',
|
|
||||||
'-fno-threadsafe-statics',
|
'-fno-threadsafe-statics',
|
||||||
'-fno-exceptions',
|
'-fno-exceptions',
|
||||||
'-fno-rtti'
|
'-fno-rtti'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not aarch64
|
||||||
|
ccflags += '-m32'
|
||||||
|
endif
|
||||||
|
|
||||||
if not mac
|
if not mac
|
||||||
ccflags += [
|
ccflags += [
|
||||||
'-pedantic',
|
'-pedantic',
|
||||||
|
|
@ -90,31 +96,35 @@ if clang or gcc
|
||||||
|
|
||||||
if optmize
|
if optmize
|
||||||
if (clang or gcc) and not mac
|
if (clang or gcc) and not mac
|
||||||
|
if not aarch64
|
||||||
ccflags += [
|
ccflags += [
|
||||||
'-flto',
|
|
||||||
'-fdata-sections',
|
'-fdata-sections',
|
||||||
'-ffunction-sections'
|
'-ffunction-sections'
|
||||||
]
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
if gcc
|
if gcc
|
||||||
ccflags += '-fgraphite-identity'
|
ccflags += '-fgraphite-identity'
|
||||||
ldflags += '-flto-partition=none'
|
ldflags += '-flto-partition=none'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if not aarch64
|
||||||
ldflags += [
|
ldflags += [
|
||||||
'-flto',
|
|
||||||
'-Wl,--version-script=../ldscript.lds',
|
'-Wl,--version-script=../ldscript.lds',
|
||||||
'-Wl,--gc-sections'
|
'-Wl,--gc-sections'
|
||||||
]
|
]
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
if linux
|
if linux
|
||||||
ldflags += [
|
ldflags += [
|
||||||
'-m32',
|
|
||||||
'-lm',
|
'-lm',
|
||||||
'-ldl'
|
'-ldl'
|
||||||
]
|
]
|
||||||
|
if not aarch64
|
||||||
|
ldflags += '-m32'
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -138,8 +148,6 @@ if linux or mac or (win32 and (gcc or clang))
|
||||||
else
|
else
|
||||||
ccflags += [
|
ccflags += [
|
||||||
'-mtune=generic',
|
'-mtune=generic',
|
||||||
'-msse2',
|
|
||||||
'-mfpmath=sse',
|
|
||||||
'-fno-builtin',
|
'-fno-builtin',
|
||||||
'-funroll-loops',
|
'-funroll-loops',
|
||||||
'-fomit-frame-pointer',
|
'-fomit-frame-pointer',
|
||||||
|
|
@ -148,6 +156,13 @@ if linux or mac or (win32 and (gcc or clang))
|
||||||
'-fvisibility-inlines-hidden'
|
'-fvisibility-inlines-hidden'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not aarch64
|
||||||
|
ccflags += [
|
||||||
|
'-msse2',
|
||||||
|
'-mfpmath=sse',
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
if clang and not mac
|
if clang and not mac
|
||||||
lld = find_program ('lld', required: false)
|
lld = find_program ('lld', required: false)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <yapb.h>
|
#include <yapb.h>
|
||||||
|
|
||||||
// until hook code will be compatible with ARM, it's here
|
// until hook code will be compatible with ARM, it's here
|
||||||
#if defined (CR_ANDROID) && defined(CR_ARCH_ARM)
|
#if defined(CR_ARCH_ARM)
|
||||||
|
|
||||||
CR_EXPORT int Server_GetBlendingInterface (int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform) {
|
CR_EXPORT int Server_GetBlendingInterface (int version, struct sv_blending_interface_s **ppinterface, struct engine_studio_api_s *pstudio, float *rotationmatrix, float *bonetransform) {
|
||||||
// this function synchronizes the studio model animation blending interface (i.e, what parts
|
// this function synchronizes the studio model animation blending interface (i.e, what parts
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,32 @@ void Game::testHull (const Vector &start, const Vector &end, int ignoreFlags, in
|
||||||
engfuncs.pfnTraceHull (start, end, !!(ignoreFlags & TraceIgnore::Monsters), hullNumber, ignoreEntity, ptr);
|
engfuncs.pfnTraceHull (start, end, !!(ignoreFlags & TraceIgnore::Monsters), hullNumber, ignoreEntity, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper class for reading wave header
|
||||||
|
class WaveEndianessHelper : public DenyCopying {
|
||||||
|
private:
|
||||||
|
#if defined (CR_ARCH_CPU_BIG_ENDIAN)
|
||||||
|
bool little { false };
|
||||||
|
#else
|
||||||
|
bool little { true };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
uint16_t read16 (uint16_t value) {
|
||||||
|
return little ? value : static_cast <uint16_t> ((value >> 8) | (value << 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t read32 (uint32_t value) {
|
||||||
|
return little ? value : (((value & 0x000000ff) << 24) | ((value & 0x0000ff00) << 8) | ((value & 0x00ff0000) >> 8) | ((value & 0xff000000) >> 24));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isWave (char *format) {
|
||||||
|
if (little && memcmp (format, "WAVE", 4) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return *reinterpret_cast <uint32_t *> (format) == 0x57415645;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
float Game::getWaveLen (const char *fileName) {
|
float Game::getWaveLen (const char *fileName) {
|
||||||
auto filePath = strings.format ("%s/%s/%s.wav", getRunningModName (), cv_chatter_path.str (), fileName);
|
auto filePath = strings.format ("%s/%s/%s.wav", getRunningModName (), cv_chatter_path.str (), fileName);
|
||||||
|
|
||||||
|
|
@ -264,47 +290,41 @@ float Game::getWaveLen (const char *fileName) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we have engine function for this
|
|
||||||
if (!is (GameFlags::Xash3D) && plat.checkPointer (engfuncs.pfnGetApproxWavePlayLen)) {
|
|
||||||
fp.close ();
|
|
||||||
return engfuncs.pfnGetApproxWavePlayLen (filePath) / 1000.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// else fuck with manual search
|
// else fuck with manual search
|
||||||
struct WavHeader {
|
struct WavHeader {
|
||||||
char riffChunkId[4];
|
char riff[4];
|
||||||
unsigned long packageSize;
|
uint32_t chunkSize;
|
||||||
char chunkID[4];
|
char wave[4];
|
||||||
char formatChunkId[4];
|
char fmt[4];
|
||||||
unsigned long formatChunkLength;
|
uint32_t subchunk1Size;
|
||||||
uint16 dummy;
|
uint16_t audioFormat;
|
||||||
uint16 channels;
|
uint16_t numChannels;
|
||||||
unsigned long sampleRate;
|
uint32_t sampleRate;
|
||||||
unsigned long bytesPerSecond;
|
uint32_t byteRate;
|
||||||
uint16 bytesPerSample;
|
uint16_t blockAlign;
|
||||||
uint16 bitsPerSample;
|
uint16_t bitsPerSample;
|
||||||
char dataChunkId[4];
|
char dataChunkId[4];
|
||||||
unsigned long dataChunkLength;
|
uint32_t dataChunkLength;
|
||||||
} waveHdr {};
|
} header {};
|
||||||
|
|
||||||
plat.bzero (&waveHdr, sizeof (waveHdr));
|
WaveEndianessHelper weh;
|
||||||
|
|
||||||
if (fp.read (&waveHdr, sizeof (WavHeader)) == 0) {
|
if (fp.read (&header, sizeof (WavHeader)) == 0) {
|
||||||
logger.error ("Wave File %s - has wrong or unsupported format", filePath);
|
logger.error ("Wave File %s - has wrong or unsupported format", filePath);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
fp.close ();
|
fp.close ();
|
||||||
|
|
||||||
if (strncmp (waveHdr.chunkID, "WAVE", 4) != 0) {
|
if (!weh.isWave (header.wave)) {
|
||||||
logger.error ("Wave File %s - has wrong wave chunk id", filePath);
|
logger.error ("Wave File %s - has wrong wave chunk id", filePath);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waveHdr.dataChunkLength == 0) {
|
if (weh.read32 (header.dataChunkLength) == 0) {
|
||||||
logger.error ("Wave File %s - has zero length!", filePath);
|
logger.error ("Wave File %s - has zero length!", filePath);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
return static_cast <float> (waveHdr.dataChunkLength) / static_cast <float> (waveHdr.bytesPerSecond);
|
return 1.0f * weh.read32 (header.dataChunkLength) / (weh.read16 (header.bitsPerSample) / 8) / weh.read16 (header.numChannels) / weh.read32 (header.sampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Game::isDedicated () {
|
bool Game::isDedicated () {
|
||||||
|
|
|
||||||
|
|
@ -943,7 +943,7 @@ CR_EXPORT void Meta_Init () {
|
||||||
# elif defined(CR_CXX_CLANG) || defined(CR_CXX_GCC) || defined(CR_ARCH_X64)
|
# elif defined(CR_CXX_CLANG) || defined(CR_CXX_GCC) || defined(CR_ARCH_X64)
|
||||||
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void CR_STDCALL
|
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void CR_STDCALL
|
||||||
# endif
|
# endif
|
||||||
#elif defined(CR_LINUX) || defined (CR_OSX) || defined (CR_ANDROID)
|
#else
|
||||||
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void
|
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ void BotManager::serverFill (int selection, int personality, int difficulty, int
|
||||||
void BotManager::kickEveryone (bool instant, bool zeroQuota) {
|
void BotManager::kickEveryone (bool instant, bool zeroQuota) {
|
||||||
// this function drops all bot clients from server (this function removes only yapb's)
|
// this function drops all bot clients from server (this function removes only yapb's)
|
||||||
|
|
||||||
if (cv_quota.bool_ ()) {
|
if (cv_quota.bool_ () && getBotCount () > 0) {
|
||||||
ctrl.msg ("Bots are removed from server.");
|
ctrl.msg ("Bots are removed from server.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue