mirror of
https://github.com/rehlds/reapi.git
synced 2025-03-13 05:50:16 +03:00
Add pr_dlls.h
& fix GetEntityInit()
return type (#228)
* Add pr_dlls.h * fix GetEntityInit hook return type * add getApiType(ENTITYINIT) type cast * remove extra cast from callNext() * indent fix
This commit is contained in:
parent
a16dfd08fa
commit
de26345d27
51
reapi/include/cssdk/engine/pr_dlls.h
Normal file
51
reapi/include/cssdk/engine/pr_dlls.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
*
|
||||
* 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 "maintypes.h"
|
||||
#include "eiface.h"
|
||||
|
||||
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);
|
@ -33,6 +33,7 @@
|
||||
#include "FlightRecorder.h"
|
||||
#include "interface.h"
|
||||
#include "model.h"
|
||||
#include "pr_dlls.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 3
|
||||
#define REHLDS_API_VERSION_MINOR 11
|
||||
@ -206,8 +207,8 @@ typedef IHookChain<bool, IGameClient*, bool> IRehldsHook_SV_ShouldSendConsistenc
|
||||
typedef IHookChainRegistry<bool, IGameClient*, bool> IRehldsHookRegistry_SV_ShouldSendConsistencyList;
|
||||
|
||||
//GetEntityInit hook
|
||||
typedef IHookChain<struct entvars_s *, char *> IRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistry<struct entvars_s *, char *> IRehldsHookRegistry_GetEntityInit;
|
||||
typedef IHookChain<ENTITYINIT, char *> IRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistry<ENTITYINIT, char *> IRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//SV_EmitPings hook
|
||||
typedef IHookChain<void, IGameClient *, sizebuf_t *> IRehldsHook_SV_EmitPings;
|
||||
|
@ -63,14 +63,14 @@ void SV_WriteFullClientUpdate(IRehldsHook_SV_WriteFullClientUpdate *chain, IGame
|
||||
SV_WriteFullClientUpdate_AMXX(&data, client, (size_t)buffer, receiver);
|
||||
}
|
||||
|
||||
entvars_t *GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname)
|
||||
ENTITYINIT GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname)
|
||||
{
|
||||
auto original = [chain](char *_classname)
|
||||
{
|
||||
return (entvars_t *)chain->callNext(_classname);
|
||||
return chain->callNext(_classname);
|
||||
};
|
||||
|
||||
return callForward<entvars_t *>(RH_GetEntityInit, original, classname);
|
||||
return callForward<ENTITYINIT>(RH_GetEntityInit, original, classname);
|
||||
}
|
||||
|
||||
void ClientConnected(IRehldsHook_ClientConnected* chain, IGameClient* cl)
|
||||
|
@ -52,6 +52,7 @@ inline AType getApiType(edict_t *) { return ATYPE_EDICT; }
|
||||
inline AType getApiType(entvars_t *) { return ATYPE_EVARS; }
|
||||
inline AType getApiType(bool) { return ATYPE_BOOL; }
|
||||
inline AType getApiType(Vector) { return ATYPE_VECTOR; }
|
||||
inline AType getApiType(ENTITYINIT) { return ATYPE_INTEGER; }
|
||||
|
||||
template<typename T>
|
||||
inline AType getApiType(T *) { return ATYPE_INTEGER; }
|
||||
@ -344,7 +345,7 @@ struct SV_WriteFullClientUpdate_args_t
|
||||
using SV_WriteFullClientUpdate_t = hookdata_t<IRehldsHook_SV_WriteFullClientUpdate *, SV_WriteFullClientUpdate_args_t &>;
|
||||
void SV_WriteFullClientUpdate_AMXX(SV_WriteFullClientUpdate_t *data, IGameClient *client, size_t buffer, IGameClient *receiver);
|
||||
void SV_WriteFullClientUpdate(IRehldsHook_SV_WriteFullClientUpdate *chain, IGameClient *client, char *buffer, size_t maxlen, sizebuf_t *sb, IGameClient *receiver);
|
||||
entvars_s *GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname);
|
||||
ENTITYINIT GetEntityInit(IRehldsHook_GetEntityInit *chain, char *classname);
|
||||
|
||||
struct SV_EmitPings_args_t
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user