mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
Merge pull request #191 from Adidasman1/master
ReHLDS API: Add hook on SV_Spawn_f
This commit is contained in:
commit
1c7d03e3c7
@ -846,7 +846,7 @@ qboolean Netchan_Process(netchan_t *chan)
|
||||
{
|
||||
// Make sure we actually could have ack'd this message
|
||||
#ifdef REHLDS_FIXES
|
||||
if (sequence_ack >= chan->last_reliable_sequence)
|
||||
if (sequence_ack >= (unsigned)chan->last_reliable_sequence)
|
||||
#else // REHLDS_FIXES
|
||||
if (chan->incoming_acknowledged + 1 >= chan->last_reliable_sequence)
|
||||
#endif // REHLDS_FIXES
|
||||
|
@ -644,6 +644,7 @@ void SV_SendUserReg(sizebuf_t *msg);
|
||||
void SV_New_f(void);
|
||||
void SV_SendRes_f(void);
|
||||
void SV_Spawn_f(void);
|
||||
void SV_Spawn_f_internal(void);
|
||||
void SV_CheckUpdateRate(double *rate);
|
||||
void SV_RejectConnection(netadr_t *adr, char *fmt, ...);
|
||||
void SV_RejectConnectionForPassword(netadr_t *adr);
|
||||
|
@ -1663,8 +1663,13 @@ void SV_SendRes_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* <a8922> ../engine/sv_main.c:2096 */
|
||||
void SV_Spawn_f(void)
|
||||
{
|
||||
g_RehldsHookchains.m_SV_Spawn_f.callChain(SV_Spawn_f_internal);
|
||||
}
|
||||
|
||||
/* <a8922> ../engine/sv_main.c:2096 */
|
||||
void EXT_FUNC SV_Spawn_f_internal(void)
|
||||
{
|
||||
unsigned char data[NET_MAX_PAYLOAD];
|
||||
sizebuf_t msg;
|
||||
@ -2118,7 +2123,7 @@ void SV_ReplaceSpecialCharactersInName(char *newname, const char *oldname)
|
||||
break;
|
||||
|
||||
// http://unicode-table.com/blocks/halfwidth-and-fullwidth-forms/
|
||||
newname[n++] = 0xEF;
|
||||
newname[n++] = char(0xEF);
|
||||
newname[n++] = 0xBC | (((*s - 0x20) & 0x40) >> 6);
|
||||
newname[n++] = 0x80 + ((*s - 0x20) & 0x3F);
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "model.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 2
|
||||
#define REHLDS_API_VERSION_MINOR 10
|
||||
#define REHLDS_API_VERSION_MINOR 11
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -177,6 +177,10 @@ typedef IVoidHookChainRegistry<struct cvar_s *, const char *> IRehldsHookRegistr
|
||||
typedef IVoidHookChain<IGameClient *, usercmd_t *, int, int, int> IRehldsHook_SV_EstablishTimeBase;
|
||||
typedef IVoidHookChainRegistry<IGameClient *, usercmd_t *, int, int, int> IRehldsHookRegistry_SV_EstablishTimeBase;
|
||||
|
||||
//SV_Spawn_f hook
|
||||
typedef IVoidHookChain<> IRehldsHook_SV_Spawn_f;
|
||||
typedef IVoidHookChainRegistry<> IRehldsHookRegistry_SV_Spawn_f;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
virtual ~IRehldsHookchains() { }
|
||||
@ -216,6 +220,7 @@ public:
|
||||
virtual IRehldsHookRegistry_Steam_GSBUpdateUserData* Steam_GSBUpdateUserData() = 0;
|
||||
virtual IRehldsHookRegistry_Cvar_DirectSet* Cvar_DirectSet() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase() = 0;
|
||||
virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
|
@ -368,6 +368,10 @@ IRehldsHookRegistry_SV_EstablishTimeBase* CRehldsHookchains::SV_EstablishTimeBas
|
||||
return &m_SV_EstablishTimeBase;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_Spawn_f* CRehldsHookchains::SV_Spawn_f() {
|
||||
return &m_SV_Spawn_f;
|
||||
}
|
||||
|
||||
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
||||
{
|
||||
return REHLDS_API_VERSION_MAJOR;
|
||||
|
@ -171,6 +171,10 @@ typedef IVoidHookChainRegistryImpl<struct cvar_s *, const char *> CRehldsHookReg
|
||||
typedef IVoidHookChainImpl<IGameClient *, usercmd_t *, int, int, int> CRehldsHook_SV_EstablishTimeBase;
|
||||
typedef IVoidHookChainRegistryImpl<IGameClient *, usercmd_t *, int, int, int> CRehldsHookRegistry_SV_EstablishTimeBase;
|
||||
|
||||
//SV_Spawn_f hook
|
||||
typedef IVoidHookChainImpl<> CRehldsHook_SV_Spawn_f;
|
||||
typedef IVoidHookChainRegistryImpl<> CRehldsHookRegistry_SV_Spawn_f;
|
||||
|
||||
class CRehldsHookchains : public IRehldsHookchains {
|
||||
public:
|
||||
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
||||
@ -208,6 +212,7 @@ public:
|
||||
CRehldsHookRegistry_Steam_GSBUpdateUserData m_Steam_GSBUpdateUserData;
|
||||
CRehldsHookRegistry_Cvar_DirectSet m_Cvar_DirectSet;
|
||||
CRehldsHookRegistry_SV_EstablishTimeBase m_SV_EstablishTimeBase;
|
||||
CRehldsHookRegistry_SV_Spawn_f m_SV_Spawn_f;
|
||||
|
||||
public:
|
||||
virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||
@ -245,6 +250,7 @@ public:
|
||||
virtual IRehldsHookRegistry_Steam_GSBUpdateUserData* Steam_GSBUpdateUserData();
|
||||
virtual IRehldsHookRegistry_Cvar_DirectSet* Cvar_DirectSet();
|
||||
virtual IRehldsHookRegistry_SV_EstablishTimeBase* SV_EstablishTimeBase();
|
||||
virtual IRehldsHookRegistry_SV_Spawn_f* SV_Spawn_f();
|
||||
};
|
||||
|
||||
extern CRehldsHookchains g_RehldsHookchains;
|
||||
|
Loading…
Reference in New Issue
Block a user