Update ReSDK API to latest version (#520)

This commit is contained in:
Vincent Herbet
2018-08-25 09:20:06 +02:00
committed by GitHub
parent ce14df0c77
commit f822cc610f
23 changed files with 891 additions and 308 deletions

View File

@ -0,0 +1,47 @@
/*
*
* 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
class IObjectContainer {
public:
virtual ~IObjectContainer() {}
virtual void Init() = 0;
virtual bool Add(void *newObject) = 0;
virtual bool Remove(void *object) = 0;
virtual void Clear(bool freeElementsMemory) = 0;
virtual void *GetFirst() = 0;
virtual void *GetNext() = 0;
virtual int CountElements() = 0;
virtual bool Contains(void *object) = 0;
virtual bool IsEmpty() = 0;
};

View File

@ -0,0 +1,65 @@
/*
*
* 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 "IObjectContainer.h"
class ObjectList: public IObjectContainer {
public:
EXT_FUNC void Init();
EXT_FUNC bool Add(void *newObject);
EXT_FUNC void *GetFirst();
EXT_FUNC void *GetNext();
ObjectList();
virtual ~ObjectList();
EXT_FUNC void Clear(bool freeElementsMemory = false);
EXT_FUNC int CountElements();
void *RemoveTail();
void *RemoveHead();
bool AddTail(void *newObject);
bool AddHead(void *newObject);
EXT_FUNC bool Remove(void *object);
EXT_FUNC bool Contains(void *object);
EXT_FUNC bool IsEmpty();
typedef struct element_s {
struct element_s *prev; // pointer to the last element or NULL
struct element_s *next; // pointer to the next elemnet or NULL
void *object; // the element's object
} element_t;
protected:
element_t *m_head; // first element in list
element_t *m_tail; // last element in list
element_t *m_current; // current element in list
int m_number;
};

View File

@ -27,11 +27,13 @@
*/
#pragma once
#include "archtypes.h"
typedef void(*xcommand_t)(void);
typedef struct cmd_function_s
{
struct cmd_function_s *next;
char *name;
const char *name;
xcommand_t function;
int flags;
} cmd_function_t;

View File

@ -0,0 +1,48 @@
/*
*
* 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
const int MAX_EXTENSION_DLL = 50;
typedef struct functiontable_s
{
uint32 pFunction;
char *pFunctionName;
} functiontable_t;
typedef struct extensiondll_s
{
void *lDLLHandle;
functiontable_t *functionTable;
int functionCount;
} extensiondll_t;
typedef void(*ENTITYINIT)(struct entvars_s *);
typedef void(*DISPATCHFUNCTION)(struct entvars_s *, void *);
typedef void(*FIELDIOFUNCTION)(SAVERESTOREDATA *, const char *, void *, TYPEDESCRIPTION *, int);

View File

@ -27,15 +27,25 @@
*/
#pragma once
#if defined(WIN32)
#define FORCE_STACK_ALIGN
#else
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
#endif
#define EXT_FUNC FORCE_STACK_ALIGN
#include <engine_strucs.h>
#include <com_model.h>
#include "cmd_rehlds.h"
#include "ObjectList.h"
#include "pr_dlls.h"
#include "rehlds_interfaces.h"
#include "FlightRecorder.h"
#include "../common/hookchains.h"
#define REHLDS_API_VERSION_MAJOR 3
#define REHLDS_API_VERSION_MINOR 0
#define REHLDS_API_VERSION_MINOR 4
//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
@ -189,6 +199,10 @@ typedef IHookChainRegistry<int, enum sv_delta_s, IGameClient *, struct packet_en
typedef IHookChain<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHook_SV_EmitSound2;
typedef IHookChainRegistry<bool, edict_t *, IGameClient *, int, const char*, float, float, int, int, int, const float*> IRehldsHookRegistry_SV_EmitSound2;
//CreateFakeClient hook
typedef IHookChain<edict_t *, const char *> IRehldsHook_CreateFakeClient;
typedef IHookChainRegistry<edict_t *, const char *> IRehldsHookRegistry_CreateFakeClient;
class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
@ -231,6 +245,7 @@ public:
virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0;
virtual IRehldsHookRegistry_SV_CreatePacketEntities* SV_CreatePacketEntities() = 0;
virtual IRehldsHookRegistry_SV_EmitSound2* SV_EmitSound2() = 0;
virtual IRehldsHookRegistry_CreateFakeClient* CreateFakeClient() = 0;
};
struct RehldsFuncs_t {
@ -267,7 +282,7 @@ struct RehldsFuncs_t {
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_ReadShort)();
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);
@ -282,6 +297,13 @@ struct RehldsFuncs_t {
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
void(*SV_UpdateUserInfo)(IGameClient *pGameClient);
bool(*StripUnprintableAndSpace)(char *pch);
void(*Cmd_RemoveCmd)(const char *cmd_name);
void(*GetCommandMatches)(const char *string, ObjectList *pMatchList);
bool(*AddExtDll)(void *hModule);
void(*AddCvarListener)(const char *var_name, cvar_callback_t func);
void(*RemoveExtDll)(void *hModule);
void(*RemoveCvarListener)(const char *var_name, cvar_callback_t func);
ENTITYINIT(*GetEntityInit)(char *pszClassName);
};
class IRehldsApi {
@ -297,4 +319,4 @@ public:
virtual IRehldsFlightRecorder* GetFlightRecorder() = 0;
};
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"

View File

@ -81,6 +81,7 @@ public:
virtual IGameClient* GetClient(int id) = 0;
virtual client_t* GetClient_t(int id) = 0;
virtual int GetIndexOfClient_t(client_t* client) = 0;
virtual int GetMaxClientsLimit() = 0;
};
class IRehldsServerData {