mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
ReHLDS API: Added interceptor for string commands handled by the engine
Mark rehlds_syserror() as noreturn Added missing includes in ReHLDS API
This commit is contained in:
parent
f5a9f2e413
commit
90f24f0413
@ -944,21 +944,7 @@ bool ValidateCmd_API(const char* cmd, cmd_source_t src, IGameClient* client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* <5d4e> ../engine/cmd.c:1133 */
|
||||
void Cmd_ExecuteString(char *text, cmd_source_t src)
|
||||
{
|
||||
cmd_source = src;
|
||||
Cmd_TokenizeString(text);
|
||||
|
||||
if (!Cmd_Argc())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IGameClient* cl = (src == src_client) ? GetRehldsApiClient(host_client) : NULL;
|
||||
if (!g_RehldsHookchains.m_ValidateCommand.callChain(ValidateCmd_API, cmd_argv[0], src, cl))
|
||||
return;
|
||||
|
||||
void Cmd_ExecuteString_internal(const char* cmdName, cmd_source_t src, IGameClient* client) {
|
||||
// Search in functions
|
||||
cmd_function_t *cmd = cmd_functions;
|
||||
while (cmd)
|
||||
@ -984,7 +970,7 @@ void Cmd_ExecuteString(char *text, cmd_source_t src)
|
||||
{
|
||||
if (!Q_stricmp(cmd_argv[0], a->name))
|
||||
{
|
||||
|
||||
|
||||
Cbuf_InsertText(a->value);
|
||||
return;
|
||||
}
|
||||
@ -1000,6 +986,24 @@ void Cmd_ExecuteString(char *text, cmd_source_t src)
|
||||
}
|
||||
}
|
||||
|
||||
/* <5d4e> ../engine/cmd.c:1133 */
|
||||
void Cmd_ExecuteString(char *text, cmd_source_t src)
|
||||
{
|
||||
cmd_source = src;
|
||||
Cmd_TokenizeString(text);
|
||||
|
||||
if (!Cmd_Argc())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IGameClient* cl = (src == src_client) ? GetRehldsApiClient(host_client) : NULL;
|
||||
if (!g_RehldsHookchains.m_ValidateCommand.callChain(ValidateCmd_API, cmd_argv[0], src, cl))
|
||||
return;
|
||||
|
||||
g_RehldsHookchains.m_ExecuteServerStringCmd.callChain(Cmd_ExecuteString_internal, cmd_argv[0], src, cl);
|
||||
}
|
||||
|
||||
/* <5c15> ../engine/cmd.c:1181 */
|
||||
qboolean Cmd_ForwardToServerInternal(sizebuf_t *pBuf)
|
||||
{
|
||||
|
@ -175,6 +175,6 @@
|
||||
static const bool __isLinux = true;
|
||||
#endif
|
||||
|
||||
extern void rehlds_syserror(const char* fmt, ...);
|
||||
extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...);
|
||||
|
||||
#endif // _OSCONFIG_H
|
||||
|
@ -97,6 +97,10 @@ typedef IHookChainRegistry<bool, uint8*, unsigned int, const netadr_t&> IRehldsH
|
||||
typedef IHookChain<bool, const char*, cmd_source_t, IGameClient*> IRehldsHook_ValidateCommand;
|
||||
typedef IHookChainRegistry<bool, const char*, cmd_source_t, IGameClient*> IRehldsHookRegistry_ValidateCommand;
|
||||
|
||||
//ExecuteServerStringCmd
|
||||
typedef IVoidHookChain<const char*, cmd_source_t, IGameClient*> IRehldsHook_ExecuteServerStringCmd;
|
||||
typedef IVoidHookChainRegistry<const char*, cmd_source_t, IGameClient*> IRehldsHookRegistry_ExecuteServerStringCmd;
|
||||
|
||||
//ClientConnected
|
||||
typedef IVoidHookChain<IGameClient*> IRehldsHook_ClientConnected;
|
||||
typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_ClientConnected;
|
||||
@ -136,6 +140,7 @@ public:
|
||||
virtual IRehldsHookRegistry_HandleNetCommand* HandleNetCommand() = 0;
|
||||
virtual IRehldsHookRegistry_Mod_LoadBrushModel* Mod_LoadBrushModel() = 0;
|
||||
virtual IRehldsHookRegistry_Mod_LoadStudioModel* Mod_LoadStudioModel() = 0;
|
||||
virtual IRehldsHookRegistry_ExecuteServerStringCmd* ExecuteServerStringCmd() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
|
@ -27,6 +27,10 @@
|
||||
*/
|
||||
#include "sys_shared.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#include <cpuid.h>
|
||||
#endif
|
||||
|
||||
#define SSE3_FLAG (1<<0)
|
||||
#define SSSE3_FLAG (1<<9)
|
||||
#define SSE4_1_FLAG (1<<19)
|
||||
|
@ -27,6 +27,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <archtypes.h>
|
||||
|
||||
typedef struct cpuinfo_s
|
||||
{
|
||||
uint8 sse3, ssse3, sse4_1, sse4_2, avx, avx2;
|
||||
|
@ -191,7 +191,7 @@ void CSimplePlatform::SteamAPI_UnregisterCallback(CCallbackBase *pCallback)
|
||||
::SteamAPI_UnregisterCallback(pCallback);
|
||||
}
|
||||
|
||||
void rehlds_syserror(const char* fmt, ...) {
|
||||
void __declspec(noreturn) rehlds_syserror(const char* fmt, ...) {
|
||||
va_list argptr;
|
||||
static char string[8192];
|
||||
|
||||
|
@ -185,6 +185,10 @@ IRehldsHookRegistry_Mod_LoadStudioModel* CRehldsHookchains::Mod_LoadStudioModel(
|
||||
return &m_Mod_LoadStudioModel;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_ExecuteServerStringCmd* CRehldsHookchains::ExecuteServerStringCmd() {
|
||||
return &m_ExecuteServerStringCmd;
|
||||
}
|
||||
|
||||
int CRehldsApi::GetMajorVersion()
|
||||
{
|
||||
return REHLDS_API_VERSION_MAJOR;
|
||||
|
@ -91,6 +91,10 @@ typedef IHookChainRegistryImpl<bool, uint8*, unsigned int, const netadr_t&> CReh
|
||||
typedef IHookChainImpl<bool, const char*, cmd_source_t, IGameClient*> CRehldsHook_ValidateCommand;
|
||||
typedef IHookChainRegistryImpl<bool, const char*, cmd_source_t, IGameClient*> CRehldsHookRegistry_ValidateCommand;
|
||||
|
||||
//ExecuteServerStringCmd
|
||||
typedef IVoidHookChainImpl<const char*, cmd_source_t, IGameClient*> CRehldsHook_ExecuteServerStringCmd;
|
||||
typedef IVoidHookChainRegistryImpl<const char*, cmd_source_t, IGameClient*> CRehldsHookRegistry_ExecuteServerStringCmd;
|
||||
|
||||
//ClientConnected
|
||||
typedef IVoidHookChainImpl<IGameClient*> CRehldsHook_ClientConnected;
|
||||
typedef IVoidHookChainRegistryImpl<IGameClient*> CRehldsHookRegistry_ClientConnected;
|
||||
@ -128,6 +132,7 @@ public:
|
||||
CRehldsHookRegistry_HandleNetCommand m_HandleNetCommand;
|
||||
CRehldsHookRegistry_Mod_LoadBrushModel m_Mod_LoadBrushModel;
|
||||
CRehldsHookRegistry_Mod_LoadStudioModel m_Mod_LoadStudioModel;
|
||||
CRehldsHookRegistry_ExecuteServerStringCmd m_ExecuteServerStringCmd;
|
||||
|
||||
public:
|
||||
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||
@ -149,6 +154,7 @@ public:
|
||||
virtual IRehldsHookRegistry_HandleNetCommand* HandleNetCommand();
|
||||
virtual IRehldsHookRegistry_Mod_LoadBrushModel* Mod_LoadBrushModel();
|
||||
virtual IRehldsHookRegistry_Mod_LoadStudioModel* Mod_LoadStudioModel();
|
||||
virtual IRehldsHookRegistry_ExecuteServerStringCmd* ExecuteServerStringCmd();
|
||||
};
|
||||
|
||||
extern CRehldsHookchains g_RehldsHookchains;
|
||||
|
Loading…
Reference in New Issue
Block a user