mirror of
https://github.com/accelerator74/l4dtoolz.git
synced 2025-09-19 12:16:18 +08:00
Remove sv_removehumanlimit as it is no longer needed
Left4dead 2 no longer need sv_removehumanlimit and some of the old signatures are better approach for maxplayer is used. Signed-off-by: Ivailo Spasov <ivailosp@abv.bg>
This commit is contained in:
@ -5,10 +5,6 @@ const char* server_dll[] = {"server_srv.so", "server.so", 0};
|
||||
const char* engine_dll[] = {"engine_srv.so", "engine.so", 0};
|
||||
const char* matchmaking_dll[] = {"matchmaking_ds_srv.so", "matchmaking_srv.so", "matchmaking_ds.so", "matchmaking.so", 0};
|
||||
|
||||
const char* friends_lobby = "\x19\x55\x89\xE5\x53\x83\xEC\xC3\xA1\xC3\xC3\xC3\xC3\x8B\x5D\x08\x85\xC0\x74\x1D\x8B\x10\x89\x04\x24\xFF";
|
||||
unsigned char friends_lobby_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3};
|
||||
void *friends_lobby_org = NULL;
|
||||
|
||||
const char* lobby_sux = "\x13\xFF\x50\xC3\x84\xC0\x0F\x84\xC3\xC3\xC3\xC3\x8B\xB3\xC3\x01\x00\x00\x85\xF6";
|
||||
const char* lobby_sux_new = "\x06\x0B\xBE\x01\x00\x00\x00\x90";
|
||||
void *lobby_sux_org = NULL;
|
||||
@ -17,14 +13,10 @@ const char* max_players = "\x16\x89\xC6\x8B\x03\x89\x1C\x24\xFF\x50\xC3\x29\xC6\
|
||||
char max_players_new[]= {0x06, 0x0F, 0x83, 0xFE, 0x3C, 0x90, 0x90, 0x90};
|
||||
void *max_players_org = NULL;
|
||||
|
||||
const char* server_bplayers = "\x1A\xA1\xC3\xC3\xC3\xC3\x55\x89\xE5\x85\xC0\x74\xC3\x8B\x10\x89\x45\x08\x5D\x8B\x82\xC3\x02\x00\x00\xFF\xE0";
|
||||
const char* server_bplayers = "\x16\x55\x89\xE5\x83\xEC\x08\xE8\xC3\xC3\xC3\xC3\xC9\x3C\x01\x19\xC0\x83\xE0\xFC\x83\xC0\x08";
|
||||
unsigned char server_bplayers_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3};
|
||||
void *server_bplayers_org = NULL;
|
||||
|
||||
const char* human_limit = "\x18\x39\x58\x14\x7D\xD7\x8B\x07\x89\x3C\x24\xFF\x90\xC3\xC3\x00\x00\x39\xF0\x7E\xC3\x8B\x45\xC3\x89";
|
||||
const char* human_limit_new = "\x02\x12\x90\x90";
|
||||
void *human_limit_org = NULL;
|
||||
|
||||
const char* players = "\x13\x83\x3D\xC3\xC3\xC3\xC3\x01\x7F\xC3\x8B\x80\xC3\xC3\x00\x00\x89\x04\x24\xE8";
|
||||
const char* players_new = "\x02\x07\x90\x90";
|
||||
void *players_org = NULL;
|
||||
|
@ -5,10 +5,6 @@ const char* server_dll[] = {"server.dll", 0};
|
||||
const char* engine_dll[] = {"engine.dll", 0};
|
||||
const char* matchmaking_dll[] = {"matchmaking_ds.dll", "matchmaking.dll", 0};
|
||||
|
||||
const char* friends_lobby = "\x12\x56\x8B\xF1\x8B\x0D\xC3\xC3\xC3\xC3\x85\xC9\x74\xC3\x8B\x01\x8B\x50\x48";
|
||||
unsigned char friends_lobby_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3};
|
||||
void* friends_lobby_org = NULL;
|
||||
|
||||
const char* max_players = "\x27\x83\xBE\xC3\xC3\x00\x00\x00\x74\xC3\x8B\xC3\xC3\x8B\x06\x8B\x7A\xC3\x8B\x50\x10\x8B\xCE\xFF\xD2\x2B\xF8\x8B\x06\x8B\x50\x08\x8B\xCE\xFF\xD2\x03\xC7\x3B\x86";
|
||||
unsigned char max_players_new[]= {0x06, 0x25, 0x83, 0xF8, 0x3C, 0x90, 0x90, 0x90};
|
||||
void* max_players_org = NULL;
|
||||
@ -16,14 +12,10 @@ void* max_players_org = NULL;
|
||||
const char* lobby_sux_new = "\x02\x07\x90\x90";
|
||||
void* lobby_sux_org = NULL;
|
||||
|
||||
const char* server_bplayers = "\x1F\x55\x8B\xEC\x56\x8B\xF1\xE8\xC3\xC3\xC3\xC3\x8B\xC3\x08\x89\x01\x8B\x0D\xC3\xC3\xC3\xC3\x85\xC9\x74\xC3\x8B\x11\x8B\x42\x48";
|
||||
unsigned char server_bplayers_new[] = {0x05, 0x1C, 0xB8, 0x3C, 0x00, 0x00, 0x00};
|
||||
const char* server_bplayers = "\x36\xF7\x05\xC3\xC3\xC3\xC3\x00\x10\x00\x00\x74\x07\xB8\xC3\xC3\xC3\xC3\xEB\x11\xA1\xC3\xC3\xC3\xC3\x8B\x40\x24\x85\xC0\x75\x05\xB8\xC3\xC3\xC3\xC3\x8B\x0D\xC3\xC3\xC3\xC3\x8B\x11\x50\x8B\x42\x10\xFF\xD0\x85\xC0\x74\x17";
|
||||
unsigned char server_bplayers_new[] = {0x06, 0x00, 0xB8, 0x3C, 0x00, 0x00, 0x00, 0xC3};
|
||||
void* server_bplayers_org = NULL;
|
||||
|
||||
const char* human_limit = "\x14\x8B\x13\x8B\x82\xC3\xC3\x00\x00\x8B\xCB\xFF\xD0\x3B\xF8\x7C\xC3\x8B\xC3\xC3\x8B";
|
||||
const char* human_limit_new = "\x01\x0E\xEB";
|
||||
void* human_limit_org = NULL;
|
||||
|
||||
const char* players = "\x15\x83\x3D\xC3\xC3\xC3\xC3\x02\x7C\xC3\x68\xC3\xC3\xC3\xC3\xFF\x15\xC3\xC3\xC3\xC3\x83";
|
||||
const char* players_new = "\x01\x07\xEB";
|
||||
void* players_org = NULL;
|
||||
|
@ -7,18 +7,23 @@ IVEngineServer* engine = NULL;
|
||||
IServerPluginCallbacks* vsp_callbacks = NULL;
|
||||
ICvar* icvar = NULL;
|
||||
|
||||
#ifdef L4D1
|
||||
void* l4dtoolz::max_players_friend_lobby = NULL;
|
||||
void* l4dtoolz::chuman_limit = NULL;
|
||||
#endif
|
||||
|
||||
void* l4dtoolz::max_players_connect = NULL;
|
||||
void* l4dtoolz::max_players_server_browser = NULL;
|
||||
void* l4dtoolz::lobby_sux_ptr = NULL;
|
||||
void* l4dtoolz::chuman_limit = NULL;
|
||||
void* l4dtoolz::tmp_player = NULL;
|
||||
void* l4dtoolz::tmp_player2 = NULL;
|
||||
void* l4dtoolz::unreserved_ptr = NULL;
|
||||
void* l4dtoolz::lobby_match_ptr = NULL;
|
||||
|
||||
ConVar sv_maxplayers("sv_maxplayers", "-1", 0, "Max Human Players", true, -1, true, 32, l4dtoolz::OnChangeMaxplayers);
|
||||
#ifdef L4D1
|
||||
ConVar sv_removehumanlimit("sv_removehumanlimit", "0", 0, "Remove Human limit reached kick", true, 0, true, 1, l4dtoolz::OnChangeRemovehumanlimit);
|
||||
#endif
|
||||
ConVar L4DToolZ("L4DToolZ", "",0,"L4DToolZ Author",l4dtoolz::OnChangeIvailosp);
|
||||
ConVar sv_force_unreserved("sv_force_unreserved", "0", 0, "Disallow lobby reservation cookie", true, 0, true, 1, l4dtoolz::OnChangeUnreserved);
|
||||
|
||||
@ -26,25 +31,37 @@ void l4dtoolz::OnChangeMaxplayers ( IConVar *var, const char *pOldValue, float f
|
||||
{
|
||||
int new_value = ((ConVar*)var)->GetInt();
|
||||
int old_value = atoi(pOldValue);
|
||||
#ifdef L4D1
|
||||
if (max_players_friend_lobby == NULL || max_players_connect == NULL || max_players_server_browser == NULL || lobby_sux_ptr == NULL) {
|
||||
#else
|
||||
if (max_players_connect == NULL || max_players_server_browser == NULL || lobby_sux_ptr == NULL) {
|
||||
#endif
|
||||
Msg("sv_maxplayers init error\n");
|
||||
return;
|
||||
}
|
||||
if(new_value != old_value) {
|
||||
if(new_value >= 0) {
|
||||
#ifdef L4D1
|
||||
max_players_new[4] = friends_lobby_new[3] = server_bplayers_new[3] = new_value;
|
||||
#else
|
||||
max_players_new[4] = server_bplayers_new[3] = new_value;
|
||||
#endif
|
||||
if(lobby_match_ptr) {
|
||||
lobby_match_new[2] = new_value;
|
||||
write_signature(lobby_match_ptr, lobby_match_new);
|
||||
} else {
|
||||
Msg("sv_maxplayers MS init error\n");
|
||||
}
|
||||
#ifdef L4D1
|
||||
write_signature(max_players_friend_lobby, friends_lobby_new);
|
||||
#endif
|
||||
write_signature(max_players_connect, max_players_new);
|
||||
write_signature(lobby_sux_ptr, lobby_sux_new);
|
||||
write_signature(max_players_server_browser, server_bplayers_new);
|
||||
} else {
|
||||
#ifdef L4D1
|
||||
write_signature(max_players_friend_lobby, friends_lobby_org);
|
||||
#endif
|
||||
write_signature(max_players_connect, max_players_org);
|
||||
write_signature(lobby_sux_ptr, lobby_sux_org);
|
||||
write_signature(max_players_server_browser, server_bplayers_org);
|
||||
@ -55,6 +72,7 @@ void l4dtoolz::OnChangeMaxplayers ( IConVar *var, const char *pOldValue, float f
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef L4D1
|
||||
void l4dtoolz::OnChangeRemovehumanlimit ( IConVar *var, const char *pOldValue, float flOldValue )
|
||||
{
|
||||
int new_value = ((ConVar*)var)->GetInt();
|
||||
@ -71,7 +89,7 @@ void l4dtoolz::OnChangeRemovehumanlimit ( IConVar *var, const char *pOldValue, f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void l4dtoolz::OnChangeIvailosp ( IConVar *var, const char *pOldValue, float flOldValue )
|
||||
{
|
||||
@ -156,10 +174,12 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool
|
||||
}
|
||||
|
||||
find_base_from_list(engine_dll, &base_addr);
|
||||
#ifdef L4D1
|
||||
if(!max_players_friend_lobby) {
|
||||
max_players_friend_lobby = find_signature(friends_lobby, &base_addr, 0);
|
||||
get_original_signature(max_players_friend_lobby, friends_lobby_new, friends_lobby_org);
|
||||
}
|
||||
#endif
|
||||
if(!max_players_connect) {
|
||||
max_players_connect = find_signature(max_players, &base_addr, 0);
|
||||
get_original_signature(max_players_connect, max_players_new, max_players_org);
|
||||
@ -173,11 +193,13 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool
|
||||
#endif
|
||||
get_original_signature(lobby_sux_ptr, lobby_sux_new, lobby_sux_org);
|
||||
}
|
||||
#ifdef L4D1
|
||||
#ifdef WIN32
|
||||
if(!max_players_server_browser) {
|
||||
max_players_server_browser = find_signature(server_bplayers, &base_addr, 0);
|
||||
get_original_signature(max_players_server_browser, server_bplayers_new, server_bplayers_org);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if(!tmp_player) {
|
||||
tmp_player = find_signature(players, &base_addr, 0);
|
||||
@ -199,18 +221,23 @@ bool l4dtoolz::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool
|
||||
}
|
||||
|
||||
find_base_from_list(server_dll, &base_addr);
|
||||
|
||||
#ifdef L4D1
|
||||
if(!chuman_limit) {
|
||||
chuman_limit = find_signature(human_limit, &base_addr, 0);
|
||||
get_original_signature(chuman_limit, human_limit_new, human_limit_org);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
if(!max_players_server_browser) {
|
||||
max_players_server_browser = find_signature(server_bplayers, &base_addr, 0);
|
||||
get_original_signature(max_players_server_browser, server_bplayers_new, server_bplayers_org);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
if(!max_players_server_browser) {
|
||||
max_players_server_browser = find_signature(server_bplayers, &base_addr, 0);
|
||||
get_original_signature(max_players_server_browser, server_bplayers_new, server_bplayers_org);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -222,19 +249,22 @@ bool l4dtoolz::Unload(char *error, size_t maxlen)
|
||||
SH_RELEASE_CALLCLASS(m_EngineCC);
|
||||
#endif
|
||||
|
||||
#ifdef L4D1
|
||||
write_signature(max_players_friend_lobby, friends_lobby_org);
|
||||
write_signature(chuman_limit, human_limit_org);
|
||||
free(friends_lobby_org);
|
||||
free(human_limit_org);
|
||||
#endif
|
||||
|
||||
write_signature(max_players_connect, max_players_org);
|
||||
write_signature(lobby_sux_ptr, lobby_sux_org);
|
||||
write_signature(max_players_server_browser, server_bplayers_org);
|
||||
write_signature(chuman_limit, human_limit_org);
|
||||
write_signature(unreserved_ptr, unreserved_org);
|
||||
write_signature(lobby_match_ptr, lobby_match_org);
|
||||
|
||||
free(friends_lobby_org);
|
||||
free(max_players_org);
|
||||
free(lobby_sux_org);
|
||||
free(server_bplayers_org);
|
||||
free(human_limit_org);
|
||||
free(unreserved_org);
|
||||
free(lobby_match_org);
|
||||
|
||||
|
@ -24,15 +24,18 @@ public:
|
||||
public:
|
||||
|
||||
static void OnChangeMaxplayers ( IConVar *var, const char *pOldValue, float flOldValue );
|
||||
static void OnChangeRemovehumanlimit ( IConVar *var, const char *pOldValue, float flOldValue );
|
||||
static void OnChangeUnreserved ( IConVar *var, const char *pOldValue, float flOldValue );
|
||||
static void OnChangeIvailosp ( IConVar *var, const char *pOldValue, float flOldValue );
|
||||
|
||||
#ifdef L4D1
|
||||
static void OnChangeRemovehumanlimit ( IConVar *var, const char *pOldValue, float flOldValue );
|
||||
static void* max_players_friend_lobby;
|
||||
static void* chuman_limit;
|
||||
#endif
|
||||
|
||||
static void* max_players_connect;
|
||||
static void* max_players_server_browser;
|
||||
static void* lobby_sux_ptr;
|
||||
static void* chuman_limit;
|
||||
static void* tmp_player;
|
||||
static void* tmp_player2;
|
||||
static void* unreserved_ptr;
|
||||
|
Reference in New Issue
Block a user