mirror of
https://github.com/rehlds/revoice.git
synced 2024-12-27 23:25:53 +03:00
Upgrade ReHLDS api
This commit is contained in:
parent
a0c2aae7d2
commit
1ed90219f9
@ -19,6 +19,18 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// Max # of clients allowed in a server.
|
||||
#define MAX_CLIENTS 32
|
||||
|
||||
// How many bits to use to encode an edict.
|
||||
#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts
|
||||
// Max # of edicts in a level (2048)
|
||||
#define MAX_EDICTS (1<<MAX_EDICT_BITS)
|
||||
|
||||
// How many data slots to use when in multiplayer (must be power of 2)
|
||||
#define MULTIPLAYER_BACKUP 64
|
||||
// Same for single player
|
||||
#define SINGLEPLAYER_BACKUP 8
|
||||
//
|
||||
// Constants shared by the engine and dlls
|
||||
// This header file included by engine files and DLL files.
|
||||
|
39
dep/rehlsdk/common/qlimits.h
Normal file
39
dep/rehlsdk/common/qlimits.h
Normal file
@ -0,0 +1,39 @@
|
||||
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ==========
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#ifndef QLIMITS_H
|
||||
#define QLIMITS_H
|
||||
|
||||
#if defined( _WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// DATA STRUCTURE INFO
|
||||
|
||||
#define MAX_NUM_ARGVS 50
|
||||
|
||||
// SYSTEM INFO
|
||||
#define MAX_QPATH 64 // max length of a game pathname
|
||||
#define MAX_OSPATH 260 // max length of a filesystem pathname
|
||||
|
||||
#define ON_EPSILON 0.1 // point on plane side epsilon
|
||||
|
||||
#define MAX_LIGHTSTYLE_INDEX_BITS 6
|
||||
#define MAX_LIGHTSTYLES (1<<MAX_LIGHTSTYLE_INDEX_BITS)
|
||||
|
||||
// Resource counts;
|
||||
#define MAX_MODEL_INDEX_BITS 9 // sent as a short
|
||||
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
|
||||
#define MAX_SOUND_INDEX_BITS 9
|
||||
#define MAX_SOUNDS (1<<MAX_SOUND_INDEX_BITS)
|
||||
|
||||
#define MAX_GENERIC_INDEX_BITS 9
|
||||
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
|
||||
#define MAX_DECAL_INDEX_BITS 9
|
||||
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
|
||||
|
||||
#endif // QLIMITS_H
|
@ -30,6 +30,9 @@
|
||||
/* <19039> ../common/quakedef.h:29 */
|
||||
typedef int BOOL; /* size: 4 */
|
||||
|
||||
// user message
|
||||
#define MAX_USER_MSG_DATA 192
|
||||
|
||||
/* <627f> ../common/quakedef.h:137 */
|
||||
//moved to com_model.h
|
||||
//typedef struct cache_user_s
|
||||
|
@ -28,8 +28,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "const.h"
|
||||
#include "qlimits.h"
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
#define COM_TOKEN_LEN 2048
|
||||
#else
|
||||
#define COM_TOKEN_LEN 1024
|
||||
#endif
|
||||
|
||||
// Don't allow overflow
|
||||
#define SIZEBUF_CHECK_OVERFLOW 0
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "const.h"
|
||||
|
||||
#define MAX_QPATH 64 // Must match value in quakedefs.h
|
||||
#define MAX_RESOURCE_LIST 1280
|
||||
|
||||
/////////////////
|
||||
// Customization
|
||||
|
@ -493,7 +493,7 @@ typedef struct
|
||||
|
||||
// Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max
|
||||
// size of the response_buffer, so you must zero it out if you choose not to respond.
|
||||
int (*pfnConnectionlessPacket ) ( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
|
||||
int (*pfnConnectionlessPacket ) ( const struct netadr_s *net_from_, const char *args, char *response_buffer, int *response_buffer_size );
|
||||
|
||||
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
|
||||
int (*pfnGetHullBounds) ( int hullnumber, float *mins, float *maxs );
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "model.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 2
|
||||
#define REHLDS_API_VERSION_MINOR 2
|
||||
#define REHLDS_API_VERSION_MINOR 3
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -141,9 +141,21 @@ typedef IVoidHookChainRegistry<edict_t *, int, const char *, float, float, int,
|
||||
typedef IVoidHookChain<IGameClient *, char *, size_t, sizebuf_t *, IGameClient *> IRehldsHook_SV_WriteFullClientUpdate;
|
||||
typedef IVoidHookChainRegistry<IGameClient *, char *, size_t, sizebuf_t *, IGameClient *> IRehldsHookRegistry_SV_WriteFullClientUpdate;
|
||||
|
||||
//SV_GenericFileConsistencyResponce hook
|
||||
typedef IVoidHookChain<IGameClient *, resource_t *, uint32> IRehldsHook_GenericFileConsistencyResponce;
|
||||
typedef IVoidHookChainRegistry<IGameClient *, resource_t *, uint32> IRehldsHookRegistry_GenericFileConsistencyResponce;
|
||||
//SV_CheckConsistencyResponse hook
|
||||
typedef IHookChain<bool, IGameClient *, resource_t *, uint32> IRehldsHook_SV_CheckConsistencyResponse;
|
||||
typedef IHookChainRegistry<bool, IGameClient *, resource_t *, uint32> IRehldsHookRegistry_SV_CheckConsistencyResponse;
|
||||
|
||||
//SV_DropClient hook
|
||||
typedef IVoidHookChain<IGameClient*, bool, const char*> IRehldsHook_SV_DropClient;
|
||||
typedef IVoidHookChainRegistry<IGameClient*, bool, const char*> IRehldsHookRegistry_SV_DropClient;
|
||||
|
||||
//SV_ActivateServer hook
|
||||
typedef IVoidHookChain<int> IRehldsHook_SV_ActivateServer;
|
||||
typedef IVoidHookChainRegistry<int> IRehldsHookRegistry_SV_ActivateServer;
|
||||
|
||||
//SV_WriteVoiceCodec hook
|
||||
typedef IVoidHookChain<sizebuf_t *> IRehldsHook_SV_WriteVoiceCodec;
|
||||
typedef IVoidHookChainRegistry<sizebuf_t *> IRehldsHookRegistry_SV_WriteVoiceCodec;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
@ -175,7 +187,10 @@ public:
|
||||
virtual IRehldsHookRegistry_PF_Remove_I* PF_Remove_I() = 0;
|
||||
virtual IRehldsHookRegistry_PF_BuildSoundMsg_I* PF_BuildSoundMsg_I() = 0;
|
||||
virtual IRehldsHookRegistry_SV_WriteFullClientUpdate* SV_WriteFullClientUpdate() = 0;
|
||||
virtual IRehldsHookRegistry_GenericFileConsistencyResponce* GenericFileConsistencyResponce() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CheckConsistencyResponse* SV_CheckConsistencyResponse() = 0;
|
||||
virtual IRehldsHookRegistry_SV_DropClient* SV_DropClient() = 0;
|
||||
virtual IRehldsHookRegistry_SV_ActivateServer* SV_ActivateServer() = 0;
|
||||
virtual IRehldsHookRegistry_SV_WriteVoiceCodec* SV_WriteVoiceCodec() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
@ -211,6 +226,13 @@ struct RehldsFuncs_t {
|
||||
void*(*SZ_GetSpace)(sizebuf_t *buf, int length);
|
||||
cvar_t*(*GetCvarVars)();
|
||||
int (*SV_GetChallenge)(const netadr_t& adr);
|
||||
void (*SV_AddResource)(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
||||
int(*MSG_ReadShort)(void);
|
||||
int(*MSG_ReadBuf)(int iSize, void *pbuf);
|
||||
void(*MSG_WriteBuf)(sizebuf_t *sb, int iSize, void *buf);
|
||||
void(*MSG_WriteByte)(sizebuf_t *sb, int c);
|
||||
void(*MSG_WriteShort)(sizebuf_t *sb, int c);
|
||||
void(*MSG_WriteString)(sizebuf_t *sb, const char *s);
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
|
@ -67,6 +67,9 @@ public:
|
||||
virtual bool IsConnected() = 0;
|
||||
virtual void SetConnected(bool connected) = 0;
|
||||
|
||||
virtual uint32 GetVoiceStreams(int id) = 0;
|
||||
virtual double GetLastVoiceTime() = 0;
|
||||
virtual bool GetLoopback() = 0;
|
||||
|
||||
// this must be the last virtual function in class
|
||||
#ifdef REHLDS_SELF
|
||||
@ -113,4 +116,10 @@ public:
|
||||
virtual sizebuf_t* GetReliableDatagram() = 0;
|
||||
|
||||
virtual void SetModelName(const char* modelname) = 0;
|
||||
virtual void SetConsistencyNum(int num) = 0;
|
||||
virtual int GetConsistencyNum() = 0;
|
||||
virtual int GetResourcesNum() = 0;
|
||||
virtual int GetDecalNameNum() = 0;
|
||||
|
||||
virtual double GetTime() = 0;
|
||||
};
|
||||
|
@ -42,14 +42,9 @@ cpuinfo_t cpuinfo;
|
||||
|
||||
void Sys_CheckCpuInstructionsSupport(void)
|
||||
{
|
||||
unsigned int cpuid_data[4];
|
||||
int cpuid_data[4];
|
||||
|
||||
// eax = 1, ecx = 0
|
||||
#if defined(__GNUC__)
|
||||
__get_cpuid(0x1, &cpuid_data[0], &cpuid_data[1], &cpuid_data[2], &cpuid_data[3]);
|
||||
#else //__GNUC__
|
||||
__cpuidex((int*)cpuid_data, 1, 0);
|
||||
#endif //__GNUC__
|
||||
cpuid_ex(cpuid_data, 1, 0);
|
||||
|
||||
cpuinfo.sse3 = (cpuid_data[2] & SSE3_FLAG) ? 1 : 0; // ecx
|
||||
cpuinfo.ssse3 = (cpuid_data[2] & SSSE3_FLAG) ? 1 : 0;
|
||||
@ -57,12 +52,7 @@ void Sys_CheckCpuInstructionsSupport(void)
|
||||
cpuinfo.sse4_2 = (cpuid_data[2] & SSE4_2_FLAG) ? 1 : 0;
|
||||
cpuinfo.avx = (cpuid_data[2] & AVX_FLAG) ? 1 : 0;
|
||||
|
||||
// eax = 7, ecx = 0
|
||||
#if defined(__GNUC__)
|
||||
__get_cpuid(0x7, &cpuid_data[0], &cpuid_data[1], &cpuid_data[2], &cpuid_data[3]);
|
||||
#else //__GNUC__
|
||||
__cpuidex((int*)cpuid_data, 7, 0);
|
||||
#endif //__GNUC__
|
||||
cpuid_ex(cpuid_data, 7, 0);
|
||||
|
||||
cpuinfo.avx2 = (cpuid_data[1] & AVX2_FLAG) ? 1 : 0; // ebx
|
||||
}
|
Loading…
Reference in New Issue
Block a user