arch: added support for aarch64
This commit is contained in:
parent
bea8120a41
commit
1ecc0827c9
7 changed files with 83 additions and 48 deletions
|
|
@ -8,7 +8,7 @@
|
|||
#include <yapb.h>
|
||||
|
||||
// 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) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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;
|
||||
}
|
||||
|
||||
// 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
|
||||
struct WavHeader {
|
||||
char riffChunkId[4];
|
||||
unsigned long packageSize;
|
||||
char chunkID[4];
|
||||
char formatChunkId[4];
|
||||
unsigned long formatChunkLength;
|
||||
uint16 dummy;
|
||||
uint16 channels;
|
||||
unsigned long sampleRate;
|
||||
unsigned long bytesPerSecond;
|
||||
uint16 bytesPerSample;
|
||||
uint16 bitsPerSample;
|
||||
char riff[4];
|
||||
uint32_t chunkSize;
|
||||
char wave[4];
|
||||
char fmt[4];
|
||||
uint32_t subchunk1Size;
|
||||
uint16_t audioFormat;
|
||||
uint16_t numChannels;
|
||||
uint32_t sampleRate;
|
||||
uint32_t byteRate;
|
||||
uint16_t blockAlign;
|
||||
uint16_t bitsPerSample;
|
||||
char dataChunkId[4];
|
||||
unsigned long dataChunkLength;
|
||||
} waveHdr {};
|
||||
uint32_t dataChunkLength;
|
||||
} 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);
|
||||
return 0.0f;
|
||||
}
|
||||
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);
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (waveHdr.dataChunkLength == 0) {
|
||||
if (weh.read32 (header.dataChunkLength) == 0) {
|
||||
logger.error ("Wave File %s - has zero length!", filePath);
|
||||
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 () {
|
||||
|
|
|
|||
|
|
@ -943,7 +943,7 @@ CR_EXPORT void Meta_Init () {
|
|||
# elif defined(CR_CXX_CLANG) || defined(CR_CXX_GCC) || defined(CR_ARCH_X64)
|
||||
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void CR_STDCALL
|
||||
# endif
|
||||
#elif defined(CR_LINUX) || defined (CR_OSX) || defined (CR_ANDROID)
|
||||
#else
|
||||
# define DLL_GIVEFNPTRSTODLL CR_EXPORT void
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ void BotManager::serverFill (int selection, int personality, int difficulty, int
|
|||
void BotManager::kickEveryone (bool instant, bool zeroQuota) {
|
||||
// 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.");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue