Merge pull request #419 from BenCat07/master
IPC changes, cat_disconnect_and_abandon
This commit is contained in:
commit
73b384ccf7
@ -8,6 +8,7 @@
|
||||
#include "common.hpp"
|
||||
|
||||
// This is a temporary file to put code that needs moving/refactoring in.
|
||||
extern CatVar no_steps;
|
||||
extern bool *bSendPackets;
|
||||
extern CatVar no_zoom;
|
||||
extern CatVar clean_screenshots;
|
||||
|
@ -211,7 +211,8 @@ template <condition cond> inline bool CondBitCheck(condition_data_s &data)
|
||||
}
|
||||
if (cond < 32)
|
||||
{
|
||||
return data.cond_0 & (1u << (cond));
|
||||
if (data.cond_0)
|
||||
return data.cond_0 & (1u << (cond));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -257,7 +258,8 @@ inline void CondBitSet(condition_data_s &data)
|
||||
}
|
||||
else
|
||||
{
|
||||
data.cond_0 |= (1 << (cond));
|
||||
if (data.cond_0)
|
||||
data.cond_0 |= (1 << (cond));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -276,7 +278,8 @@ inline void CondBitSet(condition_data_s &data)
|
||||
}
|
||||
else
|
||||
{
|
||||
data.cond_0 &= ~(1u << (cond));
|
||||
if (data.cond_0)
|
||||
data.cond_0 &= ~(1u << (cond));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -313,4 +316,4 @@ template <condition cond> inline void RemoveCondition(CachedEntity *ent)
|
||||
CE_VAR(ent, netvar._condition_bits, condition_data_s));
|
||||
}
|
||||
CondBitSet<cond, false>(CE_VAR(ent, netvar.iCond, condition_data_s));
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
};
|
||||
|
||||
extern VMTHook panel;
|
||||
extern VMTHook localbaseent;
|
||||
extern VMTHook clientmode;
|
||||
extern VMTHook clientmode4;
|
||||
extern VMTHook client;
|
||||
|
@ -93,6 +93,7 @@ void VMTHook::Apply()
|
||||
}
|
||||
|
||||
VMTHook input{};
|
||||
VMTHook localbaseent{};
|
||||
VMTHook steamfriends{};
|
||||
VMTHook baseclientstate{};
|
||||
VMTHook baseclientstate8{};
|
||||
|
@ -41,7 +41,6 @@ void RunEnginePrediction(IClientEntity *ent, CUserCmd *ucmd)
|
||||
|
||||
float frameTime = g_GlobalVars->frametime;
|
||||
float curTime = g_GlobalVars->curtime;
|
||||
|
||||
CUserCmd defaultCmd;
|
||||
if (ucmd == NULL)
|
||||
{
|
||||
|
@ -23,7 +23,9 @@ CatCommand fix_deadlock("ipc_fix_deadlock", "Fix deadlock", []() {
|
||||
pthread_mutex_unlock(&peer->memory->mutex);
|
||||
}
|
||||
});
|
||||
|
||||
CatCommand id("ipc_id", "Echo ipc id", []() {
|
||||
logging::Info("%d",ipc::peer->client_id);
|
||||
});
|
||||
CatCommand connect("ipc_connect", "Connect to IPC server", []() {
|
||||
if (peer)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ CTFGCClientSystem *CTFGCClientSystem::GTFGCClientSystem()
|
||||
typedef CTFGCClientSystem *(*GTFGCClientSystem_t)();
|
||||
static uintptr_t addr1 = gSignatures.GetClientSignature(
|
||||
"55 B8 ? ? ? ? 89 E5 5D C3 8D B6 00 00 00 00 55 A1 ? ? ? ? 89 E5 5D C3 "
|
||||
"8D B6 00 00 00 00 A1 ? ? ? ?");
|
||||
"8D B6 00 00 00 00 A1");
|
||||
static GTFGCClientSystem_t GTFGCClientSystem_fn =
|
||||
GTFGCClientSystem_t(addr1);
|
||||
|
||||
@ -26,7 +26,7 @@ void CTFGCClientSystem::AbandonCurrentMatch()
|
||||
{
|
||||
typedef void *(*AbandonCurrentMatch_t)(CTFGCClientSystem *);
|
||||
static uintptr_t addr1 = gSignatures.GetClientSignature(
|
||||
"55 89 E5 57 56 8D 75 ? 53 81 EC ? ? ? ? C7 04 24 ? ? ? ?");
|
||||
"55 89 E5 57 56 8D 75 ? 53 81 EC ? ? ? ? C7 04 24");
|
||||
static AbandonCurrentMatch_t AbandonCurrentMatch_fn =
|
||||
AbandonCurrentMatch_t(addr1);
|
||||
if (AbandonCurrentMatch_fn == nullptr)
|
||||
@ -40,7 +40,7 @@ bool CTFGCClientSystem::BConnectedToMatchServer(bool flag)
|
||||
{
|
||||
typedef bool (*BConnectedToMatchServer_t)(CTFGCClientSystem *, bool);
|
||||
static uintptr_t addr =
|
||||
gSignatures.GetClientSignature("55 89 E5 53 80 7D ? ? 8B 55 ? 75 ?");
|
||||
gSignatures.GetClientSignature("55 89 E5 53 80 7D ? ? 8B 55 ? 75");
|
||||
static BConnectedToMatchServer_t BConnectedToMatchServer_fn =
|
||||
BConnectedToMatchServer_t(addr);
|
||||
|
||||
@ -51,7 +51,7 @@ bool CTFGCClientSystem::BHaveLiveMatch()
|
||||
{
|
||||
typedef int (*BHaveLiveMatch_t)(CTFGCClientSystem *);
|
||||
static uintptr_t addr = gSignatures.GetClientSignature(
|
||||
"55 31 C0 89 E5 53 8B 4D ? 0F B6 91 ? ? ? ?");
|
||||
"55 31 C0 89 E5 53 8B 4D ? 0F B6 91");
|
||||
static BHaveLiveMatch_t BHaveLiveMatch_fn = BHaveLiveMatch_t(addr);
|
||||
if (BHaveLiveMatch_fn == nullptr)
|
||||
{
|
||||
|
18
src/tfmm.cpp
18
src/tfmm.cpp
@ -52,11 +52,25 @@ void queue_leave()
|
||||
else
|
||||
logging::Info("queue_start: CTFPartyClient == null!");
|
||||
}
|
||||
|
||||
Timer abandont{};
|
||||
CatCommand abandoncmd("disconnect_and_abandon", "Disconnect and abandon", []() {
|
||||
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
|
||||
if (client) {
|
||||
abandon();
|
||||
while (1) {
|
||||
if (abandont.test_and_set(4000)) {
|
||||
queue_leave();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
logging::Info("your party client is gay!");
|
||||
});
|
||||
void abandon()
|
||||
{
|
||||
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
|
||||
if (gc != nullptr)
|
||||
if (gc != nullptr && gc->BConnectedToMatchServer(false))
|
||||
gc->AbandonCurrentMatch();
|
||||
else
|
||||
logging::Info("abandon: CTFGCClientSystem == null!");
|
||||
|
@ -129,7 +129,7 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
|
||||
switch (ent->m_Type)
|
||||
{
|
||||
case ENTITY_BUILDING:
|
||||
if (!ent->m_bEnemy && !(teammates || teammate_buildings))
|
||||
if (!ent->m_bEnemy && !(teammates || teammate_buildings) && (!(chamsR || chamsB || chamsG) && ent != LOCAL_E))
|
||||
{
|
||||
return colors::empty;
|
||||
}
|
||||
@ -178,7 +178,7 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity)
|
||||
if (ent->m_iHealth == 0 || !ent->m_iHealth)
|
||||
return false;
|
||||
if (CE_BYTE(LOCAL_E, netvar.m_bCarryingObject) &&
|
||||
LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 85.0f)
|
||||
LOCAL_E->m_vecOrigin.DistTo(ent->m_vecOrigin) <= 100.0f)
|
||||
return false;
|
||||
return true;
|
||||
case ENTITY_PLAYER:
|
||||
|
Reference in New Issue
Block a user