mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-04 02:55:50 +03:00
Merge pull request #137 from theAsmodai/master
Fixed userid serialization hook
This commit is contained in:
commit
011f5126ce
@ -544,10 +544,14 @@ void Decal_Init(void)
|
|||||||
char pszPathID[2][15] = { "DEFAULTGAME", "GAME" };
|
char pszPathID[2][15] = { "DEFAULTGAME", "GAME" };
|
||||||
|
|
||||||
Draw_DecalShutdown();
|
Draw_DecalShutdown();
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < ARRAYSIZE(pszPathID); i++)
|
||||||
{
|
{
|
||||||
hfile = FS_OpenPathID("decals.wad", "rb", pszPathID[i]);
|
hfile = FS_OpenPathID("decals.wad", "rb", pszPathID[i]);
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
if (i == ARRAYSIZE(pszPathID) - 1 && !hfile)
|
||||||
|
#else
|
||||||
if (i == 0 && !hfile)
|
if (i == 0 && !hfile)
|
||||||
|
#endif
|
||||||
Sys_Error("Couldn't find '%s' in \"%s\" search path\n", "decals.wad", pszPathID[i]);
|
Sys_Error("Couldn't find '%s' in \"%s\" search path\n", "decals.wad", pszPathID[i]);
|
||||||
|
|
||||||
filesize = FS_Size(hfile);
|
filesize = FS_Size(hfile);
|
||||||
@ -567,8 +571,8 @@ void Decal_Init(void)
|
|||||||
for (i = 0; i < sv_decalnamecount; i++)
|
for (i = 0; i < sv_decalnamecount; i++)
|
||||||
{
|
{
|
||||||
Q_memset(&sv_decalnames[i], 0, sizeof(decalname_t));
|
Q_memset(&sv_decalnames[i], 0, sizeof(decalname_t));
|
||||||
Q_strncpy(sv_decalnames[i].name, Draw_DecalName(i), 15);
|
Q_strncpy(sv_decalnames[i].name, Draw_DecalName(i), sizeof sv_decalnames[i].name - 1);
|
||||||
sv_decalnames[i].name[15] = 0;
|
sv_decalnames[i].name[sizeof sv_decalnames[i].name - 1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4820,6 +4820,9 @@ void SV_ExtractFromUserinfo(client_t *cl)
|
|||||||
*p = ' ';
|
*p = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix name to not start with '#', so it will not resemble userid
|
||||||
|
for (char *p = newname; *p == '#'; p++) *p = ' ';
|
||||||
|
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
Q_StripUnprintableAndSpace(newname);
|
Q_StripUnprintableAndSpace(newname);
|
||||||
#else // REHLDS_FIXES
|
#else // REHLDS_FIXES
|
||||||
@ -4831,9 +4834,6 @@ void SV_ExtractFromUserinfo(client_t *cl)
|
|||||||
Q_UnicodeRepair(newname);
|
Q_UnicodeRepair(newname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix name to not start with '#', so it will not resemble userid
|
|
||||||
for (char *p = newname; *p == '#'; p++) *p = ' ';
|
|
||||||
|
|
||||||
if (newname[0] == '\0' || !Q_stricmp(newname, "console")
|
if (newname[0] == '\0' || !Q_stricmp(newname, "console")
|
||||||
#ifdef REHLDS_FIXES
|
#ifdef REHLDS_FIXES
|
||||||
|| Q_strstr(newname, "..") != NULL)
|
|| Q_strstr(newname, "..") != NULL)
|
||||||
@ -5841,6 +5841,11 @@ USERID_t *SV_StringToUserID(const char *str)
|
|||||||
return &id;
|
return &id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SV_SerializeSteamid(USERID_t* id, USERID_t* serialized)
|
||||||
|
{
|
||||||
|
*serialized = *id;
|
||||||
|
}
|
||||||
|
|
||||||
/* <ab410> ../engine/sv_main.c:7799 */
|
/* <ab410> ../engine/sv_main.c:7799 */
|
||||||
void SV_BanId_f(void)
|
void SV_BanId_f(void)
|
||||||
{
|
{
|
||||||
@ -5953,10 +5958,8 @@ void SV_BanId_f(void)
|
|||||||
userfilters[i].banTime = banTime;
|
userfilters[i].banTime = banTime;
|
||||||
userfilters[i].banEndTime = (banTime == 0.0f) ? 0.0f : banTime * 60.0f + realtime;
|
userfilters[i].banEndTime = (banTime == 0.0f) ? 0.0f : banTime * 60.0f + realtime;
|
||||||
|
|
||||||
Q_memcpy(&userfilters[i].userid, id, sizeof(USERID_t));
|
|
||||||
|
|
||||||
// give 3-rd party plugins a chance to serialize ID
|
// give 3-rd party plugins a chance to serialize ID
|
||||||
g_RehldsHookchains.m_SerializeSteamId.callChain(NULL, &userfilters[i].userid);
|
g_RehldsHookchains.m_SerializeSteamId.callChain(SV_SerializeSteamid, id, &userfilters[i].userid);
|
||||||
|
|
||||||
if (banTime == 0.0f)
|
if (banTime == 0.0f)
|
||||||
Q_sprintf(szreason, "permanently");
|
Q_sprintf(szreason, "permanently");
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
|
||||||
#define REHLDS_API_VERSION_MAJOR 2
|
#define REHLDS_API_VERSION_MAJOR 2
|
||||||
#define REHLDS_API_VERSION_MINOR 6
|
#define REHLDS_API_VERSION_MINOR 7
|
||||||
|
|
||||||
//Steam_NotifyClientConnect hook
|
//Steam_NotifyClientConnect hook
|
||||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||||
@ -78,8 +78,8 @@ typedef IHookChain<qboolean, IGameClient*> IRehldsHook_Steam_NotifyBotConnect;
|
|||||||
typedef IHookChainRegistry<qboolean, IGameClient*> IRehldsHookRegistry_Steam_NotifyBotConnect;
|
typedef IHookChainRegistry<qboolean, IGameClient*> IRehldsHookRegistry_Steam_NotifyBotConnect;
|
||||||
|
|
||||||
//SerializeSteamId
|
//SerializeSteamId
|
||||||
typedef IVoidHookChain<USERID_t*> IRehldsHook_SerializeSteamId;
|
typedef IVoidHookChain<USERID_t*, USERID_t*> IRehldsHook_SerializeSteamId;
|
||||||
typedef IVoidHookChainRegistry<USERID_t*> IRehldsHookRegistry_SerializeSteamId;
|
typedef IVoidHookChainRegistry<USERID_t*, USERID_t*> IRehldsHookRegistry_SerializeSteamId;
|
||||||
|
|
||||||
//SV_CompareUserID hook
|
//SV_CompareUserID hook
|
||||||
typedef IHookChain<qboolean, USERID_t*, USERID_t*> IRehldsHook_SV_CompareUserID;
|
typedef IHookChain<qboolean, USERID_t*, USERID_t*> IRehldsHook_SV_CompareUserID;
|
||||||
@ -169,7 +169,6 @@ typedef IHookChainRegistry<int> IRehldsHookRegistry_SV_TransferConsistencyInfo;
|
|||||||
typedef IHookChain<bool, uint64, const char *, uint32> IRehldsHook_Steam_GSBUpdateUserData;
|
typedef IHookChain<bool, uint64, const char *, uint32> IRehldsHook_Steam_GSBUpdateUserData;
|
||||||
typedef IHookChainRegistry<bool, uint64, const char *, uint32> IRehldsHookRegistry_Steam_GSBUpdateUserData;
|
typedef IHookChainRegistry<bool, uint64, const char *, uint32> IRehldsHookRegistry_Steam_GSBUpdateUserData;
|
||||||
|
|
||||||
//BUpdateUserData
|
|
||||||
class IRehldsHookchains {
|
class IRehldsHookchains {
|
||||||
public:
|
public:
|
||||||
virtual ~IRehldsHookchains() { }
|
virtual ~IRehldsHookchains() { }
|
||||||
|
@ -72,8 +72,8 @@ typedef IHookChainImpl<qboolean, IGameClient*> CRehldsHook_Steam_NotifyBotConnec
|
|||||||
typedef IHookChainRegistryImpl<qboolean, IGameClient*> CRehldsHookRegistry_Steam_NotifyBotConnect;
|
typedef IHookChainRegistryImpl<qboolean, IGameClient*> CRehldsHookRegistry_Steam_NotifyBotConnect;
|
||||||
|
|
||||||
//SerializeSteamId
|
//SerializeSteamId
|
||||||
typedef IVoidHookChainImpl<USERID_t*> CRehldsHook_SerializeSteamId;
|
typedef IVoidHookChainImpl<USERID_t*, USERID_t*> CRehldsHook_SerializeSteamId;
|
||||||
typedef IVoidHookChainRegistryImpl<USERID_t*> CRehldsHookRegistry_SerializeSteamId;
|
typedef IVoidHookChainRegistryImpl<USERID_t*, USERID_t*> CRehldsHookRegistry_SerializeSteamId;
|
||||||
|
|
||||||
//SV_CompareUserID hook
|
//SV_CompareUserID hook
|
||||||
typedef IHookChainImpl<qboolean, USERID_t*, USERID_t*> CRehldsHook_SV_CompareUserID;
|
typedef IHookChainImpl<qboolean, USERID_t*, USERID_t*> CRehldsHook_SV_CompareUserID;
|
||||||
|
Loading…
Reference in New Issue
Block a user