mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Try fixing server crashes
This commit is contained in:
parent
62f4b39688
commit
edf1d41639
@ -14,6 +14,29 @@ namespace security
|
||||
reinterpret_cast<void(*)(int, int, int)>(0x140536A60)(localclient, index1, index2);
|
||||
}
|
||||
}
|
||||
|
||||
void remap_cached_entities(game::mp::cachedSnapshot_t& snapshot)
|
||||
{
|
||||
static bool printed = false;
|
||||
if(snapshot.num_clients > 1200 && !printed)
|
||||
{
|
||||
printed = true;
|
||||
printf("Too many entities (%d)... remapping!\n", snapshot.num_clients);
|
||||
}
|
||||
|
||||
snapshot.num_clients = std::min(snapshot.num_clients, 1200);
|
||||
}
|
||||
|
||||
void remap_cached_entities_stub(utils::hook::assembler& a)
|
||||
{
|
||||
a.pushad64();
|
||||
|
||||
a.mov(rcx, rbx);
|
||||
a.call_aligned(remap_cached_entities);
|
||||
|
||||
a.popad64();
|
||||
a.jmp(0x14044DE51);
|
||||
}
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
@ -25,6 +48,9 @@ namespace security
|
||||
|
||||
// Patch vulnerability in PlayerCards_SetCachedPlayerData
|
||||
utils::hook::call(0x1401BB909, set_cached_playerdata_stub);
|
||||
|
||||
// Patch entity overflow
|
||||
utils::hook::jump(0x14044DE3A, assemble(remap_cached_entities_stub), true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1267,6 +1267,21 @@ namespace game
|
||||
|
||||
namespace mp
|
||||
{
|
||||
struct cachedSnapshot_t
|
||||
{
|
||||
int archivedFrame;
|
||||
int time;
|
||||
int num_entities;
|
||||
int first_entity;
|
||||
int num_clients;
|
||||
int first_client;
|
||||
int num_agents;
|
||||
int first_agent;
|
||||
unsigned int scriptableCount;
|
||||
unsigned int scriptableFirstIndex;
|
||||
int usesDelta;
|
||||
};
|
||||
|
||||
struct gclient_s
|
||||
{
|
||||
char __pad0[20708];
|
||||
|
Loading…
Reference in New Issue
Block a user